Skip to content

Commit 13674e2

Browse files
committed
Merge remote-tracking branch 'origin/2.3-develop' into MQE-2003-2.3
# Conflicts: # composer.lock
2 parents 46621a6 + d04dae2 commit 13674e2

File tree

223 files changed

+12864
-4216
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

223 files changed

+12864
-4216
lines changed

app/code/Magento/Backend/Block/Dashboard/Graph.php

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ public function getChartUrl($directUrl = true)
190190
$params = [
191191
'cht' => 'lc',
192192
'chls' => '7',
193-
'chf' => 'bg,s,f4f4f4|c,lg,90,ffffff,0.1,ededed,0',
194-
'chm' => 'B,f4d4b2,0,0,0',
193+
'chf' => 'bg,s,f4f4f4|c,lg,90,ffffff,0.1,ededed,0',
194+
'chm' => 'B,f4d4b2,0,0,0',
195195
'chco' => 'db4814',
196196
'chxs' => '0,0,11|1,0,11',
197197
'chma' => '15,15,15,15'
@@ -237,7 +237,7 @@ public function getChartUrl($directUrl = true)
237237
case '1y':
238238
case '2y':
239239
$d = $dateStart->format('Y-m');
240-
$dateStart->modify('+1 month');
240+
$dateStart->modify('first day of next month');
241241
break;
242242
default:
243243
$d = $dateStart->format('Y-m-d H:00');
@@ -300,20 +300,23 @@ public function getChartUrl($directUrl = true)
300300
$minvalue = min($localminvalue);
301301

302302
// default values
303-
$yLabels = [];
304303
$miny = 0;
305304
$maxy = 0;
306305
$yorigin = 0;
306+
$xAxis = 'x';
307+
$xAxisIndex = 0;
308+
$yAxisIndex = 1;
307309

308310
if ($minvalue >= 0 && $maxvalue >= 0) {
309311
if ($maxvalue > 10) {
310-
$p = pow(10, $this->_getPow((int) $maxvalue));
312+
$p = pow(10, $this->_getPow((int)$maxvalue));
311313
$maxy = ceil($maxvalue / $p) * $p;
312-
$yLabels = range($miny, $maxy, $p);
314+
$yRange = "$yAxisIndex,$miny,$maxy,$p";
313315
} else {
314316
$maxy = ceil($maxvalue + 1);
315-
$yLabels = range($miny, $maxy, 1);
317+
$yRange = "$yAxisIndex,$miny,$maxy,1";
316318
}
319+
$params['chxr'] = $yRange;
317320
$yorigin = 0;
318321
}
319322

@@ -341,22 +344,11 @@ public function getChartUrl($directUrl = true)
341344

342345
$params['chd'] .= $buffer;
343346

344-
$valueBuffer = [];
345-
346347
if (count($this->_axisLabels) > 0) {
347348
$params['chxt'] = implode(',', array_keys($this->_axisLabels));
348-
$indexid = 0;
349-
foreach ($this->_axisLabels as $idx => $labels) {
350-
if ($idx == 'x') {
351-
$this->formatAxisLabelDate((string) $idx, (string) $timezoneLocal);
352-
$tmpstring = implode('|', $this->_axisLabels[$idx]);
353-
$valueBuffer[] = $indexid . ":|" . $tmpstring;
354-
} elseif ($idx == 'y') {
355-
$valueBuffer[] = $indexid . ":|" . implode('|', $yLabels);
356-
}
357-
$indexid++;
358-
}
359-
$params['chxl'] = implode('|', $valueBuffer);
349+
$this->formatAxisLabelDate($xAxis, (string)$timezoneLocal);
350+
$customAxisLabels = $xAxisIndex . ":|" . implode('|', $this->_axisLabels[$xAxis]);
351+
$params['chxl'] = $customAxisLabels . $dataSetdelimiter;
360352
}
361353

362354
// chart size
@@ -368,7 +360,7 @@ public function getChartUrl($directUrl = true)
368360
foreach ($params as $name => $value) {
369361
$p[] = $name . '=' . urlencode($value);
370362
}
371-
return (string) self::API_URL . '?' . implode('&', $p);
363+
return (string)self::API_URL . '?' . implode('&', $p);
372364
}
373365
$gaData = urlencode(base64_encode(json_encode($params)));
374366
$gaHash = $this->_dashboardData->getChartDataHash($gaData);
@@ -392,7 +384,7 @@ private function formatAxisLabelDate($idx, $timezoneLocal)
392384
switch ($this->getDataHelper()->getParam('period')) {
393385
case '24h':
394386
$this->_axisLabels[$idx][$_index] = $this->_localeDate->formatDateTime(
395-
$period->setTime((int) $period->format('H'), 0, 0),
387+
$period->setTime((int)$period->format('H'), 0, 0),
396388
\IntlDateFormatter::NONE,
397389
\IntlDateFormatter::SHORT
398390
);
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminSetStoreInformationConfigurationActionGroup">
12+
<annotations>
13+
<description>Set Store Information configurations</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="storeName" type="string" defaultValue="{{AdminGeneralSetStoreNameConfigData.value}}"/>
17+
<argument name="storeHoursOfOperation" type="string" defaultValue="{{AdminGeneralSetStoreHoursConfigData.value}}"/>
18+
<argument name="vatNumber" type="string" defaultValue="{{AdminGeneralSetVatNumberConfigData.value}}"/>
19+
<argument name="telephone" type="string" defaultValue="{{US_Address_TX.telephone}}"/>
20+
<argument name="country" type="string" defaultValue="{{US_Address_TX.country_id}}"/>
21+
<argument name="state" type="string" defaultValue="{{US_Address_TX.state}}"/>
22+
<argument name="city" type="string" defaultValue="{{US_Address_TX.city}}"/>
23+
<argument name="postcode" type="string" defaultValue="{{US_Address_TX.postcode}}"/>
24+
<argument name="street" type="string" defaultValue="{{US_Address_TX.street[0]}}"/>
25+
</arguments>
26+
<magentoCLI command="config:set {{AdminGeneralSetStoreNameConfigData.path}} '{{storeName}}'" stepKey="setStoreInformationName"/>
27+
<magentoCLI command="config:set {{AdminGeneralSetStorePhoneConfigData.path}} '{{telephone}}'" stepKey="setStoreInformationPhone"/>
28+
<magentoCLI command="config:set {{AdminGeneralSetStoreHoursConfigData.path}} '{{storeHoursOfOperation}}'" stepKey="setStoreHoursInformation"/>
29+
<magentoCLI command="config:set {{AdminGeneralSetCountryConfigData.path}} '{{country}}'" stepKey="setStoreInformationCountry"/>
30+
<magentoCLI command="config:set {{AdminGeneralSetStateConfigData.path}} '{{state}}'" stepKey="setStoreInformationState"/>
31+
<magentoCLI command="config:set {{AdminGeneralSetCityConfigData.path}} '{{city}}'" stepKey="setStoreInformationCity"/>
32+
<magentoCLI command="config:set {{AdminGeneralSetPostcodeConfigData.path}} '{{postcode}}'" stepKey="setStoreInformationPostcode"/>
33+
<magentoCLI command="config:set {{AdminGeneralSetStreetAddressConfigData.path}} '{{street}}'" stepKey="setStoreInformationStreetAddress"/>
34+
<magentoCLI command="config:set {{AdminGeneralSetVatNumberConfigData.path}} '{{vatNumber}}'" stepKey="setStoreInformationVatNumber"/>
35+
</actionGroup>
36+
</actionGroups>

app/code/Magento/Backend/Test/Mftf/Data/AdminGeneralStoreInfomationConfigData.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,11 @@
3030
<entity name="AdminGeneralSetStreetAddress2ConfigData">
3131
<data key="path">general/store_information/street_line2</data>
3232
</entity>
33+
<entity name="AdminGeneralSetStateConfigData">
34+
<data key="path">general/store_information/region_id</data>
35+
</entity>
36+
<entity name="AdminGeneralSetStoreHoursConfigData">
37+
<data key="path">general/store_information/hours</data>
38+
<data key="value">8AM-8PM</data>
39+
</entity>
3340
</entities>

app/code/Magento/Braintree/view/frontend/web/js/view/payment/3d-secure.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ define([
117117
options.bin = context.paymentPayload.details.bin;
118118
}
119119

120-
if (shippingAddress) {
120+
if (shippingAddress && this.isValidShippingAddress(shippingAddress)) {
121121
options.additionalInformation = {
122122
shippingGivenName: shippingAddress.firstname,
123123
shippingSurname: shippingAddress.lastname,
@@ -206,6 +206,25 @@ define([
206206
}
207207

208208
return false;
209+
},
210+
211+
/**
212+
* Validate shipping address
213+
*
214+
* @param {Object} shippingAddress
215+
* @return {Boolean}
216+
*/
217+
isValidShippingAddress: function (shippingAddress) {
218+
var isValid = false;
219+
220+
// check that required fields are not empty
221+
if (shippingAddress.firstname && shippingAddress.lastname && shippingAddress.telephone &&
222+
shippingAddress.street && shippingAddress.city && shippingAddress.regionCode &&
223+
shippingAddress.postcode && shippingAddress.countryId) {
224+
isValid = true;
225+
}
226+
227+
return isValid;
209228
}
210229
};
211230
});

app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/cc-form.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ define(
9292
})
9393
.then(function (hostedFieldsInstance) {
9494
self.hostedFieldsInstance = hostedFieldsInstance;
95-
self.isPlaceOrderActionAllowed(true);
95+
self.isPlaceOrderActionAllowed(false);
9696
self.initFormValidationEvents(hostedFieldsInstance);
9797

9898
return self.hostedFieldsInstance;

app/code/Magento/Captcha/composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
"magento/module-checkout": "*",
1212
"magento/module-customer": "*",
1313
"magento/module-store": "*",
14-
"zendframework/zend-captcha": "^2.7.1",
15-
"zendframework/zend-db": "^2.8.2",
16-
"zendframework/zend-session": "^2.7.3"
14+
"laminas/laminas-captcha": "^2.7.1",
15+
"laminas/laminas-db": "^2.8.2",
16+
"laminas/laminas-session": "^2.7.3"
1717
},
1818
"type": "magento2-module",
1919
"license": [

app/code/Magento/Catalog/Model/Layout/DepersonalizePlugin.php

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,51 +5,55 @@
55
* Copyright © Magento, Inc. All rights reserved.
66
* See COPYING.txt for license details.
77
*/
8+
declare(strict_types=1);
9+
810
namespace Magento\Catalog\Model\Layout;
911

12+
use Magento\Catalog\Model\Session as CatalogSession;
13+
use Magento\Framework\View\LayoutInterface;
1014
use Magento\PageCache\Model\DepersonalizeChecker;
1115

1216
/**
13-
* Class DepersonalizePlugin
17+
* Depersonalize customer data.
18+
*
19+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
1420
*/
1521
class DepersonalizePlugin
1622
{
1723
/**
1824
* @var DepersonalizeChecker
1925
*/
20-
protected $depersonalizeChecker;
26+
private $depersonalizeChecker;
2127

2228
/**
2329
* Catalog session
2430
*
25-
* @var \Magento\Catalog\Model\Session
31+
* @var CatalogSession
2632
*/
27-
protected $catalogSession;
33+
private $catalogSession;
2834

2935
/**
3036
* @param DepersonalizeChecker $depersonalizeChecker
31-
* @param \Magento\Catalog\Model\Session $catalogSession
37+
* @param CatalogSession $catalogSession
3238
*/
3339
public function __construct(
3440
DepersonalizeChecker $depersonalizeChecker,
35-
\Magento\Catalog\Model\Session $catalogSession
41+
CatalogSession $catalogSession
3642
) {
37-
$this->catalogSession = $catalogSession;
3843
$this->depersonalizeChecker = $depersonalizeChecker;
44+
$this->catalogSession = $catalogSession;
3945
}
4046

4147
/**
42-
* After generate Xml
48+
* Change sensitive customer data if the depersonalization is needed.
4349
*
44-
* @param \Magento\Framework\View\LayoutInterface $subject
45-
* @param \Magento\Framework\View\LayoutInterface $result
46-
* @return \Magento\Framework\View\LayoutInterface
50+
* @param LayoutInterface $subject
51+
* @return void
4752
*/
48-
public function afterGenerateXml(\Magento\Framework\View\LayoutInterface $subject, $result)
53+
public function afterGenerateElements(LayoutInterface $subject)
4954
{
5055
if ($this->depersonalizeChecker->checkIfDepersonalize($subject)) {
5156
$this->catalogSession->clearStorage();
5257
}
53-
return $result;
5458
}
5559
}
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Catalog\Model\Product\Webapi;
9+
10+
use Magento\Catalog\Api\Data\ProductInterface;
11+
use Magento\Framework\Webapi\Request;
12+
use Magento\Framework\Webapi\Rest\Request\DeserializerInterface;
13+
14+
/**
15+
* Class for checking empty array and remove it from the output result
16+
*/
17+
class ProductOutputProcessor
18+
{
19+
/**
20+
* @var Request
21+
*/
22+
private $request;
23+
24+
/**
25+
* @var DeserializerInterface
26+
*/
27+
private $deserializer;
28+
29+
/**
30+
* @param Request $request
31+
* @param DeserializerInterface $deserializer
32+
*/
33+
public function __construct(
34+
Request $request,
35+
DeserializerInterface $deserializer
36+
) {
37+
$this->request = $request;
38+
$this->deserializer = $deserializer;
39+
}
40+
41+
/**
42+
* Removing attribute from the result array if its null or empty
43+
*
44+
* @param ProductInterface $product
45+
* @param array $result
46+
* @return array
47+
*/
48+
public function execute(
49+
ProductInterface $product,
50+
array $result
51+
): array {
52+
$requestContent = $this->request->getContent() ?? [];
53+
if (empty($requestContent)) {
54+
return $result;
55+
}
56+
$requestContentDetails = (array)$this->deserializer->deserialize($requestContent);
57+
$requestProductList = $this->extractProductList($requestContentDetails);
58+
59+
$requestProductList = array_filter(
60+
$requestProductList,
61+
function ($requestProduct) use ($product) {
62+
return isset($requestProduct['sku']) && $requestProduct['sku'] === $product->getSku();
63+
}
64+
);
65+
66+
if (empty($requestProductList)) {
67+
return $result;
68+
}
69+
70+
$requestProduct = current($requestProductList);
71+
72+
if (empty($product->getTierPrices()) && !array_key_exists('tier_prices', $requestProduct)) {
73+
unset($result['tier_prices']);
74+
}
75+
76+
if (empty($product->getProductLinks()) && !array_key_exists('product_links', $requestProduct)) {
77+
unset($result['product_links']);
78+
}
79+
80+
return $result;
81+
}
82+
83+
/**
84+
* Extract product list from the request content details
85+
*
86+
* @param array $contentDetails
87+
* @return array
88+
*/
89+
private function extractProductList(array $contentDetails): array
90+
{
91+
$productList = [];
92+
$arrayIterator = new \RecursiveArrayIterator($contentDetails);
93+
$iterator = new \RecursiveIteratorIterator($arrayIterator, \RecursiveIteratorIterator::SELF_FIRST);
94+
foreach ($iterator as $iteratorKey => $iteratorValue) {
95+
if ($iteratorKey === 'product') {
96+
array_push($productList, $iteratorValue);
97+
}
98+
}
99+
return $productList;
100+
}
101+
}

0 commit comments

Comments
 (0)