Propagate all errors messages

This commit is contained in:
Yoan Mollard 2022-07-26 00:02:14 +02:00
parent ae70dc11c6
commit 195b9f5ebc

View File

@ -60,6 +60,7 @@ global $dolibarr_main_url_root;
// Init vars
$errmsg = '';
$errors = array();
$error = 0;
$backtopage = GETPOST('backtopage', 'alpha');
$action = GETPOST('action', 'aZ09');
@ -90,6 +91,7 @@ if ($type == 'conf') {
if ($resultproject < 0) {
$error++;
$errmsg .= $project->error;
$errors = array_merge($errors, $project->errors);
}
}
@ -99,6 +101,7 @@ if ($type == 'global') {
if ($resultproject < 0) {
$error++;
$errmsg .= $project->error;
$errors = array_merge($errors, $project->errors);
} else {
$sql = "SELECT COUNT(*) as nb FROM ".MAIN_DB_PREFIX."projet";
$sql .= " WHERE ".MAIN_DB_PREFIX."eventorganization_conferenceorboothattendee = ".((int) $project->id);
@ -279,6 +282,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
if ($resultconfattendee < 0) {
$error++;
$errmsg .= $confattendee->error;
$errors = array_merge($errors, $confattendee->errors);
}
}
@ -403,6 +407,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
// If an error was found
$error++;
$errmsg .= $thirdparty->error;
$errors = array_merge($errors, $thirdparty->errors);
} elseif ($resultfetchthirdparty == 0) { // No thirdparty found + a payment is expected
// Creation of a new thirdparty
if (!empty($societe)) {
@ -441,6 +446,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
if ($readythirdparty < 0) {
$error++;
$errmsg .= $thirdparty->error;
$errors = array_merge($errors, $thirdparty->errors);
} else {
$thirdparty->country_code = getCountry($thirdparty->country_id, 2, $db, $langs);
$thirdparty->country = getCountry($thirdparty->country_code, 0, $db, $langs);
@ -472,6 +478,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
if ($resultprod < 0) {
$error++;
$errmsg .= $productforinvoicerow->error;
$errors = array_merge($errors, $productforinvoicerow->errors);
} else {
$facture = new Facture($db);
if (empty($confattendee->fk_invoice)) {
@ -668,7 +675,7 @@ if ($maxattendees && $currentnbofattendees >= $maxattendees) {
print '<br>';
dol_htmloutput_errors($errmsg);
dol_htmloutput_errors($errmsg, $errors);
if ((!empty($conference->id) && $conference->status == ConferenceOrBooth::STATUS_CONFIRMED) || (!empty($project->id) && $project->status == Project::STATUS_VALIDATED)) {
if (empty($maxattendees) || $currentnbofattendees < $maxattendees) {