Merge branch '19.0' of git@github.com:Dolibarr/dolibarr.git into 20.0

This commit is contained in:
ldestailleur
2025-06-28 17:22:00 +02:00

View File

@@ -5757,7 +5757,9 @@ class Facture extends CommonInvoice
if ($resql) { if ($resql) {
while ($obj = $this->db->fetch_object($resql)) { while ($obj = $this->db->fetch_object($resql)) {
if (!$error) { // Create a loopError that is reset at each loop, this counter is added to the global counter at the end of loop
$loopError = 0;
// Load event // Load event
$res = $tmpinvoice->fetch($obj->id); $res = $tmpinvoice->fetch($obj->id);
if ($res > 0) { if ($res > 0) {
@@ -5816,11 +5818,11 @@ class Facture extends CommonInvoice
} }
if (empty($to)) { if (empty($to)) {
$errormesg = "Failed to send remind to thirdparty id=".$tmpinvoice->socid.". No email defined for invoice or customer."; $errormesg = "Failed to send remind to thirdparty id=".$tmpinvoice->socid.". No email defined for invoice or customer.";
$error++; $loopError++;
} }
} else { } else {
$errormesg = "Failed to load recipient with thirdparty id=".$tmpinvoice->socid; $errormesg = "Failed to load recipient with thirdparty id=".$tmpinvoice->socid;
$error++; $loopError++;
} }
} }
@@ -5831,10 +5833,10 @@ class Facture extends CommonInvoice
} }
if (empty($from)) { if (empty($from)) {
$errormesg = "Failed to get sender into global setup MAIN_MAIL_EMAIL_FROM"; $errormesg = "Failed to get sender into global setup MAIN_MAIL_EMAIL_FROM";
$error++; $loopError++;
} }
if (!$error && !empty($to)) { if (!$loopError && !empty($to)) {
$this->db->begin(); $this->db->begin();
$to = implode(',', $to); $to = implode(',', $to);
@@ -5843,7 +5845,7 @@ class Facture extends CommonInvoice
} }
// Errors Recipient // Errors Recipient
$errors_to = getDolGlobalString('MAIN_MAIL_ERRORS_TO'); $errors_to = $conf->global->MAIN_MAIL_ERRORS_TO;
$trackid = 'inv'.$tmpinvoice->id; $trackid = 'inv'.$tmpinvoice->id;
$sendcontext = 'standard'; $sendcontext = 'standard';
@@ -5913,7 +5915,7 @@ class Facture extends CommonInvoice
$actioncomm->create($user); $actioncomm->create($user);
} else { } else {
$errormesg = $cMailFile->error.' : '.$to; $errormesg = $cMailFile->error.' : '.$to;
$error++; $loopError++;
// Add a line into event table // Add a line into event table
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
@@ -5957,9 +5959,10 @@ class Facture extends CommonInvoice
} }
} else { } else {
$errorsMsg[] = 'Failed to fetch record invoice with ID = '.$obj->id; $errorsMsg[] = 'Failed to fetch record invoice with ID = '.$obj->id;
$error++; $loopError++;
}
} }
$error += $loopError;
} }
} else { } else {
$error++; $error++;