From a98f7f5068d53c3d1e5ecee4307cb76d5b4ff37f Mon Sep 17 00:00:00 2001 From: yuri Date: Thu, 1 Aug 2019 13:55:47 +0300 Subject: [PATCH] lead capture optInDateTime placeholder --- application/Espo/Services/LeadCapture.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/application/Espo/Services/LeadCapture.php b/application/Espo/Services/LeadCapture.php index 5405ecdad1..a3c51d3ff3 100644 --- a/application/Espo/Services/LeadCapture.php +++ b/application/Espo/Services/LeadCapture.php @@ -47,6 +47,7 @@ class LeadCapture extends Record $this->addDependency('container'); $this->addDependency('defaultLanguage'); $this->addDependency('hookManager'); + $this->addDependency('dateTime'); } protected function getMailSender() @@ -531,6 +532,17 @@ class LeadCapture extends Record $body = str_replace('{optInUrl}', $url, $body); $body = str_replace('{optInLink}', $linkHtml, $body); + $createdAt = $uniqueId->get('createdAt'); + if ($createdAt) { + $dateString = $this->getInjection('dateTime')->convertSystemDateTime($createdAt, null, $this->getConfig()->get('dateFormat')); + $timeString = $this->getInjection('dateTime')->convertSystemDateTime($createdAt, null, $this->getConfig()->get('timeFormat')); + $dateTimeString = $this->getInjection('dateTime')->convertSystemDateTime($createdAt); + + $body = str_replace('{optInDate}', $dateString, $body); + $body = str_replace('{optInTime}', $timeString, $body); + $body = str_replace('{optInDateTime}', $dateTimeString, $body); + } + $email = $this->getEntityManager()->getEntity('Email'); $email->set([ 'to' => $emailAddress,