Skip to content

Commit 5fbfd81

Browse files
author
Joan He
committed
Merge remote-tracking branch 'borg/MC-15289' into pr
2 parents 43feb45 + 25ea720 commit 5fbfd81

File tree

2 files changed

+40
-22
lines changed

2 files changed

+40
-22
lines changed

app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Account.php

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,7 @@ protected function _prepareForm()
133133
$this->_addAttributesToForm($attributes, $fieldset);
134134

135135
$this->_form->addFieldNameSuffix('order[account]');
136-
$storeId = (int)$this->_sessionQuote->getStoreId();
137-
$this->_form->setValues($this->extractValuesFromAttributes($attributes, $storeId));
136+
$this->_form->setValues($this->extractValuesFromAttributes($attributes));
138137

139138
return $this;
140139
}
@@ -192,37 +191,18 @@ public function getFormValues()
192191
* Extract the form values from attributes.
193192
*
194193
* @param array $attributes
195-
* @param int $storeId
196194
* @return array
197195
*/
198-
private function extractValuesFromAttributes(array $attributes, int $storeId): array
196+
private function extractValuesFromAttributes(array $attributes): array
199197
{
200198
$formValues = $this->getFormValues();
201199
foreach ($attributes as $code => $attribute) {
202200
$defaultValue = $attribute->getDefaultValue();
203201
if (isset($defaultValue) && !isset($formValues[$code])) {
204202
$formValues[$code] = $defaultValue;
205203
}
206-
if ($code === 'group_id' && empty($defaultValue)) {
207-
$formValues[$code] = $this->getDefaultCustomerGroup($storeId);
208-
}
209204
}
210205

211206
return $formValues;
212207
}
213-
214-
/**
215-
* Gets default customer group.
216-
*
217-
* @param int $storeId
218-
* @return string|null
219-
*/
220-
private function getDefaultCustomerGroup(int $storeId): ?string
221-
{
222-
return $this->_scopeConfig->getValue(
223-
'customer/create_account/default_group',
224-
ScopeInterface::SCOPE_STORE,
225-
$storeId
226-
);
227-
}
228208
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminChangeCustomerGroupInNewOrder">
12+
<annotations>
13+
<title value="Customer account group cannot be selected while creating a new customer in order"/>
14+
<stories value="MC-15290: Customer account group cannot be selected while creating a new customer in order"/>
15+
<description value="Customer account group cannot be selected while creating a new customer in order"/>
16+
<severity value="MAJOR"/>
17+
<testCaseId value="MC-15290"/>
18+
<useCaseId value="MC-15289"/>
19+
<group value="sales"/>
20+
</annotations>
21+
22+
<before>
23+
<actionGroup ref="LoginAsAdmin" stepKey="login"/>
24+
</before>
25+
<after>
26+
<actionGroup ref="logout" stepKey="logout"/>
27+
</after>
28+
29+
<actionGroup ref="navigateToNewOrderPageNewCustomerSingleStore" stepKey="openNewOrder"/>
30+
<selectOption selector="{{AdminOrderFormAccountSection.group}}" userInput="Retailer" stepKey="selectCustomerGroup"/>
31+
<waitForPageLoad stepKey="waitForPageLoad"/>
32+
<grabValueFrom selector="{{AdminOrderFormAccountSection.group}}" stepKey="grabGroupValue"/>
33+
<assertEquals stepKey="assertValueIsStillSelected">
34+
<actualResult type="variable">$grabGroupValue</actualResult>
35+
<expectedResult type="string">3</expectedResult>
36+
</assertEquals>
37+
</test>
38+
</tests>

0 commit comments

Comments
 (0)