From a4beb96754f6fd9cd7d93e22aa92125800c8dfff Mon Sep 17 00:00:00 2001 From: yuri Date: Tue, 4 Dec 2018 14:44:51 +0200 Subject: [PATCH] fix email import last date today --- application/Espo/Services/EmailAccount.php | 6 ++++++ application/Espo/Services/InboundEmail.php | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/application/Espo/Services/EmailAccount.php b/application/Espo/Services/EmailAccount.php index 1001c5d86d..7d8594e9a7 100644 --- a/application/Espo/Services/EmailAccount.php +++ b/application/Espo/Services/EmailAccount.php @@ -269,6 +269,7 @@ class EmailAccount extends Record } $previousLastUID = $lastUID; + $previousLastDate = $lastDate; if (!empty($lastUID) && !$forceByDate) { $idList = $storage->getIdsFromUID($lastUID); @@ -375,6 +376,11 @@ class EmailAccount extends Record $k++; } + if ($forceByDate) { + $nowDt = new \DateTime(); + $lastDate = $nowDt->format('Y-m-d H:i:s'); + } + $fetchData->lastDate->$folder = $lastDate; $fetchData->lastUID->$folder = $lastUID; diff --git a/application/Espo/Services/InboundEmail.php b/application/Espo/Services/InboundEmail.php index 5305864cc9..20b4b9e70f 100644 --- a/application/Espo/Services/InboundEmail.php +++ b/application/Espo/Services/InboundEmail.php @@ -281,6 +281,7 @@ class InboundEmail extends \Espo\Services\Record } $previousLastUID = $lastUID; + $previousLastDate = $lastDate; if (!empty($lastUID) && !$forceByDate) { $idList = $storage->getIdsFromUID($lastUID); @@ -405,6 +406,11 @@ class InboundEmail extends \Espo\Services\Record $k++; } + if ($forceByDate) { + $nowDt = new \DateTime(); + $lastDate = $nowDt->format('Y-m-d H:i:s'); + } + $fetchData->lastDate->$folder = $lastDate; $fetchData->lastUID->$folder = $lastUID;