Fix error management
This commit is contained in:
parent
459961711e
commit
4d11b5db31
@ -2913,17 +2913,18 @@ class Adherent extends CommonObject
|
|||||||
dol_syslog(__METHOD__.' - Process delta = '.$daysbeforeend, LOG_DEBUG);
|
dol_syslog(__METHOD__.' - Process delta = '.$daysbeforeend, LOG_DEBUG);
|
||||||
|
|
||||||
if (!is_numeric($daysbeforeend)) {
|
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++;
|
$nbko++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$tmp = dol_getdate($now);
|
$tmp = dol_getdate($now);
|
||||||
$datetosearchfor = dol_time_plus_duree(dol_mktime(0, 0, 0, $tmp['mon'], $tmp['mday'], $tmp['year']), $daysbeforeend, 'd');
|
$datetosearchfor = dol_time_plus_duree(dol_mktime(0, 0, 0, $tmp['mon'], $tmp['mday'], $tmp['year'], 'tzserver'), $daysbeforeend, 'd');
|
||||||
|
|
||||||
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'adherent';
|
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'adherent';
|
||||||
$sql .= " WHERE entity = ".$conf->entity; // Do not use getEntity('adherent').")" here, we want the batch to be on its entity only;
|
$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 .= " AND datefin = '".$this->db->idate($datetosearchfor)."'";
|
||||||
|
//$sql .= " LIMIT 10000";
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
@ -2956,7 +2957,7 @@ class Adherent extends CommonObject
|
|||||||
dol_syslog("sendReminderForExpiredSubscription Language for member id ".$adherent->id." set to ".$outputlangs->defaultlang." mysoc->default_lang=".$mysoc->default_lang);
|
dol_syslog("sendReminderForExpiredSubscription Language for member id ".$adherent->id." set to ".$outputlangs->defaultlang." mysoc->default_lang=".$mysoc->default_lang);
|
||||||
|
|
||||||
$arraydefaultmessage = null;
|
$arraydefaultmessage = null;
|
||||||
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION;
|
$labeltouse = getDolGlobalString('ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION');
|
||||||
|
|
||||||
if (!empty($labeltouse)) {
|
if (!empty($labeltouse)) {
|
||||||
$arraydefaultmessage = $formmail->getEMailTemplate($this->db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
|
$arraydefaultmessage = $formmail->getEMailTemplate($this->db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
|
||||||
@ -2980,7 +2981,7 @@ class Adherent extends CommonObject
|
|||||||
$result = $cmail->sendfile();
|
$result = $cmail->sendfile();
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
$error++;
|
$error++;
|
||||||
$this->error = $cmail->error;
|
$this->error .= $cmail->error.' ';
|
||||||
if (!is_null($cmail->errors)) {
|
if (!is_null($cmail->errors)) {
|
||||||
$this->errors += $cmail->errors;
|
$this->errors += $cmail->errors;
|
||||||
}
|
}
|
||||||
@ -2998,8 +2999,7 @@ class Adherent extends CommonObject
|
|||||||
$extraparams = '';
|
$extraparams = '';
|
||||||
|
|
||||||
$actionmsg = '';
|
$actionmsg = '';
|
||||||
$actionmsg2 = $langs->transnoentities('MailSentBy').' '.CMailFile::getValidAddress($from, 4, 0, 1).' '.$langs->transnoentities('To').' '.
|
$actionmsg2 = $langs->transnoentities('MailSentBy').' '.CMailFile::getValidAddress($from, 4, 0, 1).' '.$langs->transnoentities('To').' '.CMailFile::getValidAddress($sendto, 4, 0, 1);
|
||||||
CMailFile::getValidAddress($sendto, 4, 0, 1);
|
|
||||||
if ($message) {
|
if ($message) {
|
||||||
$actionmsg = $langs->transnoentities('MailFrom').': '.dol_escape_htmltag($from);
|
$actionmsg = $langs->transnoentities('MailFrom').': '.dol_escape_htmltag($from);
|
||||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTo').': '.dol_escape_htmltag($sendto));
|
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTo').': '.dol_escape_htmltag($sendto));
|
||||||
@ -3046,7 +3046,10 @@ class Adherent extends CommonObject
|
|||||||
$actioncomm->create($user);
|
$actioncomm->create($user);
|
||||||
}
|
}
|
||||||
} else {
|
} 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++;
|
$nbko++;
|
||||||
$listofmembersko[$adherent->id] = $adherent->id;
|
$listofmembersko[$adherent->id] = $adherent->id;
|
||||||
@ -3088,7 +3091,7 @@ class Adherent extends CommonObject
|
|||||||
if ($listofids) {
|
if ($listofids) {
|
||||||
$listofids .= ']';
|
$listofids .= ']';
|
||||||
}
|
}
|
||||||
$this->output .= $listofids;
|
$this->output .= ' ids='.$listofids;
|
||||||
}
|
}
|
||||||
if ($nbko) {
|
if ($nbko) {
|
||||||
$this->output .= ' - Canceled for '.$nbko.' member (no email or email sending error)';
|
$this->output .= ' - Canceled for '.$nbko.' member (no email or email sending error)';
|
||||||
@ -3116,6 +3119,6 @@ class Adherent extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return $nbko;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user