Skip to content

Commit 3096508

Browse files
committed
Add translation and add order comment
1 parent c344bb2 commit 3096508

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

Controller/Adminhtml/Edit/Index.php

+17-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Exception;
1111
use Magento\Backend\App\Action;
1212
use Magento\Backend\App\Action\Context;
13+
use Magento\Backend\Model\Auth\Session;
1314
use Magento\Customer\Api\AccountManagementInterface;
1415
use Magento\Customer\Api\CustomerRepositoryInterface;
1516
use Magento\Framework\Controller\Result\Json;
@@ -49,6 +50,10 @@ class Index extends Action
4950
* @var EmailAddress
5051
*/
5152
private $emailAddressValidator;
53+
/**
54+
* @var Session
55+
*/
56+
private $authSession;
5257

5358
/**
5459
* Index constructor.
@@ -59,6 +64,7 @@ class Index extends Action
5964
* @param JsonFactory $resultJsonFactory
6065
* @param CustomerRepositoryInterface $customerRepository
6166
* @param EmailAddress $emailAddressValidator
67+
* @param Session $authSession
6268
*/
6369
public function __construct(
6470
Context $context,
@@ -67,7 +73,8 @@ public function __construct(
6773
OrderCustomerManagementInterface $orderCustomerService,
6874
JsonFactory $resultJsonFactory,
6975
CustomerRepositoryInterface $customerRepository,
70-
EmailAddress $emailAddressValidator
76+
EmailAddress $emailAddressValidator,
77+
Session $authSession
7178
) {
7279
parent::__construct($context);
7380

@@ -77,6 +84,7 @@ public function __construct(
7784
$this->accountManagement = $accountManagement;
7885
$this->customerRepository = $customerRepository;
7986
$this->emailAddressValidator = $emailAddressValidator;
87+
$this->authSession = $authSession;
8088
}
8189

8290
/**
@@ -119,6 +127,14 @@ public function execute()
119127
/** @var $order OrderInterface */
120128
$order = $this->orderRepository->get($orderId);
121129
if ($order->getEntityId() && $order->getCustomerEmail() == $oldEmailAddress) {
130+
$comment = sprintf(
131+
__("Order email address change from %s to %s by %s"),
132+
$oldEmailAddress,
133+
$emailAddress,
134+
$this->authSession->getUser()->getUserName()
135+
);
136+
137+
$order->addStatusHistoryComment($comment);
122138
$order->setCustomerEmail($emailAddress);
123139
$this->orderRepository->save($order);
124140
}

etc/adminhtml/system.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<label>Edit Order Email</label>
2121
<comment>
2222
<![CDATA[
23-
<strong>Copyright © 2018 <a href="http://bit.ly/MPEXSMTP" target="_blank">www.magepal.com</a> / <a href="mailto:[email protected]">[email protected]</a></strong><br />
23+
<strong>Copyright © 2019 <a href="http://bit.ly/MPEXSMTP" target="_blank">www.magepal.com</a> / <a href="mailto:[email protected]">[email protected]</a></strong><br />
2424
Discover other must have extensions at <a href="https://www.magepal.com" target="_blank">www.magepal.com</a>. Thanks for choosing MagePal Extensions.<br/><br/>
2525
<hr style="border-top: 1px solid #e3e3e3" />
2626
]]>

i18n/en_US.csv

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"Module Version","Module Version"
2+
"Composer Version","Composer Version"
3+
"CUSTOM SHIPPING RATE","CUSTOM SHIPPING RATE"
4+
"Enable","Enable"
5+
"Invalid order id.","Invalid order id."
6+
"Invalid Email address.","Invalid Email address."
7+
"Order email address change from %s to %s by %s","Order email address change from %s to %s by %s"
8+
"Email address successfully changed.","Email address successfully changed."
9+
"Automatically update customer record email address","Automatically update customer record email address"

0 commit comments

Comments
 (0)