Skip to content

Commit a409ef7

Browse files
committed
Merge remote-tracking branch 'origin/2.2-develop' into 2.2-develop-mftf-pr17
2 parents 804624c + b1bf05a commit a409ef7

File tree

38 files changed

+1000
-177
lines changed

38 files changed

+1000
-177
lines changed

app/code/Magento/CatalogRule/Pricing/Price/CatalogRulePrice.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function getValue()
9393
} else {
9494
$this->value = $this->getRuleResource()
9595
->getRulePrice(
96-
$this->dateTime->scopeDate($this->storeManager->getStore()->getId()),
96+
$this->dateTime->date(null, null, false),
9797
$this->storeManager->getStore()->getWebsiteId(),
9898
$this->customerSession->getCustomerGroupId(),
9999
$this->product->getId()

app/code/Magento/CatalogRule/Test/Unit/Pricing/Price/CatalogRulePriceTest.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ protected function setUp()
155155
*/
156156
public function testGetValue()
157157
{
158-
$coreStoreId = 1;
159158
$coreWebsiteId = 1;
160159
$productId = 1;
161160
$customerGroupId = 1;
@@ -164,15 +163,12 @@ public function testGetValue()
164163
$catalogRulePrice = 55.12;
165164
$convertedPrice = 45.34;
166165

167-
$this->coreStoreMock->expects($this->once())
168-
->method('getId')
169-
->will($this->returnValue($coreStoreId));
170166
$this->coreStoreMock->expects($this->once())
171167
->method('getWebsiteId')
172168
->will($this->returnValue($coreWebsiteId));
173169
$this->dataTimeMock->expects($this->once())
174-
->method('scopeDate')
175-
->with($this->equalTo($coreStoreId))
170+
->method('date')
171+
->with(null, null, false)
176172
->will($this->returnValue($dateTime));
177173
$this->customerSessionMock->expects($this->once())
178174
->method('getCustomerGroupId')

app/code/Magento/Checkout/view/frontend/web/template/billing-address/details.html

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,19 @@
1313
<a if="currentBillingAddress().telephone" attr="'href': 'tel:' + currentBillingAddress().telephone" text="currentBillingAddress().telephone"></a><br/>
1414

1515
<each args="data: currentBillingAddress().customAttributes, as: 'element'">
16-
<each args="data: Object.keys(element), as: 'attribute'">
17-
<if args="typeof element[attribute] === 'object'">
18-
<if args="element[attribute].label">
19-
<text args="element[attribute].label"/>
20-
</if>
21-
<ifnot args="element[attribute].label">
22-
<if args="element[attribute].value">
23-
<text args="element[attribute].value"/>
24-
</if>
25-
</ifnot>
16+
<if args="typeof element === 'object'">
17+
<if args="element.label">
18+
<text args="element.label"/>
2619
</if>
27-
<if args="typeof element[attribute] === 'string'">
28-
<text args="element[attribute]"/>
29-
</if><br/>
30-
</each>
20+
<ifnot args="element.label">
21+
<if args="element.value">
22+
<text args="element.value"/>
23+
</if>
24+
</ifnot>
25+
</if>
26+
<if args="typeof element === 'string'">
27+
<text args="element"/>
28+
</if><br/>
3129
</each>
3230

3331
<button visible="!isAddressSameAsShipping()"

app/code/Magento/Checkout/view/frontend/web/template/shipping-information/address-renderer/default.html

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,18 @@
1313
<a if="address().telephone" attr="'href': 'tel:' + address().telephone" text="address().telephone"></a><br/>
1414

1515
<each args="data: address().customAttributes, as: 'element'">
16-
<each args="data: Object.keys(element), as: 'attribute'">
17-
<if args="typeof element[attribute] === 'object'">
18-
<if args="element[attribute].label">
19-
<text args="element[attribute].label"/>
20-
</if>
21-
<ifnot args="element[attribute].label">
22-
<if args="element[attribute].value">
23-
<text args="element[attribute].value"/>
24-
</if>
25-
</ifnot>
16+
<if args="typeof element === 'object'">
17+
<if args="element.label">
18+
<text args="element.label"/>
2619
</if>
27-
<if args="typeof element[attribute] === 'string'">
28-
<text args="element[attribute]"/>
29-
</if><br/>
30-
</each>
20+
<ifnot args="element.label">
21+
<if args="element.value">
22+
<text args="element.value"/>
23+
</if>
24+
</ifnot>
25+
</if>
26+
<if args="typeof element === 'string'">
27+
<text args="element"/>
28+
</if><br/>
3129
</each>
3230
</if>

app/code/Magento/Customer/Model/Delegation/Storage.php

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
<?php
22
/**
3-
*
43
* Copyright © Magento, Inc. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
7-
86
declare(strict_types=1);
97

108
namespace Magento\Customer\Model\Delegation;
@@ -21,6 +19,7 @@
2119
use Magento\Customer\Model\Delegation\Data\NewOperationFactory;
2220
use Magento\Customer\Api\Data\CustomerInterfaceFactory;
2321
use Magento\Customer\Api\Data\AddressInterfaceFactory;
22+
use Magento\Framework\Api\CustomAttributesDataInterface;
2423
use Psr\Log\LoggerInterface;
2524

2625
/**
@@ -104,11 +103,13 @@ public function storeNewOperation(
104103
}
105104
}
106105
$this->session->setCustomerFormData($customerData);
107-
$this->session->setDelegatedNewCustomerData([
108-
'customer' => $customerData,
109-
'addresses' => $addressesData,
110-
'delegated_data' => $delegatedData
111-
]);
106+
$this->session->setDelegatedNewCustomerData(
107+
[
108+
'customer' => $customerData,
109+
'addresses' => $addressesData,
110+
'delegated_data' => $delegatedData,
111+
]
112+
);
112113
}
113114

114115
/**
@@ -138,18 +139,31 @@ public function consumeNewOperation()
138139
);
139140
$addressData['region'] = $region;
140141
}
141-
$addresses[] = $this->addressFactory->create(
142+
143+
$customAttributes = [];
144+
if (!empty($addressData[CustomAttributesDataInterface::CUSTOM_ATTRIBUTES])) {
145+
$customAttributes = $addressData[CustomAttributesDataInterface::CUSTOM_ATTRIBUTES];
146+
unset($addressData[CustomAttributesDataInterface::CUSTOM_ATTRIBUTES]);
147+
}
148+
149+
$address = $this->addressFactory->create(
142150
['data' => $addressData]
143151
);
152+
153+
foreach ($customAttributes as $attributeCode => $attributeValue) {
154+
$address->setCustomAttribute($attributeCode, $attributeValue);
155+
}
156+
157+
$addresses[] = $address;
144158
}
145159
$customerData = $serialized['customer'];
146160
$customerData['addresses'] = $addresses;
147161

148-
return $this->newFactory->create([
149-
'customer' => $this->customerFactory->create(
150-
['data' => $customerData]
151-
),
152-
'additionalData' => $serialized['delegated_data']
153-
]);
162+
return $this->newFactory->create(
163+
[
164+
'customer' => $this->customerFactory->create(['data' => $customerData]),
165+
'additionalData' => $serialized['delegated_data'],
166+
]
167+
);
154168
}
155169
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="SearchByEmailInCustomerGridTest">
11+
<annotations>
12+
<features value="Customer"/>
13+
<stories value="Customer grid search"/>
14+
<title value="Admin customer grid email searching"/>
15+
<description value="Admin customer grid searching by email in keyword"/>
16+
<severity value="MAJOR"/>
17+
<testCaseId value="MC-18137"/>
18+
<useCaseId value="MC-17940"/>
19+
<group value="customer"/>
20+
</annotations>
21+
<before>
22+
<createData entity="Simple_US_Customer" stepKey="createFirstCustomer"/>
23+
<createData entity="Simple_US_Customer" stepKey="createSecondCustomer"/>
24+
<actionGroup ref="LoginAsAdmin" stepKey="login"/>
25+
</before>
26+
<after>
27+
<deleteData createDataKey="createFirstCustomer" stepKey="deleteFirstCustomer"/>
28+
<deleteData createDataKey="createSecondCustomer" stepKey="deleteSecondCustomer"/>
29+
<amOnPage url="{{AdminCustomerPage.url}}" stepKey="openCustomersGridPage"/>
30+
<actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearCustomerGridFilter"/>
31+
<actionGroup ref="logout" stepKey="logout"/>
32+
</after>
33+
<!--Step 1: Go to Customers > All Customers-->
34+
<amOnPage url="{{AdminCustomerPage.url}}" stepKey="openCustomersGridPage"/>
35+
<!--Step 2: On Customers grid page search customer by keyword-->
36+
<actionGroup ref="searchAdminDataGridByKeyword" stepKey="searchCustomer">
37+
<argument name="keyword" value="$$createSecondCustomer.email$$"/>
38+
</actionGroup>
39+
<!--Step 3: Check if customer is placed in a first row and clear grid filter-->
40+
<actionGroup ref="AdminAssertCustomerInCustomersGrid" stepKey="checkCustomerInGrid">
41+
<argument name="text" value="$$createSecondCustomer.email$$"/>
42+
<argument name="row" value="1"/>
43+
</actionGroup>
44+
</test>
45+
</tests>

app/code/Magento/Payment/view/frontend/templates/transparent/iframe.phtml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@ $params = $block->getParams();
1515
<?php if (isset($params['redirect'])): ?>
1616
window.location="<?= $block->escapeUrl($params['redirect']) ?>";
1717
<?php elseif (isset($params['redirect_parent'])): ?>
18-
var require = window.top.require;
18+
var require = window.parent.require;
1919
require(
2020
[
2121
'jquery'
2222
],
2323
function($) {
24-
var parent = window.top;
24+
var parent = window.parent;
2525
$(parent).trigger('clearTimeout');
2626
parent.location="<?= $block->escapeUrl($params['redirect_parent']) ?>";
2727
}
2828
);
2929
<?php elseif (isset($params['error_msg'])): ?>
30-
var require = window.top.require;
30+
var require = window.parent.require;
3131
require(
3232
[
3333
'jquery',
@@ -36,7 +36,7 @@ $params = $block->getParams();
3636
'Magento_Checkout/js/model/full-screen-loader'
3737
],
3838
function($, globalMessageList, $t, fullScreenLoader) {
39-
var parent = window.top;
39+
var parent = window.parent;
4040
$(parent).trigger('clearTimeout');
4141
fullScreenLoader.stopLoader();
4242
globalMessageList.addErrorMessage({
@@ -45,21 +45,21 @@ $params = $block->getParams();
4545
}
4646
);
4747
<?php elseif (isset($params['multishipping'])): ?>
48-
var require = window.top.require;
48+
var require = window.parent.require;
4949
require(
5050
[
5151
'jquery'
5252
],
5353
function($) {
54-
var parent = window.top;
54+
var parent = window.parent;
5555
$(parent).trigger('clearTimeout');
5656
$(parent.document).find('#multishipping-billing-form').submit();
5757
}
5858
);
5959
<?php elseif (isset($params['order_success'])): ?>
60-
window.top.location = "<?= $block->escapeUrl($params['order_success']) ?>";
60+
window.parent.location = "<?= $block->escapeUrl($params['order_success']) ?>";
6161
<?php else: ?>
62-
var require = window.top.require;
62+
var require = window.parent.require;
6363
require(
6464
[
6565
'jquery',
@@ -69,7 +69,7 @@ $params = $block->getParams();
6969
'Magento_Checkout/js/model/full-screen-loader'
7070
],
7171
function($, quote, placeOrderAction, redirectOnSuccessAction, fullScreenLoader) {
72-
var parent = window.top;
72+
var parent = window.parent;
7373

7474
$(parent).trigger('clearTimeout');
7575
$.when(
@@ -80,7 +80,7 @@ $params = $block->getParams();
8080
}
8181
).fail(
8282
function () {
83-
var parent = window.top;
83+
var parent = window.parent;
8484
$(parent).trigger('clearTimeout');
8585
fullScreenLoader.stopLoader();
8686
}

app/code/Magento/Persistent/Observer/CheckExpirePersistentQuoteObserver.php

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
namespace Magento\Persistent\Observer;
1010

1111
use Magento\Framework\Event\ObserverInterface;
12+
use Magento\Quote\Model\Quote;
1213

1314
/**
1415
* Observer of expired session
@@ -71,6 +72,11 @@ class CheckExpirePersistentQuoteObserver implements ObserverInterface
7172
*/
7273
private $checkoutPagePath = 'checkout';
7374

75+
/**
76+
* @var Quote
77+
*/
78+
private $quote;
79+
7480
/**
7581
* @param \Magento\Persistent\Helper\Session $persistentSession
7682
* @param \Magento\Persistent\Helper\Data $persistentData
@@ -110,23 +116,65 @@ public function execute(\Magento\Framework\Event\Observer $observer)
110116
return;
111117
}
112118

119+
//clear persistent when persistent data is disabled
120+
if ($this->isPersistentQuoteOutdated()) {
121+
$this->_eventManager->dispatch('persistent_session_expired');
122+
$this->quoteManager->expire();
123+
$this->_checkoutSession->clearQuote();
124+
return;
125+
}
126+
113127
if ($this->_persistentData->isEnabled() &&
114128
!$this->_persistentSession->isPersistent() &&
115129
!$this->_customerSession->isLoggedIn() &&
116130
$this->_checkoutSession->getQuoteId() &&
117131
!$this->isRequestFromCheckoutPage($this->request) &&
118132
// persistent session does not expire on onepage checkout page
119-
(
120-
$this->_checkoutSession->getQuote()->getIsPersistent() ||
121-
$this->_checkoutSession->getQuote()->getCustomerIsGuest()
122-
)
133+
$this->isNeedToExpireSession()
123134
) {
124135
$this->_eventManager->dispatch('persistent_session_expired');
125136
$this->quoteManager->expire();
126137
$this->_customerSession->setCustomerId(null)->setCustomerGroupId(null);
127138
}
128139
}
129140

141+
/**
142+
* Checks if current quote marked as persistent and Persistence Functionality is disabled.
143+
*
144+
* @return bool
145+
*/
146+
private function isPersistentQuoteOutdated(): bool
147+
{
148+
if (!$this->_persistentData->isEnabled() && !$this->_customerSession->isLoggedIn()
149+
&& $this->_checkoutSession->getQuoteId()) {
150+
return (bool)$this->getQuote()->getIsPersistent();
151+
}
152+
return false;
153+
}
154+
155+
/**
156+
* Condition checker
157+
*
158+
* @return bool
159+
*/
160+
private function isNeedToExpireSession(): bool
161+
{
162+
return $this->getQuote()->getIsPersistent() || $this->getQuote()->getCustomerIsGuest();
163+
}
164+
165+
/**
166+
* Getter for Quote with micro optimization
167+
*
168+
* @return Quote
169+
*/
170+
private function getQuote(): Quote
171+
{
172+
if ($this->quote === null) {
173+
$this->quote = $this->_checkoutSession->getQuote();
174+
}
175+
return $this->quote;
176+
}
177+
130178
/**
131179
* Check current request is coming from onepage checkout page.
132180
*

0 commit comments

Comments
 (0)