From ebabae0f622c7e655c0432e18b9b87d0687bc834 Mon Sep 17 00:00:00 2001 From: kpitn Date: Tue, 20 Aug 2024 17:38:46 +0200 Subject: [PATCH] add missing delay variable in email --- Model/Customer/Notifier/MailSender.php | 5 +++++ Model/EraseEntityManagement.php | 2 +- view/frontend/email/erase_pending.html | 2 +- view/frontend/email/erase_pending_guest.html | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Model/Customer/Notifier/MailSender.php b/Model/Customer/Notifier/MailSender.php index 63564d7..74e3c16 100644 --- a/Model/Customer/Notifier/MailSender.php +++ b/Model/Customer/Notifier/MailSender.php @@ -15,6 +15,7 @@ use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Mail\Template\TransportBuilder; use Magento\Store\Model\StoreManagerInterface; +use Opengento\Gdpr\Model\EraseEntityManagement; use Opengento\Gdpr\Model\Notifier\AbstractMailSender; class MailSender extends AbstractMailSender implements SenderInterface @@ -24,6 +25,7 @@ class MailSender extends AbstractMailSender implements SenderInterface private StoreManagerInterface $storeManager; public function __construct( + protected EraseEntityManagement $entityManagement, View $customerViewHelper, TransportBuilder $transportBuilder, ScopeConfigInterface $scopeConfig, @@ -42,8 +44,11 @@ public function __construct( */ public function send(CustomerInterface $customer): void { + $delay = $this->entityManagement->resolveErasureDelay(); + $storeId = $customer->getStoreId() === null ? null : (int)$customer->getStoreId(); $vars = [ + 'delay' => $delay !== 0 ? $delay / 60 : 0, 'customer' => $customer, 'store' => $this->storeManager->getStore($customer->getStoreId()), 'customer_data' => [ diff --git a/Model/EraseEntityManagement.php b/Model/EraseEntityManagement.php index 18b5daa..f44ed74 100644 --- a/Model/EraseEntityManagement.php +++ b/Model/EraseEntityManagement.php @@ -98,7 +98,7 @@ private function retrieveScheduledAt(): string ); } - private function resolveErasureDelay(): int + public function resolveErasureDelay(): int { return (int)$this->scopeConfig->getValue(self::CONFIG_PATH_ERASURE_DELAY); } diff --git a/view/frontend/email/erase_pending.html b/view/frontend/email/erase_pending.html index a526e4d..3694748 100644 --- a/view/frontend/email/erase_pending.html +++ b/view/frontend/email/erase_pending.html @@ -19,7 +19,7 @@

{{trans "We have received a request to erase the information associated with your account at %store_name." store_name=$store.getFrontendName()}}

-

{{trans 'You can cancel the erase within %delay hours by logging into your account.' account_url=$this.getUrl($store,'customer/account/',[_nosid:1]) |raw}}

+

{{trans 'You can cancel the erase within %delay hours by logging into your account.' delay=$delay account_url=$this.getUrl($store,'customer/account/',[_nosid:1]) |raw}}

diff --git a/view/frontend/email/erase_pending_guest.html b/view/frontend/email/erase_pending_guest.html index e5d34c3..62350fb 100644 --- a/view/frontend/email/erase_pending_guest.html +++ b/view/frontend/email/erase_pending_guest.html @@ -19,7 +19,7 @@

{{trans "We have received a request to erase the information associated with your account at %store_name." store_name=$store.getFrontendName()}}

-

{{trans 'You can cancel the erase within %delay hours by logging into your account.' account_url=$this.getUrl($store,'customer/account/',[_nosid:1]) |raw}}

+

{{trans 'You can cancel the erase within %delay hours by logging into your account.' delay=$delay account_url=$this.getUrl($store,'customer/account/',[_nosid:1]) |raw}}