Improve error handling confirm_billcreate

This commit is contained in:
Francis Appels 2022-04-25 11:24:09 +02:00
parent e6ce81bf8b
commit e9cfb9b69c

View File

@ -368,7 +368,7 @@ if (empty($reshook)) {
$TFactThirdNbLines[$cmd->socid] = 0; //init nblines to have lines ordered by expedition and rang $TFactThirdNbLines[$cmd->socid] = 0; //init nblines to have lines ordered by expedition and rang
} else { } else {
$langs->load("errors"); $langs->load("errors");
$errors[] = $cmd->ref.' : '.$langs->trans($objecttmp->error); $errors[] = $cmd->ref.' : '.$langs->trans($objecttmp->errors[0]);
$error++; $error++;
} }
} }
@ -377,7 +377,7 @@ if (empty($reshook)) {
$res = $objecttmp->add_object_linked($objecttmp->origin, $id_order); $res = $objecttmp->add_object_linked($objecttmp->origin, $id_order);
if ($res == 0) { if ($res == 0) {
$errors[] = $objecttmp->error; $errors[] = $cmd->ref.' : '.$langs->trans($objecttmp->errors[0]);
$error++; $error++;
} }
@ -640,7 +640,11 @@ if (empty($reshook)) {
$action = 'create'; $action = 'create';
$_GET["origin"] = $_POST["origin"]; $_GET["origin"] = $_POST["origin"];
$_GET["originid"] = $_POST["originid"]; $_GET["originid"] = $_POST["originid"];
if (!empty($errors)) {
setEventMessages(null, $errors, 'errors');
} else {
setEventMessages("Error", null, 'errors'); setEventMessages("Error", null, 'errors');
}
$error++; $error++;
} }
} }