FIX - The test for fetch the third party is not necessary because the thirdparty is not required on a event and it's not required for send the reminder by email to the user. (#34731)

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
kkhelifa-opendsi
2025-08-07 16:22:35 +02:00
committed by GitHub
parent ba09a8ee84
commit e85e15b4fd

View File

@@ -2710,10 +2710,9 @@ class ActionComm extends CommonObject
// Load event // Load event
$res = $this->fetch($actionCommReminder->fk_actioncomm); $res = $this->fetch($actionCommReminder->fk_actioncomm);
if ($res > 0) { if ($res > 0) {
$res2 = $this->fetch_thirdparty();
if ($res2 >= 0) {
// PREPARE EMAIL // PREPARE EMAIL
$errormesg = ''; $errormesg = '';
$this->fetch_thirdparty();
// Make substitution in email content // Make substitution in email content
$substitutionarray = getCommonSubstitutionArray($langs, 0, null, $this); $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $this);
@@ -2733,11 +2732,11 @@ class ActionComm extends CommonObject
if (!empty($recipient->email)) { if (!empty($recipient->email)) {
$to = $recipient->email; $to = $recipient->email;
} else { } else {
$errormesg = "Failed to send remind to user id=".$actionCommReminder->fk_user.". No email defined for user."; $errormesg = "Failed to send remind to user id=" . $actionCommReminder->fk_user . ". No email defined for user.";
$error++; $error++;
} }
} else { } else {
$errormesg = "Failed to load recipient with user id=".$actionCommReminder->fk_user; $errormesg = "Failed to load recipient with user id=" . $actionCommReminder->fk_user;
$error++; $error++;
} }
@@ -2759,7 +2758,7 @@ class ActionComm extends CommonObject
if ($cMailFile->sendfile()) { if ($cMailFile->sendfile()) {
$nbMailSend++; $nbMailSend++;
} else { } else {
$errormesg = 'Failed to send email to: '.$to.' '.$cMailFile->error.implode(',', $cMailFile->errors); $errormesg = 'Failed to send email to: ' . $to . ' ' . $cMailFile->error . implode(',', $cMailFile->errors);
$error++; $error++;
} }
} }
@@ -2786,10 +2785,6 @@ class ActionComm extends CommonObject
$errorsMsg[] = $errormesg; $errorsMsg[] = $errormesg;
} }
} }
} else {
$errorsMsg[] = 'Failed to fetch record thirdparty on actioncomm with ID = '.$actionCommReminder->fk_actioncomm;
$error++;
}
} else { } else {
$errorsMsg[] = 'Failed to fetch record actioncomm with ID = '.$actionCommReminder->fk_actioncomm; $errorsMsg[] = 'Failed to fetch record actioncomm with ID = '.$actionCommReminder->fk_actioncomm;
$error++; $error++;