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