Retours PR
This commit is contained in:
parent
43590587e5
commit
c8c6be2038
@ -1315,6 +1315,7 @@ if ($resql)
|
|||||||
if (GETPOST('confirm') == 'yes') {
|
if (GETPOST('confirm') == 'yes') {
|
||||||
$tmpproposal = new Propal($db);
|
$tmpproposal = new Propal($db);
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
$error = 0;
|
||||||
foreach ($toselect as $checked) {
|
foreach ($toselect as $checked) {
|
||||||
if ($tmpproposal->fetch($checked)) {
|
if ($tmpproposal->fetch($checked)) {
|
||||||
if ($tmpproposal->statut == 0) {
|
if ($tmpproposal->statut == 0) {
|
||||||
@ -1322,13 +1323,21 @@ if ($resql)
|
|||||||
setEventMessage($tmpproposal->ref . " " . $langs->trans('PassedInOpenStatus'), 'mesgs');
|
setEventMessage($tmpproposal->ref . " " . $langs->trans('PassedInOpenStatus'), 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($langs->trans('CantBeValidated'), 'errors');
|
setEventMessage($langs->trans('CantBeValidated'), 'errors');
|
||||||
|
$error++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($tmpproposal->ref . " " . $langs->trans('IsNotADraft'), 'errors');
|
setEventMessage($tmpproposal->ref . " " . $langs->trans('IsNotADraft'), 'errors');
|
||||||
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
dol_print_error($db);
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
if ($error){
|
||||||
|
$db->rollback();
|
||||||
|
} else {
|
||||||
|
$db->commit();
|
||||||
}
|
}
|
||||||
$db->commit();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1336,25 +1345,31 @@ if ($resql)
|
|||||||
if (GETPOST('confirm') == 'yes') {
|
if (GETPOST('confirm') == 'yes') {
|
||||||
$tmpproposal = new Propal($db);
|
$tmpproposal = new Propal($db);
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
$error = 0;
|
||||||
foreach ($toselect as $checked) {
|
foreach ($toselect as $checked) {
|
||||||
$tmpproposal->fetch($checked);
|
|
||||||
if ($tmpproposal->fetch($checked)) {
|
if ($tmpproposal->fetch($checked)) {
|
||||||
if ($tmpproposal->statut == 1) {
|
if ($tmpproposal->statut == 1) {
|
||||||
$sqlp = "UPDATE " . MAIN_DB_PREFIX . "propal SET fk_statut = 2 WHERE rowid = " . $checked;
|
$tmpproposal->statut = 2;
|
||||||
$resqlp = $db->query($sqlp);
|
if ($tmpproposal->update($user)) {
|
||||||
if ($resqlp) {
|
|
||||||
setEventMessage($tmpproposal->ref . " " . $langs->trans('Signed'), 'mesgs');
|
setEventMessage($tmpproposal->ref . " " . $langs->trans('Signed'), 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
|
$error++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($tmpproposal->ref . " " . $langs->trans('CantBeSign'), 'errors');
|
setEventMessage($tmpproposal->ref . " " . $langs->trans('CantBeSign'), 'errors');
|
||||||
|
$error++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$db->commit();
|
if ($error){
|
||||||
|
$db->rollback();
|
||||||
|
} else {
|
||||||
|
$db->commit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user