Skip to content

Commit 6da7fbf

Browse files
authored
ENGCOM-4101: #18698 Fixed order email sending via order async email sending when order was created with disabled email sending #20953
2 parents 074e6ab + 3f1013e commit 6da7fbf

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ class OrderSender extends Sender
5555
* @param OrderIdentity $identityContainer
5656
* @param Order\Email\SenderBuilderFactory $senderBuilderFactory
5757
* @param \Psr\Log\LoggerInterface $logger
58+
* @param Renderer $addressRenderer
5859
* @param PaymentHelper $paymentHelper
5960
* @param OrderResource $orderResource
6061
* @param \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig
61-
* @param Renderer $addressRenderer
6262
* @param ManagerInterface $eventManager
6363
*/
6464
public function __construct(
@@ -97,7 +97,7 @@ public function __construct(
9797
*/
9898
public function send(Order $order, $forceSyncMode = false)
9999
{
100-
$order->setSendEmail(true);
100+
$order->setSendEmail($this->identityContainer->isEnabled());
101101

102102
if (!$this->globalConfig->getValue('sales_email/general/async_sending') || $forceSyncMode) {
103103
if ($this->checkAndSend($order)) {

app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/OrderSenderTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,15 @@ public function testSend($configValue, $forceSyncMode, $emailSendingResult, $sen
6464

6565
$this->orderMock->expects($this->once())
6666
->method('setSendEmail')
67-
->with(true);
67+
->with($emailSendingResult);
6868

6969
$this->globalConfig->expects($this->once())
7070
->method('getValue')
7171
->with($configPath)
7272
->willReturn($configValue);
7373

7474
if (!$configValue || $forceSyncMode) {
75-
$this->identityContainerMock->expects($this->once())
75+
$this->identityContainerMock->expects($this->exactly(2))
7676
->method('isEnabled')
7777
->willReturn($emailSendingResult);
7878

@@ -118,7 +118,7 @@ public function testSend($configValue, $forceSyncMode, $emailSendingResult, $sen
118118

119119
$this->orderMock->expects($this->once())
120120
->method('setEmailSent')
121-
->with(true);
121+
->with($emailSendingResult);
122122

123123
$this->orderResourceMock->expects($this->once())
124124
->method('saveAttribute')
@@ -210,7 +210,7 @@ public function testSendVirtualOrder($isVirtualOrder, $formatCallCount, $expecte
210210
->with('sales_email/general/async_sending')
211211
->willReturn(false);
212212

213-
$this->identityContainerMock->expects($this->once())
213+
$this->identityContainerMock->expects($this->exactly(2))
214214
->method('isEnabled')
215215
->willReturn(true);
216216

0 commit comments

Comments
 (0)