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
commit 0221204cd1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1165,6 +1165,7 @@ class EmailCollector extends CommonObject
$arrayofemail = array();
$now = dol_now();
$datelastok = $now;
if (empty($this->host)) {
$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
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.");
$datelastok = strtotime($headers['Date']); // Set datetime
break;
}
} else {
@ -3743,7 +3745,7 @@ class EmailCollector extends CommonObject
}
if (empty($error) && empty($mode)) {
$this->datelastok = $now;
$this->datelastok = $datelastok;
}
if (!empty($this->errors)) {