Fixing style errors.

This commit is contained in:
stickler-ci 2021-02-03 10:37:15 +00:00
parent eb15c4d800
commit 609428bc09

View File

@ -272,97 +272,97 @@ if (empty($reshook))
} }
if ($action == 'validate') { if ($action == 'validate') {
if (GETPOST('confirm') == 'yes') { if (GETPOST('confirm') == 'yes') {
$tmpproposal = new Propal($db); $tmpproposal = new Propal($db);
$db->begin(); $db->begin();
$error = 0; $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) {
if ($tmpproposal->valid($user)) { if ($tmpproposal->valid($user)) {
setEventMessage($tmpproposal->ref." ".$langs->trans('PassedInOpenStatus'), 'mesgs'); setEventMessage($tmpproposal->ref." ".$langs->trans('PassedInOpenStatus'), 'mesgs');
} else {
setEventMessage($langs->trans('CantBeValidated'), 'errors');
$error++;
}
} else { } else {
setEventMessage($tmpproposal->ref." ".$langs->trans('IsNotADraft'), 'errors'); setEventMessage($langs->trans('CantBeValidated'), 'errors');
$error++; $error++;
} }
} else {
setEventMessage($tmpproposal->ref." ".$langs->trans('IsNotADraft'), 'errors');
$error++;
} }
}
dol_print_error($db);
$error++;
}
if ($error) {
$db->rollback();
} else {
$db->commit();
}
}
}
if ($action == "sign") {
if (GETPOST('confirm') == 'yes') {
$tmpproposal = new Propal($db);
$db->begin();
$error = 0;
foreach ($toselect as $checked) {
if ($tmpproposal->fetch($checked)) {
if ($tmpproposal->statut == 1) {
$tmpproposal->statut = 2;
if ($tmpproposal->update($user)) {
setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs');
} else {
dol_print_error($db);
$error++;
}
} else {
setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeSign'), 'errors');
$error++;
}
} else {
dol_print_error($db); dol_print_error($db);
$error++; $error++;
} }
if ($error) { }
$db->rollback(); if ($error) {
} else { $db->rollback();
$db->commit(); } else {
} $db->commit();
} }
} }
}
if ($action == "sign") { if ($action == "nosign") {
if (GETPOST('confirm') == 'yes') { if (GETPOST('confirm') == 'yes') {
$tmpproposal = new Propal($db); $tmpproposal = new Propal($db);
$db->begin(); $db->begin();
$error = 0; $error = 0;
foreach ($toselect as $checked) { foreach ($toselect as $checked) {
if ($tmpproposal->fetch($checked)) { if ($tmpproposal->fetch($checked)) {
if ($tmpproposal->statut == 1) { if ($tmpproposal->statut == 1) {
$tmpproposal->statut = 2; $tmpproposal->statut = 3;
if ($tmpproposal->update($user)) { if ($tmpproposal->update($user)) {
setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs'); setEventMessage($tmpproposal->ref." ".$langs->trans('NoSigned'), 'mesgs');
} else {
dol_print_error($db);
$error++;
}
} else { } else {
setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeSign'), 'errors'); dol_print_error($db);
$error++; $error++;
} }
} else { } else {
dol_print_error($db); setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeSign'), 'errors');
$error++; $error++;
} }
}
if ($error) {
$db->rollback();
} else { } else {
$db->commit(); dol_print_error($db);
$error++;
} }
} }
} if ($error) {
if ($action == "nosign") { $db->rollback();
if (GETPOST('confirm') == 'yes') { } else {
$tmpproposal = new Propal($db); $db->commit();
$db->begin();
$error = 0;
foreach ($toselect as $checked) {
if ($tmpproposal->fetch($checked)) {
if ($tmpproposal->statut == 1) {
$tmpproposal->statut = 3;
if ($tmpproposal->update($user)) {
setEventMessage($tmpproposal->ref." ".$langs->trans('NoSigned'), 'mesgs');
} else {
dol_print_error($db);
$error++;
}
} else {
setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeSign'), 'errors');
$error++;
}
} else {
dol_print_error($db);
$error++;
}
}
if ($error) {
$db->rollback();
} else {
$db->commit();
}
} }
} }
}
/* /*