Skip to content

Commit 43b78bd

Browse files
committed
Update customer email address
1 parent 6fef637 commit 43b78bd

File tree

15 files changed

+229
-114
lines changed

15 files changed

+229
-114
lines changed

Block/Adminhtml/Email/Edit.php

100644100755
+34-7
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,48 @@
77

88
namespace MagePal\EditOrderEmail\Block\Adminhtml\Email;
99

10-
class Edit extends \Magento\Backend\Block\Template
10+
use Magento\Backend\Block\Template;
11+
use Magento\Backend\Block\Template\Context;
12+
use Magento\Framework\AuthorizationInterface;
13+
use Magento\Framework\Registry;
14+
use Magento\Sales\Api\Data\OrderInterface;
15+
use MagePal\EditOrderEmail\Helper\Data;
16+
17+
class Edit extends Template
1118
{
1219
/**
1320
* Core registry
1421
*
15-
* @var \Magento\Framework\Registry
22+
* @var Registry
1623
*/
1724
protected $coreRegistry = null;
1825

1926
/**
20-
* @var \Magento\Framework\AuthorizationInterface
27+
* MagePal Helper
28+
*
29+
* @var Data
30+
*/
31+
protected $_helper;
32+
33+
/**
34+
* @var Context $context
35+
* @var Registry $coreRegistry
36+
* @var AuthorizationInterface
37+
* @var Data $helper
2138
*/
2239
protected $authorization;
2340

2441
public function __construct(
25-
\Magento\Backend\Block\Template\Context $context,
26-
\Magento\Framework\Registry $coreRegistry,
27-
\Magento\Framework\AuthorizationInterface $authorization,
42+
Context $context,
43+
Registry $coreRegistry,
44+
AuthorizationInterface $authorization,
45+
Data $helper,
2846
array $data = []
2947
) {
3048
parent::__construct($context, $data);
3149
$this->coreRegistry = $coreRegistry;
3250
$this->authorization = $authorization;
51+
$this->_helper = $helper;
3352
}
3453

3554
/**
@@ -48,9 +67,17 @@ public function getOrderId()
4867
return $this->getRequest()->getParam('order_id');
4968
}
5069

70+
/**
71+
* @return int
72+
*/
73+
public function getAutocheckEmail()
74+
{
75+
return $this->_helper->getConfigValue('magepal_editorderemail/general/update_customer_email');
76+
}
77+
5178
public function getEmailAddress()
5279
{
53-
/** @var \Magento\Sales\Api\Data\OrderInterface $order */
80+
/** @var OrderInterface $order */
5481
if ($order = $this->coreRegistry->registry('sales_order')) {
5582
return $order->getCustomerEmail();
5683
}

Block/Adminhtml/System/Config/Form/Composer/Version.php

100644100755
+30-19
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,45 @@
77

88
namespace MagePal\EditOrderEmail\Block\Adminhtml\System\Config\Form\Composer;
99

10-
class Version extends \Magento\Config\Block\System\Config\Form\Field
10+
use Exception;
11+
use Magento\Backend\Block\Template\Context;
12+
use Magento\Config\Block\System\Config\Form\Field;
13+
use Magento\Framework\App\DeploymentConfig;
14+
use Magento\Framework\Component\ComponentRegistrar;
15+
use Magento\Framework\Component\ComponentRegistrarInterface;
16+
use Magento\Framework\Data\Form\Element\AbstractElement;
17+
use Magento\Framework\Exception\LocalizedException;
18+
use Magento\Framework\Filesystem\Directory\ReadFactory;
19+
use Magento\Framework\Phrase;
20+
21+
class Version extends Field
1122
{
1223

1324
/**
14-
* @var \Magento\Framework\App\DeploymentConfig
25+
* @var DeploymentConfig
1526
*/
1627
protected $deploymentConfig;
1728

1829
/**
19-
* @var \Magento\Framework\Component\ComponentRegistrarInterface
30+
* @var ComponentRegistrarInterface
2031
*/
2132
protected $componentRegistrar;
2233

2334
/**
24-
* @var \Magento\Framework\Filesystem\Directory\ReadFactory
35+
* @var ReadFactory
2536
*/
2637
protected $readFactory;
2738

2839
/**
29-
* @param \Magento\Framework\App\DeploymentConfig $deploymentConfig
30-
* @param \Magento\Framework\Component\ComponentRegistrarInterface $componentRegistrar
31-
* @param \Magento\Framework\Filesystem\Directory\ReadFactory $readFactory
40+
* @param DeploymentConfig $deploymentConfig
41+
* @param ComponentRegistrarInterface $componentRegistrar
42+
* @param ReadFactory $readFactory
3243
*/
3344
public function __construct(
34-
\Magento\Backend\Block\Template\Context $context,
35-
\Magento\Framework\App\DeploymentConfig $deploymentConfig,
36-
\Magento\Framework\Component\ComponentRegistrarInterface $componentRegistrar,
37-
\Magento\Framework\Filesystem\Directory\ReadFactory $readFactory,
45+
Context $context,
46+
DeploymentConfig $deploymentConfig,
47+
ComponentRegistrarInterface $componentRegistrar,
48+
ReadFactory $readFactory,
3849
array $data = []
3950
) {
4051
$this->deploymentConfig = $deploymentConfig;
@@ -46,11 +57,11 @@ public function __construct(
4657
/**
4758
* Render button
4859
*
49-
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
60+
* @param AbstractElement $element
5061
* @return string
51-
* @throws \Magento\Framework\Exception\LocalizedException
62+
* @throws LocalizedException
5263
*/
53-
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
64+
public function render(AbstractElement $element)
5465
{
5566
// Remove scope label
5667
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
@@ -60,11 +71,11 @@ public function render(\Magento\Framework\Data\Form\Element\AbstractElement $ele
6071
/**
6172
* Return element html
6273
*
63-
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
74+
* @param AbstractElement $element
6475
* @return string
6576
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
6677
*/
67-
protected function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
78+
protected function _getElementHtml(AbstractElement $element)
6879
{
6980
return 'v' . $this->getVersion();
7081
}
@@ -93,12 +104,12 @@ public function getModuleName()
93104
* Get module composer version
94105
*
95106
* @param $moduleName
96-
* @return \Magento\Framework\Phrase|string|void
107+
* @return Phrase|string|void
97108
*/
98109
public function getComposerVersion($moduleName)
99110
{
100111
$path = $this->componentRegistrar->getPath(
101-
\Magento\Framework\Component\ComponentRegistrar::MODULE,
112+
ComponentRegistrar::MODULE,
102113
$moduleName
103114
);
104115

@@ -110,7 +121,7 @@ public function getComposerVersion($moduleName)
110121
$data = json_decode($composerJsonData);
111122
return !empty($data->version) ? $data->version : __('Unknown');
112123
}
113-
} catch (\Exception $e) {
124+
} catch (Exception $e) {
114125
//
115126
}
116127

Block/Adminhtml/System/Config/Form/Module/Version.php

100644100755
+17-11
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,28 @@
77

88
namespace MagePal\EditOrderEmail\Block\Adminhtml\System\Config\Form\Module;
99

10-
class Version extends \Magento\Config\Block\System\Config\Form\Field
10+
use Magento\Backend\Block\Template\Context;
11+
use Magento\Config\Block\System\Config\Form\Field;
12+
use Magento\Framework\Data\Form\Element\AbstractElement;
13+
use Magento\Framework\Exception\LocalizedException;
14+
use Magento\Framework\Module\ModuleListInterface;
15+
16+
class Version extends Field
1117
{
1218

1319
/**
14-
* @var \Magento\Framework\Module\ModuleListInterface
20+
* @var ModuleListInterface
1521
*/
1622
protected $_moduleList;
1723

1824
/**
19-
* @param \Magento\Backend\Block\Template\Context $context
20-
* @param \Magento\Framework\Module\ModuleListInterface $moduleList
25+
* @param Context $context
26+
* @param ModuleListInterface $moduleList
2127
* @param array $data
2228
*/
2329
public function __construct(
24-
\Magento\Backend\Block\Template\Context $context,
25-
\Magento\Framework\Module\ModuleListInterface $moduleList,
30+
Context $context,
31+
ModuleListInterface $moduleList,
2632
array $data = []
2733
) {
2834
parent::__construct($context, $data);
@@ -32,11 +38,11 @@ public function __construct(
3238
/**
3339
* Render button
3440
*
35-
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
41+
* @param AbstractElement $element
3642
* @return string
37-
* @throws \Magento\Framework\Exception\LocalizedException
43+
* @throws LocalizedException
3844
*/
39-
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
45+
public function render(AbstractElement $element)
4046
{
4147
// Remove scope label
4248
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
@@ -46,11 +52,11 @@ public function render(\Magento\Framework\Data\Form\Element\AbstractElement $ele
4652
/**
4753
* Return element html
4854
*
49-
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
55+
* @param AbstractElement $element
5056
* @return string
5157
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
5258
*/
53-
protected function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
59+
protected function _getElementHtml(AbstractElement $element)
5460
{
5561
return 'v' . $this->getVersion();
5662
}

0 commit comments

Comments
 (0)