Skip to content

Commit 11a384f

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-59489' into NORD-FIXES
2 parents d0cb6fc + 4cb4647 commit 11a384f

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

app/code/Magento/Customer/Model/EmailNotification.php

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ class EmailNotification implements EmailNotificationInterface
6060
self::NEW_ACCOUNT_EMAIL_CONFIRMATION => self::XML_PATH_CONFIRM_EMAIL_TEMPLATE,
6161
];
6262

63+
/**
64+
* Map of templates. Use for backward compatibility
65+
*/
66+
const TEMPLATE_MAP = [
67+
self::XML_PATH_FORGOT_EMAIL_TEMPLATE => self::XML_PATH_RESET_PASSWORD_TEMPLATE
68+
];
69+
6370
/**#@-*/
6471

6572
/**
@@ -241,11 +248,10 @@ private function sendEmailTemplate(
241248
$storeId = null,
242249
$email = null
243250
) {
244-
$templateId = $this->scopeConfig->getValue($template, 'store', $storeId);
251+
$templateId = $this->getTemplateId($template, 'store', $storeId);
245252
if ($email === null) {
246253
$email = $customer->getEmail();
247254
}
248-
249255
$transport = $this->transportBuilder->setTemplateIdentifier($templateId)
250256
->setTemplateOptions(['area' => 'frontend', 'store' => $storeId])
251257
->setTemplateVars($templateParams)
@@ -378,4 +384,23 @@ public function newAccount(
378384
$storeId
379385
);
380386
}
387+
388+
/**
389+
* Get templateId include considering template map
390+
*
391+
* @param string $template
392+
* @param string $scopeType
393+
* @param string $storeId
394+
* @return string
395+
*/
396+
private function getTemplateId($template, $scopeType, $storeId)
397+
{
398+
if (array_key_exists($template, self::TEMPLATE_MAP)) {
399+
$templateId = $this->scopeConfig->getValue(self::TEMPLATE_MAP[$template], $scopeType, $storeId);
400+
if ($templateId) {
401+
return $templateId;
402+
}
403+
}
404+
return $this->scopeConfig->getValue($template, $scopeType, $storeId);
405+
}
381406
}

app/code/Magento/Customer/Test/Unit/Model/EmailNotificationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ public function testPasswordResetConfirmation()
545545

546546
$this->scopeConfigMock->expects($this->at(0))
547547
->method('getValue')
548-
->with(EmailNotification::XML_PATH_FORGOT_EMAIL_TEMPLATE, ScopeInterface::SCOPE_STORE, $customerStoreId)
548+
->with(EmailNotification::XML_PATH_RESET_PASSWORD_TEMPLATE, ScopeInterface::SCOPE_STORE, $customerStoreId)
549549
->willReturn($templateIdentifier);
550550
$this->scopeConfigMock->expects($this->at(1))
551551
->method('getValue')

0 commit comments

Comments
 (0)