Skip to content
Snippets Groups Projects
Commit 525b2cf2 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix: Edition of contract on intervention failed

parent 7d9671f6
No related branches found
No related tags found
No related merge requests found
...@@ -50,7 +50,7 @@ class FormContract ...@@ -50,7 +50,7 @@ class FormContract
* @param string $htmlname Nom de la zone html * @param string $htmlname Nom de la zone html
* @param int $maxlength Maximum length of label * @param int $maxlength Maximum length of label
* @param int $showempty Show empty line * @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) function select_contract($socid=-1, $selected='', $htmlname='contrattid', $maxlength=16, $showempty=1)
{ {
...@@ -137,4 +137,32 @@ class FormContract ...@@ -137,4 +137,32 @@ class FormContract
return -1; 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)) ...@@ -477,7 +477,7 @@ if (empty($reshook))
} }
// Set into a contract // 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')); $result=$object->set_contrat($user,GETPOST('contratid','int'));
if ($result < 0) dol_print_error($db,$object->error); if ($result < 0) dol_print_error($db,$object->error);
...@@ -1251,15 +1251,8 @@ else if ($id > 0 || ! empty($ref)) ...@@ -1251,15 +1251,8 @@ else if ($id > 0 || ! empty($ref))
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($action == 'contrat') if ($action == 'contrat')
{ {
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">'; $formcontract= new Formcontract($db);
print '<tr><td>'; $formcontract->formSelectContract($_SERVER["PHP_SELF"].'?id='.$object->id, $object->socid, $object->fk_contrat, 'contratid', 0, 1);
$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>';
} }
else else
{ {
...@@ -1649,7 +1642,6 @@ else if ($id > 0 || ! empty($ref)) ...@@ -1649,7 +1642,6 @@ else if ($id > 0 || ! empty($ref))
} }
print '</div>'; print '</div>';
print '<br>';
if ($action != 'presend') if ($action != 'presend')
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment