diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 53b77b558ce..028d5559246 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -1318,7 +1318,7 @@ if ($resql) foreach ($toselect as $checked) { if ($tmpproposal->fetch($checked)) { if ($tmpproposal->statut == 0) { - if($tmpproposal->valid($user)){ + if ($tmpproposal->valid($user)){ setEventMessage($tmpproposal->ref . " " . $langs->trans('PassedInOpenStatus'), 'mesgs'); } else { setEventMessage($langs->trans('CantBeValidated'), 'errors'); @@ -1332,32 +1332,31 @@ if ($resql) } } - if ($action == "sign") { - if (GETPOST('confirm') == 'yes') { - $tmpproposal = new Propal($db); - $db->begin(); - foreach ($toselect as $checked) { - $tmpproposal->fetch($checked); - if ($tmpproposal->fetch($checked)) { - if ($tmpproposal->statut == 1) { - $sqlp = "UPDATE " . MAIN_DB_PREFIX . "propal SET fk_statut = 2 WHERE rowid = " . $checked; - $resqlp = $db->query($sqlp); - if ($resqlp) { - setEventMessage($tmpproposal->ref . " " . $langs->trans('Signed'), 'mesgs'); - } else { - dol_print_error($db); - } + if ($action == "sign") { + if (GETPOST('confirm') == 'yes') { + $tmpproposal = new Propal($db); + $db->begin(); + foreach ($toselect as $checked) { + $tmpproposal->fetch($checked); + if ($tmpproposal->fetch($checked)) { + if ($tmpproposal->statut == 1) { + $sqlp = "UPDATE " . MAIN_DB_PREFIX . "propal SET fk_statut = 2 WHERE rowid = " . $checked; + $resqlp = $db->query($sqlp); + if ($resqlp) { + setEventMessage($tmpproposal->ref . " " . $langs->trans('Signed'), 'mesgs'); } else { - setEventMessage($tmpproposal->ref . " " . $langs->trans('CantBeSign'), 'errors'); + dol_print_error($db); } } else { - dol_print_error($db); + setEventMessage($tmpproposal->ref . " " . $langs->trans('CantBeSign'), 'errors'); } + } else { + dol_print_error($db); } - $db->commit(); } + $db->commit(); } - + } } else { dol_print_error($db); }