Fix: Edition of contract on intervention failed
This commit is contained in:
parent
7d9671f6d3
commit
525b2cf297
@ -50,7 +50,7 @@ class FormContract
|
||||
* @param string $htmlname Nom de la zone html
|
||||
* @param int $maxlength Maximum length of label
|
||||
* @param int $showempty Show empty line
|
||||
* @return int Nbre of project if OK, <0 if KO
|
||||
* @return int Nbr of project if OK, <0 if KO
|
||||
*/
|
||||
function select_contract($socid=-1, $selected='', $htmlname='contrattid', $maxlength=16, $showempty=1)
|
||||
{
|
||||
@ -137,4 +137,32 @@ class FormContract
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a form to select a contract
|
||||
*
|
||||
* @param int $page Page
|
||||
* @param int $socid Id third party (-1=all, 0=only contracts not linked to a third party, id=contracts not linked or linked to third party id)
|
||||
* @param int $selected Id contract preselected
|
||||
* @param string $htmlname Nom de la zone html
|
||||
* @param int $maxlength Maximum length of label
|
||||
* @param int $showempty Show empty line
|
||||
* @return int Nbr of project if OK, <0 if KO
|
||||
*/
|
||||
function formSelectContract($page, $socid=-1, $selected='', $htmlname='contrattid', $maxlength=16, $showempty=1)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
print "\n";
|
||||
print '<form method="post" action="'.$page.'">';
|
||||
print '<input type="hidden" name="action" value="setcontract">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||
print '<tr><td>';
|
||||
$this->select_contract($socid, $selected, $htmlname, $maxlength, $showempty);
|
||||
print '</td>';
|
||||
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
print '</tr></table></form>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -477,7 +477,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Set into a contract
|
||||
else if ($action == 'setcontrat' && $user->rights->contrat->creer)
|
||||
else if ($action == 'setcontract' && $user->rights->contrat->creer)
|
||||
{
|
||||
$result=$object->set_contrat($user,GETPOST('contratid','int'));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
@ -1251,15 +1251,8 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'contrat')
|
||||
{
|
||||
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||
print '<tr><td>';
|
||||
$htmlcontract= new Formcontract($db);
|
||||
//print "$socid,$selected,$htmlname";
|
||||
$htmlcontract->select_contract($object->socid,$object->fk_contrat,'contratid');
|
||||
|
||||
print '</td>';
|
||||
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
print '</tr></table>';
|
||||
$formcontract= new Formcontract($db);
|
||||
$formcontract->formSelectContract($_SERVER["PHP_SELF"].'?id='.$object->id, $object->socid, $object->fk_contrat, 'contratid', 0, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1649,7 +1642,6 @@ else if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
|
||||
if ($action != 'presend')
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user