Merge pull request #32456 from Hystepik/fix-email-collector

Fix email collector datetimelast ok and email fetching
This commit is contained in:
Laurent Destailleur
2025-02-22 17:32:05 +01:00
committed by GitHub

View File

@@ -1165,6 +1165,7 @@ class EmailCollector extends CommonObject
$arrayofemail = array(); $arrayofemail = array();
$now = dol_now(); $now = dol_now();
$datelastok = $now;
if (empty($this->host)) { if (empty($this->host)) {
$this->error = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('EMailHost')); $this->error = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('EMailHost'));
@@ -3642,6 +3643,7 @@ class EmailCollector extends CommonObject
// Stop the loop to process email if we reach maximum collected per collect // Stop the loop to process email if we reach maximum collected per collect
if ($this->maxemailpercollect > 0 && $nbemailok >= $this->maxemailpercollect) { if ($this->maxemailpercollect > 0 && $nbemailok >= $this->maxemailpercollect) {
dol_syslog("EmailCollect::doCollectOneCollector We reach maximum of ".$nbemailok." collected with success, so we stop this collector now."); dol_syslog("EmailCollect::doCollectOneCollector We reach maximum of ".$nbemailok." collected with success, so we stop this collector now.");
$datelastok = strtotime($headers['Date']); // Set datetime
break; break;
} }
} else { } else {
@@ -3743,7 +3745,7 @@ class EmailCollector extends CommonObject
} }
if (empty($error) && empty($mode)) { if (empty($error) && empty($mode)) {
$this->datelastok = $now; $this->datelastok = $datelastok;
} }
if (!empty($this->errors)) { if (!empty($this->errors)) {