From b42b0ef841f864d7575482268b010fb47ecacf8b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Nov 2022 18:49:59 +0100 Subject: [PATCH] Fix error management --- htdocs/adherents/class/adherent.class.php | 14 +++++++++----- htdocs/core/class/html.formmail.class.php | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index ed4ca4ecf51..491899a3370 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2957,7 +2957,7 @@ class Adherent extends CommonObject dol_syslog(__METHOD__.' - Process delta = '.$daysbeforeend, LOG_DEBUG); if (!is_numeric($daysbeforeend)) { - $blockingerrormsg = "Value for delta is not a positive or negative numeric"; + $blockingerrormsg = "Value for delta is not a numeric value"; $nbko++; break; } @@ -2968,6 +2968,7 @@ class Adherent extends CommonObject $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'adherent'; $sql .= " WHERE entity = ".((int) $conf->entity); // Do not use getEntity('adherent').")" here, we want the batch to be on its entity only; $sql .= " AND datefin = '".$this->db->idate($datetosearchfor)."'"; + //$sql .= " LIMIT 10000"; $resql = $this->db->query($sql); if ($resql) { @@ -3000,7 +3001,7 @@ class Adherent extends CommonObject dol_syslog("sendReminderForExpiredSubscription Language for member id ".$adherent->id." set to ".$outputlangs->defaultlang." mysoc->default_lang=".$mysoc->default_lang); $arraydefaultmessage = null; - $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION; + $labeltouse = getDolGlobalString('ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION'); if (!empty($labeltouse)) { $arraydefaultmessage = $formmail->getEMailTemplate($this->db, 'member', $user, $outputlangs, 0, 1, $labeltouse); @@ -3024,7 +3025,7 @@ class Adherent extends CommonObject $result = $cmail->sendfile(); if (!$result) { $error++; - $this->error = $cmail->error; + $this->error .= $cmail->error.' '; if (!is_null($cmail->errors)) { $this->errors += $cmail->errors; } @@ -3089,7 +3090,10 @@ class Adherent extends CommonObject $actioncomm->create($user); } } else { - $blockingerrormsg = "Can't find email template, defined into member module setup, to use for reminding"; + //$blockingerrormsg = "Can't find email template with label=".$labeltouse.", to use for the reminding email"; + + $error++; + $this->error .= "Can't find email template with label=".$labeltouse.", to use for the reminding email "; $nbko++; $listofmembersko[$adherent->id] = $adherent->id; @@ -3159,6 +3163,6 @@ class Adherent extends CommonObject } } - return 0; + return $nbko; } } diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index aa2ee4b3e6a..c81ccb769ab 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1279,7 +1279,7 @@ class FormMail extends Form * * @param DoliDB $dbs Database handler * @param string $type_template Get message for model/type=$type_template, type='all' also included. - * @param User $user Get template public or limited to this user + * @param User $user Get templates public + limited to this user * @param Translate $outputlangs Output lang object * @param int $id Id of template to get, or -1 for first found with position 0, or 0 for first found whatever is position (priority order depends on lang provided or not) or -2 for exact match with label (no answer if not found) * @param int $active 1=Only active template, 0=Only disabled, -1=All