Skip to content

Commit b5265e8

Browse files
authored
Update Create.php
1 parent 7e5bb80 commit b5265e8

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

app/code/Magento/Sales/Model/AdminOrder/Create.php

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2038,27 +2038,23 @@ protected function _validate()
20382038
*/
20392039
protected function _getNewCustomerEmail()
20402040
{
2041-
$emailrequired = $this->getIsEmailRequired();
2042-
2043-
if ($emailrequired) {
2044-
return $this->getData('account/email');
2045-
} else {
2046-
$email = $this->getData('account/email');
2047-
if (empty($email)) {
2048-
$email = $this-> generateEmail();
2049-
}
2050-
return $email;
2041+
$email = $this->getData('account/email');
2042+
2043+
if ($email || $this->getIsEmailRequired()) {
2044+
return $email;
20512045
}
2046+
2047+
return $this->generateEmail();
20522048
}
20532049

20542050
/**
20552051
* Check email is require
20562052
*
20572053
* @return bool
20582054
*/
2059-
protected function getIsEmailRequired()
2055+
private function getIsEmailRequired(): bool
20602056
{
2061-
return $this->_scopeConfig->getValue(
2057+
return (bool)$this->_scopeConfig->getValue(
20622058
self::XML_PATH_EMAIL_REQUIRED_CREATE_ORDER,
20632059
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
20642060
);
@@ -2069,7 +2065,7 @@ protected function getIsEmailRequired()
20692065
*
20702066
* @return string
20712067
*/
2072-
protected function generateEmail()
2068+
private function generateEmail(): string
20732069
{
20742070
$host = $this->_scopeConfig->getValue(
20752071
self::XML_PATH_DEFAULT_EMAIL_DOMAIN,
@@ -2080,6 +2076,7 @@ protected function generateEmail()
20802076
$account = $this->getData('account');
20812077
$account['email'] = $email;
20822078
$this->setData('account', $account);
2079+
20832080
return $email;
20842081
}
20852082

0 commit comments

Comments
 (0)