Skip to content

Commit 412678e

Browse files
author
Mohan Ahuja
committed
ACP2E-356: Cannot create a new customer from Admin if Customer Sharing setting is set to Global
- Added Fix to allow admin to save customer even if they have not selected the "Send Welcome Email from" field in the UI. - Added MFTF test
1 parent 81340cb commit 412678e

File tree

2 files changed

+69
-1
lines changed

2 files changed

+69
-1
lines changed

app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ public function execute()
349349
['customer' => $customer, 'request' => $this->getRequest()]
350350
);
351351

352-
if (isset($customerData['sendemail_store_id']) && $customerData['sendemail_store_id'] !== false) {
352+
if (isset($customerData['sendemail_store_id']) && !empty($customerData['sendemail_store_id'])) {
353353
$customer->setStoreId($customerData['sendemail_store_id']);
354354
try {
355355
$this->customerAccountManagement->validateCustomerStoreIdByWebsiteId($customer);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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="AdminCreateCustomerInSecondWebsiteWithGlobalAccountSharingEnabled">
12+
<annotations>
13+
<features value="Customer"/>
14+
<title value="Admin create customer in second website when global account sharing is enabled"/>
15+
<stories value="Admin create customer in second website when global account sharing is enabled"/>
16+
<testCaseId value="AC-2542"/>
17+
<useCaseId value="ACP2E-356"/>
18+
<severity value="MAJOR"/>
19+
<description value="When Admin tries to create a customer in second website with the global account sharing is enabled, then Admin should be able to do so."/>
20+
<group value="customer"/>
21+
</annotations>
22+
<before>
23+
<createData entity="CustomerAccountSharingGlobal" stepKey="setConfigCustomerAccountToGlobal"/>
24+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginToAdminPanel"/>
25+
</before>
26+
<after>
27+
<!--Delete custom website-->
28+
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite">
29+
<argument name="websiteName" value="{{secondCustomWebsite.name}}"/>
30+
</actionGroup>
31+
<actionGroup ref="DeleteCustomerByEmailActionGroup" stepKey="deleteCustomer">
32+
<argument name="email" value="{{CustomerEntityOne.email}}"/>
33+
</actionGroup>
34+
<actionGroup ref="ResetAdminDataGridToDefaultViewActionGroup" stepKey="resetGrid"/>
35+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
36+
<createData entity="CustomerAccountSharingDefault" stepKey="setConfigCustomerAccountDefault"/>
37+
</after>
38+
<!-- Create second website -->
39+
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createSecondWebsite">
40+
<argument name="newWebsiteName" value="{{secondCustomWebsite.name}}"/>
41+
<argument name="websiteCode" value="{{secondCustomWebsite.code}}"/>
42+
</actionGroup>
43+
<!-- Create second store -->
44+
<actionGroup ref="AdminCreateNewStoreGroupActionGroup" stepKey="createSecondStoreGroup">
45+
<argument name="website" value="{{secondCustomWebsite.name}}"/>
46+
<argument name="storeGroupName" value="{{SecondStoreGroupUnique.name}}"/>
47+
<argument name="storeGroupCode" value="{{SecondStoreGroupUnique.code}}"/>
48+
</actionGroup>
49+
<!-- Create second store view -->
50+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createSecondStoreView">
51+
<argument name="StoreGroup" value="SecondStoreGroupUnique"/>
52+
<argument name="customStore" value="SecondStoreUnique"/>
53+
</actionGroup>
54+
<!--Open New Customer Page -->
55+
<actionGroup ref="AdminNavigateNewCustomerActionGroup" stepKey="waitToCustomerPageLoad"/>
56+
<!--Change customer website to "Second Website"-->
57+
<actionGroup ref="AdminUpdateCustomerWebsiteInCustomerInformationPageActionGroup" stepKey="updateCustomerWebsite">
58+
<argument name="websiteName" value="{{secondCustomWebsite.name}}"/>
59+
</actionGroup>
60+
<!--Verify that "Second Website" is selected in website selector-->
61+
<seeOptionIsSelected selector="{{AdminCustomerAccountInformationSection.associateToWebsite}}" userInput="{{secondCustomWebsite.name}}" stepKey="assertThatSecondWebsiteIsSelected"/>
62+
<fillField userInput="{{CustomerEntityOne.firstname}}" selector="{{AdminCustomerAccountInformationSection.firstName}}" stepKey="fillFirstName"/>
63+
<fillField userInput="{{CustomerEntityOne.lastname}}" selector="{{AdminCustomerAccountInformationSection.lastName}}" stepKey="fillLastName"/>
64+
<fillField userInput="{{CustomerEntityOne.email}}" selector="{{AdminCustomerAccountInformationSection.email}}" stepKey="fillEmail"/>
65+
<click selector="{{AdminCustomerMainActionsSection.saveButton}}" stepKey="saveCustomer"/>
66+
<seeElement selector="{{AdminCustomerMessagesSection.successMessage}}" stepKey="assertSuccessMessage"/>
67+
</test>
68+
</tests>

0 commit comments

Comments
 (0)