Skip to content

Commit a98319f

Browse files
[EngCom] Public Pull Requests - 2.2-develop
- merged latest code from mainline branch
2 parents 2194a10 + f7ebf9d commit a98319f

File tree

67 files changed

+758
-30814
lines changed

Some content is hidden

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

67 files changed

+758
-30814
lines changed

app/code/Magento/Bundle/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
},
2323
"suggest": {
2424
"magento/module-webapi": "100.2.*",
25-
"magento/module-bundle-sample-data": "Sample Data version:100.2.*"
25+
"magento/module-bundle-sample-data": "Sample Data version:100.2.*",
26+
"magento/module-sales-rule": "101.0.*"
2627
},
2728
"type": "magento2-module",
2829
"version": "100.2.2",

app/code/Magento/Bundle/etc/di.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,4 +207,11 @@
207207
</argument>
208208
</arguments>
209209
</type>
210+
<type name="Magento\SalesRule\Model\Quote\ChildrenValidationLocator">
211+
<arguments>
212+
<argument name="productTypeChildrenValidationMap" xsi:type="array">
213+
<item name="bundle" xsi:type="boolean">false</item>
214+
</argument>
215+
</arguments>
216+
</type>
210217
</config>

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -264,23 +264,36 @@ protected function customizeNewDateRangeField(array $meta)
264264
if ($fromFieldPath && $toFieldPath) {
265265
$fromContainerPath = $this->arrayManager->slicePath($fromFieldPath, 0, -2);
266266
$toContainerPath = $this->arrayManager->slicePath($toFieldPath, 0, -2);
267+
$commonFieldsMeta = [
268+
'outputDateTimeToISO' => false,
269+
'inputDateTimeFormat' => 'YYYY-MM-DD h:mm',
270+
'options' => [
271+
'showsTime' => true,
272+
]
273+
];
267274

268275
$meta = $this->arrayManager->merge(
269276
$fromFieldPath . self::META_CONFIG_PATH,
270277
$meta,
271-
[
272-
'label' => __('Set Product as New From'),
273-
'additionalClasses' => 'admin__field-date',
274-
]
278+
array_merge(
279+
[
280+
'label' => __('Set Product as New From'),
281+
'additionalClasses' => 'admin__field-date',
282+
],
283+
$commonFieldsMeta
284+
)
275285
);
276286
$meta = $this->arrayManager->merge(
277287
$toFieldPath . self::META_CONFIG_PATH,
278288
$meta,
279-
[
280-
'label' => __('To'),
281-
'scopeLabel' => null,
282-
'additionalClasses' => 'admin__field-date',
283-
]
289+
array_merge(
290+
[
291+
'label' => __('To'),
292+
'scopeLabel' => null,
293+
'additionalClasses' => 'admin__field-date',
294+
],
295+
$commonFieldsMeta
296+
)
284297
);
285298
$meta = $this->arrayManager->merge(
286299
$fromContainerPath . self::META_CONFIG_PATH,

app/code/Magento/Payment/Model/Method/Logger.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66
namespace Magento\Payment\Model\Method;
77

8-
use Magento\Payment\Gateway\ConfigInterface;
98
use Psr\Log\LoggerInterface;
109

1110
/**
@@ -24,17 +23,17 @@ class Logger
2423
protected $logger;
2524

2625
/**
27-
* @var ConfigInterface
26+
* @var \Magento\Payment\Gateway\ConfigInterface
2827
*/
2928
private $config;
3029

3130
/**
3231
* @param LoggerInterface $logger
33-
* @param ConfigInterface $config
32+
* @param \Magento\Payment\Gateway\ConfigInterface $config
3433
*/
3534
public function __construct(
3635
LoggerInterface $logger,
37-
ConfigInterface $config = null
36+
\Magento\Payment\Gateway\ConfigInterface $config = null
3837
) {
3938
$this->logger = $logger;
4039
$this->config = $config;
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\SalesRule\Model\Quote;
7+
8+
use \Magento\Quote\Model\Quote\Item\AbstractItem as QuoteItem;
9+
10+
/**
11+
* Class ChildrenValidationLocator
12+
*
13+
* Used to determine necessity to validate rule on item's children that may depends on product type
14+
*/
15+
class ChildrenValidationLocator
16+
{
17+
/**
18+
* @var array
19+
*/
20+
private $productTypeChildrenValidationMap;
21+
22+
/**
23+
* @param array $productTypeChildrenValidationMap
24+
* <pre>
25+
* [
26+
* 'ProductType1' => true,
27+
* 'ProductType2' => false
28+
* ]
29+
* </pre>
30+
*/
31+
public function __construct(
32+
array $productTypeChildrenValidationMap = []
33+
) {
34+
$this->productTypeChildrenValidationMap = $productTypeChildrenValidationMap;
35+
}
36+
37+
/**
38+
* Checks necessity to validate rule on item's children
39+
*
40+
* @param QuoteItem $item
41+
* @return bool
42+
*/
43+
public function isChildrenValidationRequired(QuoteItem $item): bool
44+
{
45+
$type = $item->getProduct()->getTypeId();
46+
if (isset($this->productTypeChildrenValidationMap[$type])) {
47+
return (bool)$this->productTypeChildrenValidationMap[$type];
48+
}
49+
return true;
50+
}
51+
}

app/code/Magento/SalesRule/Model/RulesApplier.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
namespace Magento\SalesRule\Model;
77

88
use Magento\Quote\Model\Quote\Address;
9+
use Magento\SalesRule\Model\Quote\ChildrenValidationLocator;
10+
use Magento\Framework\App\ObjectManager;
911

1012
/**
1113
* Class RulesApplier
@@ -25,19 +27,33 @@ class RulesApplier
2527
*/
2628
protected $validatorUtility;
2729

30+
/**
31+
* @var ChildrenValidationLocator
32+
*/
33+
private $childrenValidationLocator;
34+
35+
/**
36+
* @var \Magento\SalesRule\Model\Rule\Action\Discount\CalculatorFactory
37+
*/
38+
private $calculatorFactory;
39+
2840
/**
2941
* @param \Magento\SalesRule\Model\Rule\Action\Discount\CalculatorFactory $calculatorFactory
3042
* @param \Magento\Framework\Event\ManagerInterface $eventManager
3143
* @param \Magento\SalesRule\Model\Utility $utility
44+
* @param ChildrenValidationLocator $childrenValidationLocator
3245
*/
3346
public function __construct(
3447
\Magento\SalesRule\Model\Rule\Action\Discount\CalculatorFactory $calculatorFactory,
3548
\Magento\Framework\Event\ManagerInterface $eventManager,
36-
\Magento\SalesRule\Model\Utility $utility
49+
\Magento\SalesRule\Model\Utility $utility,
50+
ChildrenValidationLocator $childrenValidationLocator = null
3751
) {
3852
$this->calculatorFactory = $calculatorFactory;
3953
$this->validatorUtility = $utility;
4054
$this->_eventManager = $eventManager;
55+
$this->childrenValidationLocator = $childrenValidationLocator
56+
?: ObjectManager::getInstance()->get(ChildrenValidationLocator::class);
4157
}
4258

4359
/**
@@ -61,6 +77,9 @@ public function applyRules($item, $rules, $skipValidation, $couponCode)
6177
}
6278

6379
if (!$skipValidation && !$rule->getActions()->validate($item)) {
80+
if (!$this->childrenValidationLocator->isChildrenValidationRequired($item)) {
81+
continue;
82+
}
6483
$childItems = $item->getChildren();
6584
$isContinue = true;
6685
if (!empty($childItems)) {

app/code/Magento/SalesRule/Test/Unit/Model/RulesApplierTest.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
namespace Magento\SalesRule\Test\Unit\Model;
88

9+
/**
10+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
11+
*/
912
class RulesApplierTest extends \PHPUnit\Framework\TestCase
1013
{
1114
/**
@@ -28,6 +31,11 @@ class RulesApplierTest extends \PHPUnit\Framework\TestCase
2831
*/
2932
protected $validatorUtility;
3033

34+
/**
35+
* @var \Magento\SalesRule\Model\Quote\ChildrenValidationLocator|\PHPUnit_Framework_MockObject_MockObject
36+
*/
37+
protected $childrenValidationLocator;
38+
3139
protected function setUp()
3240
{
3341
$this->calculatorFactory = $this->createMock(
@@ -38,11 +46,15 @@ protected function setUp()
3846
\Magento\SalesRule\Model\Utility::class,
3947
['canProcessRule', 'minFix', 'deltaRoundingFix', 'getItemQty']
4048
);
41-
49+
$this->childrenValidationLocator = $this->createPartialMock(
50+
\Magento\SalesRule\Model\Quote\ChildrenValidationLocator::class,
51+
['isChildrenValidationRequired']
52+
);
4253
$this->rulesApplier = new \Magento\SalesRule\Model\RulesApplier(
4354
$this->calculatorFactory,
4455
$this->eventManager,
45-
$this->validatorUtility
56+
$this->validatorUtility,
57+
$this->childrenValidationLocator
4658
);
4759
}
4860

@@ -84,6 +96,10 @@ public function testApplyRulesWhenRuleWithStopRulesProcessingIsUsed($isChildren,
8496
$item->setDiscountCalculationPrice($positivePrice);
8597
$item->setData('calculation_price', $positivePrice);
8698

99+
$this->childrenValidationLocator->expects($this->any())
100+
->method('isChildrenValidationRequired')
101+
->will($this->returnValue(true));
102+
87103
$this->validatorUtility->expects($this->atLeastOnce())
88104
->method('canProcessRule')
89105
->will($this->returnValue(true));

app/code/Magento/Swagger/view/frontend/layout/swagger_index_index.xml

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,39 +10,26 @@
1010
<title>Swagger UI</title>
1111

1212
<!--<title>Swagger UI assets</title>-->
13-
<css src='Magento_Swagger::swagger-ui/css/typography.css' media='screen' rel='stylesheet' type='text/css'/>
14-
<css src='Magento_Swagger::swagger-ui/css/reset.css' media='screen' rel='stylesheet' type='text/css'/>
15-
<css src='Magento_Swagger::swagger-ui/css/screen.css' media='screen' rel='stylesheet' type='text/css'/>
16-
<css src='Magento_Swagger::swagger-ui/css/reset.css' media='print' rel='stylesheet' type='text/css'/>
17-
<css src='Magento_Swagger::swagger-ui/css/print.css' media='print' rel='stylesheet' type='text/css'/>
18-
<link src='Magento_Swagger::swagger-ui/js/lib/jquery-1.8.0.min.js' type='text/javascript'/>
19-
<link src='Magento_Swagger::swagger-ui/js/lib/jquery.slideto.min.js' type='text/javascript'/>
20-
<link src='Magento_Swagger::swagger-ui/js/lib/jquery.wiggle.min.js' type='text/javascript'/>
21-
<link src='Magento_Swagger::swagger-ui/js/lib/jquery.ba-bbq.min.js' type='text/javascript'/>
22-
<link src='Magento_Swagger::swagger-ui/js/lib/handlebars.min-v4.0.10.js' type='text/javascript'/>
23-
<link src='Magento_Swagger::swagger-ui/js/lib/underscore-min.js' type='text/javascript'/>
24-
<link src='Magento_Swagger::swagger-ui/js/lib/backbone-min.js' type='text/javascript'/>
25-
<link src='Magento_Swagger::swagger-ui/js/lib/jsoneditor.min.js' type='text/javascript'/>
26-
<link src='Magento_Swagger::swagger-ui/js/swagger-ui.js' type='text/javascript'/>
27-
<link src='Magento_Swagger::swagger-ui/js/lib/highlight.9.1.0.pack.js' type='text/javascript'/>
28-
<link src='Magento_Swagger::swagger-ui/js/lib/highlight.9.1.0.pack_extended.js' type='text/javascript'/>
29-
<link src='Magento_Swagger::swagger-ui/js/lib/lodash.min.js' type='text/javascript'/>
30-
<link src='Magento_Swagger::swagger-ui/js/lib/object-assign-pollyfill.js' type='text/javascript'/>
31-
<link src='Magento_Swagger::swagger-ui/js/lib/marked.js' type='text/javascript'/>
32-
<link src='Magento_Swagger::swagger-ui/js/lib/swagger-oauth.js' type='text/javascript'/>
33-
<link src='Magento_Swagger::swagger-ui/js/lang/translator.js' type='text/javascript'/>
34-
<link src='Magento_Swagger::swagger-ui/js/lang/ru.js' type='text/javascript'/>
35-
<link src='Magento_Swagger::swagger-ui/js/lang/en.js' type='text/javascript'/>
36-
<link src='Magento_Swagger::swagger-ui/js/magento-swagger.js' type='text/javascript'/>
13+
<css src='Magento_Swagger::swagger-ui/css/style.css' media='screen' rel='stylesheet' type='text/css'/>
14+
<css src='Magento_Swagger::swagger-ui/css/swagger-ui.css' media='screen' rel='stylesheet' type='text/css'/>
15+
<link src='Magento_Swagger::swagger-ui/js/lang/translator.js' type='text/javascript' defer="defer"/>
16+
<link src='Magento_Swagger::swagger-ui/js/lang/ru.js' type='text/javascript' defer="defer"/>
17+
<link src='Magento_Swagger::swagger-ui/js/lang/en.js' type='text/javascript' defer="defer"/>
18+
<link src='Magento_Swagger::swagger-ui/js/swagger-ui-bundle.js' type='text/javascript' defer="defer"/>
19+
<link src='Magento_Swagger::swagger-ui/js/swagger-ui-standalone-preset.js' type='text/javascript' defer="defer"/>
20+
<link src='Magento_Swagger::swagger-ui/js/magento-swagger.js' type='text/javascript' defer="defer"/>
3721

3822
<!--Remove require-js assets-->
23+
<remove src="css/styles-m.css"/>
24+
<remove src="css/styles-s.css"/>
3925
<remove src="requirejs/require.js"/>
4026
<remove src="mage/requirejs/mixins.js"/>
4127
<remove src="requirejs-config.js"/>
4228
</head>
4329
<body>
4430
<!--Remove Magento page content-->
4531
<referenceContainer name="page.wrapper" remove="true"/>
32+
<referenceBlock name="translate" remove="true"/>
4633
<referenceBlock name="requirejs-config" remove="true"/>
4734
<referenceContainer name="root">
4835
<block name="swaggerUiContent" class="Magento\Swagger\Block\Index" template="Magento_Swagger::swagger-ui/index.phtml"/>

app/code/Magento/Swagger/view/frontend/templates/swagger-ui/index.phtml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,48 @@
1212
* Modified by Magento, Modifications Copyright © Magento, Inc. All rights reserved.
1313
*/
1414

15-
/** @var \Magento\Swagger\Block\Index $block */
15+
/** @var \Magento\Swagger\Block\Index $block
16+
*
17+
* @codingStandardsIgnoreFile
18+
*/
1619

1720
$schemaUrl = $block->getSchemaUrl();
1821
?>
1922

23+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="position:absolute;width:0;height:0">
24+
<defs>
25+
<symbol viewBox="0 0 20 20" id="unlocked">
26+
<path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V6h2v-.801C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8z"></path>
27+
</symbol>
28+
29+
<symbol viewBox="0 0 20 20" id="locked">
30+
<path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8zM12 8H8V5.199C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8z"/>
31+
</symbol>
32+
33+
<symbol viewBox="0 0 20 20" id="close">
34+
<path d="M14.348 14.849c-.469.469-1.229.469-1.697 0L10 11.819l-2.651 3.029c-.469.469-1.229.469-1.697 0-.469-.469-.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-.469-.469-.469-1.228 0-1.697.469-.469 1.228-.469 1.697 0L10 8.183l2.651-3.031c.469-.469 1.228-.469 1.697 0 .469.469.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c.469.469.469 1.229 0 1.698z"/>
35+
</symbol>
36+
37+
<symbol viewBox="0 0 20 20" id="large-arrow">
38+
<path d="M13.25 10L6.109 2.58c-.268-.27-.268-.707 0-.979.268-.27.701-.27.969 0l7.83 7.908c.268.271.268.709 0 .979l-7.83 7.908c-.268.271-.701.27-.969 0-.268-.269-.268-.707 0-.979L13.25 10z"/>
39+
</symbol>
40+
41+
<symbol viewBox="0 0 20 20" id="large-arrow-down">
42+
<path d="M17.418 6.109c.272-.268.709-.268.979 0s.271.701 0 .969l-7.908 7.83c-.27.268-.707.268-.979 0l-7.908-7.83c-.27-.268-.27-.701 0-.969.271-.268.709-.268.979 0L10 13.25l7.418-7.141z"/>
43+
</symbol>
44+
45+
46+
<symbol viewBox="0 0 24 24" id="jump-to">
47+
<path d="M19 7v4H5.83l3.58-3.59L8 6l-6 6 6 6 1.41-1.41L5.83 13H21V7z"/>
48+
</symbol>
49+
50+
<symbol viewBox="0 0 24 24" id="expand">
51+
<path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/>
52+
</symbol>
53+
54+
</defs>
55+
</svg>
56+
2057
<div id='header'>
2158
<div class="swagger-ui-wrap">
2259
<a id="logo" href="http://swagger.io">swagger</a>

0 commit comments

Comments
 (0)