FIX error messages not displayed

This commit is contained in:
John BOTELLA 2019-04-18 10:40:34 +02:00
parent 6cd24ab210
commit 0855d84ccf

View File

@ -1537,14 +1537,16 @@ if (empty($reshook))
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
if (empty($datefacture)) { if (empty($datefacture)) {
$error++; $error++;
$mesg = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->trans("Date")) . '</div>'; $mesg = $langs->trans("ErrorFieldRequired", $langs->trans("Date"));
setEventMessages($mesg, null, 'errors');
} }
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
if (!($_POST['situations'] > 0)) { if (!($_POST['situations'] > 0)) {
$error++; $error++;
$mesg = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->trans("InvoiceSituation")) . '</div>'; $mesg = $langs->trans("ErrorFieldRequired", $langs->trans("InvoiceSituation"));
setEventMessages($mesg, null, 'errors');
} }
if (!$error) { if (!$error) {
@ -2270,11 +2272,13 @@ if (empty($reshook))
if (!$object->fetch($id) > 0) dol_print_error($db); if (!$object->fetch($id) > 0) dol_print_error($db);
if (!is_null(GETPOST('all_progress')) && GETPOST('all_progress') != "") if (!is_null(GETPOST('all_progress')) && GETPOST('all_progress') != "")
{ {
$all_progress = GETPOST('all_progress', 'int');
foreach ($object->lines as $line) foreach ($object->lines as $line)
{ {
$percent = $line->get_prev_progress($object->id); $percent = $line->get_prev_progress($object->id);
if (GETPOST('all_progress') < $percent) { if (floatval($all_progress) < floatval($percent)) {
$mesg = '<div class="warning">' . $langs->trans("CantBeLessThanMinPercent") . '</div>'; $mesg = $langs->trans("Line") . ' ' . $i . ' '. $line->ref .' : ' . $langs->trans("CantBeLessThanMinPercent");
setEventMessages($mesg, null, 'warnings');
$result = -1; $result = -1;
} else } else
$object->update_percent($line, $_POST['all_progress']); $object->update_percent($line, $_POST['all_progress']);