Skip to content

Commit 0240e81

Browse files
Merge branch 2.2-develop into ENGCOM-4540-magento-magento2-21845
2 parents 2982056 + f44720a commit 0240e81

File tree

35 files changed

+283
-99
lines changed

35 files changed

+283
-99
lines changed

app/code/Magento/Backend/etc/adminhtml/system.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,27 +153,27 @@
153153
</group>
154154
<group id="js" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
155155
<label>JavaScript Settings</label>
156-
<field id="merge_files" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
156+
<field id="merge_files" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
157157
<label>Merge JavaScript Files</label>
158158
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
159159
</field>
160-
<field id="enable_js_bundling" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
160+
<field id="enable_js_bundling" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
161161
<label>Enable JavaScript Bundling</label>
162162
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
163163
</field>
164-
<field id="minify_files" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
164+
<field id="minify_files" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
165165
<label>Minify JavaScript Files</label>
166166
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
167167
<comment>Minification is not applied in developer mode.</comment>
168168
</field>
169169
</group>
170170
<group id="css" translate="label" type="text" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="1">
171171
<label>CSS Settings</label>
172-
<field id="merge_css_files" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
172+
<field id="merge_css_files" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
173173
<label>Merge CSS Files</label>
174174
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
175175
</field>
176-
<field id="minify_files" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
176+
<field id="minify_files" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
177177
<label>Minify CSS Files</label>
178178
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
179179
<comment>Minification is not applied in developer mode.</comment>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
</type>
4545
<type name="Magento\CatalogInventory\Observer\UpdateItemsStockUponConfigChangeObserver">
4646
<arguments>
47-
<argument name="resourceStock" xsi:type="object">Magento\CatalogInventory\Model\ResourceModel\Stock\Proxy</argument>
47+
<argument name="resourceStockItem" xsi:type="object">Magento\CatalogInventory\Model\ResourceModel\Stock\Item\Proxy</argument>
4848
</arguments>
4949
</type>
5050
<type name="Magento\Catalog\Model\Layer">
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
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\CatalogWidget\Setup;
9+
10+
use Magento\CatalogWidget\Block\Product\ProductsList;
11+
use Magento\CatalogWidget\Model\Rule\Condition\Product as ConditionProduct;
12+
use Magento\Framework\Serialize\Serializer\Json as Serializer;
13+
use Magento\Framework\Setup\ModuleContextInterface;
14+
use Magento\Framework\Setup\ModuleDataSetupInterface;
15+
use Magento\Framework\Setup\UpgradeDataInterface;
16+
17+
/**
18+
* Upgrade data for CatalogWidget module.
19+
*/
20+
class UpgradeData implements UpgradeDataInterface
21+
{
22+
/**
23+
* @var Serializer
24+
*/
25+
private $serializer;
26+
27+
/**
28+
* @param Serializer $serializer
29+
*/
30+
public function __construct(
31+
Serializer $serializer
32+
) {
33+
$this->serializer = $serializer;
34+
}
35+
36+
/**
37+
* @inheritdoc
38+
*/
39+
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
40+
{
41+
if (version_compare($context->getVersion(), '2.0.1', '<')) {
42+
$this->replaceIsWithIsOneOf($setup);
43+
}
44+
}
45+
46+
/**
47+
* Replace 'is' condition with 'is one of' in database.
48+
*
49+
* If 'is' product list condition is used with multiple skus it should be replaced by 'is one of' condition.
50+
*
51+
* @param ModuleDataSetupInterface $setup
52+
*/
53+
private function replaceIsWithIsOneOf(ModuleDataSetupInterface $setup)
54+
{
55+
$tableName = $setup->getTable('widget_instance');
56+
$connection = $setup->getConnection();
57+
$select = $connection->select()
58+
->from(
59+
$tableName,
60+
[
61+
'instance_id',
62+
'widget_parameters',
63+
]
64+
)->where('instance_type = ? ', ProductsList::class);
65+
66+
$result = $setup->getConnection()->fetchAll($select);
67+
68+
if ($result) {
69+
$updatedData = $this->updateWidgetData($result);
70+
71+
$connection->insertOnDuplicate(
72+
$tableName,
73+
$updatedData
74+
);
75+
}
76+
}
77+
78+
/**
79+
* Replace 'is' condition with 'is one of' in widget parameters.
80+
*
81+
* @param array $result
82+
* @return array
83+
*/
84+
private function updateWidgetData(array $result): array
85+
{
86+
return array_map(
87+
function ($widgetData) {
88+
$widgetParameters = $this->serializer->unserialize($widgetData['widget_parameters']);
89+
foreach ($widgetParameters['conditions'] as &$condition) {
90+
if (ConditionProduct::class === $condition['type'] &&
91+
'sku' === $condition['attribute'] &&
92+
'==' === $condition['operator']) {
93+
$condition['operator'] = '()';
94+
}
95+
}
96+
$widgetData['widget_parameters'] = $this->serializer->serialize($widgetParameters);
97+
98+
return $widgetData;
99+
},
100+
$result
101+
);
102+
}
103+
}

app/code/Magento/CatalogWidget/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
9-
<module name="Magento_CatalogWidget" setup_version="2.0.0">
9+
<module name="Magento_CatalogWidget" setup_version="2.0.1">
1010
<sequence>
1111
<module name="Magento_Catalog"/>
1212
<module name="Magento_Widget"/>

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,4 @@
4949
</argument>
5050
</arguments>
5151
</type>
52-
<type name="Magento\Quote\Model\Quote">
53-
<plugin name="clear_addresses_after_product_delete" type="Magento\Checkout\Plugin\Model\Quote\ResetQuoteAddresses"/>
54-
</type>
5552
</config>

app/code/Magento/Checkout/etc/frontend/di.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,7 @@
9696
</argument>
9797
</arguments>
9898
</type>
99+
<type name="Magento\Quote\Model\Quote">
100+
<plugin name="clear_addresses_after_product_delete" type="Magento\Checkout\Plugin\Model\Quote\ResetQuoteAddresses"/>
101+
</type>
99102
</config>

app/code/Magento/CheckoutAgreements/view/frontend/web/template/checkout/checkout-agreements.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
*/
66
-->
77
<div data-role="checkout-agreements">
8-
<div class="checkout-agreements" data-bind="visible: isVisible">
8+
<div class="checkout-agreements fieldset" data-bind="visible: isVisible">
99
<!-- ko foreach: agreements -->
1010
<!-- ko if: ($parent.isAgreementRequired($data)) -->
11-
<div class="checkout-agreement required">
11+
<div class="checkout-agreement field choice required">
1212
<input type="checkbox" class="required-entry"
1313
data-bind="attr: {
1414
'id': $parent.getCheckboxId($parentContext, agreementId),
1515
'name': 'agreement[' + agreementId + ']',
1616
'value': agreementId
1717
}"/>
18-
<label data-bind="attr: {'for': $parent.getCheckboxId($parentContext, agreementId)}">
18+
<label class="label" data-bind="attr: {'for': $parent.getCheckboxId($parentContext, agreementId)}">
1919
<button type="button"
2020
class="action action-show"
2121
data-bind="click: function(data, event) { return $parent.showContent(data, event) }"

app/code/Magento/Downloadable/Ui/DataProvider/Product/Form/Modifier/Links.php

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,24 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Downloadable\Ui\DataProvider\Product\Form\Modifier;
78

8-
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier;
99
use Magento\Catalog\Model\Locator\LocatorInterface;
10+
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier;
1011
use Magento\Downloadable\Model\Product\Type;
11-
use Magento\Downloadable\Model\Source\TypeUpload;
1212
use Magento\Downloadable\Model\Source\Shareable;
13-
use Magento\Store\Model\StoreManagerInterface;
13+
use Magento\Downloadable\Model\Source\TypeUpload;
1414
use Magento\Framework\Stdlib\ArrayManager;
15-
use Magento\Ui\Component\DynamicRows;
1615
use Magento\Framework\UrlInterface;
16+
use Magento\Store\Model\StoreManagerInterface;
1717
use Magento\Ui\Component\Container;
18+
use Magento\Ui\Component\DynamicRows;
1819
use Magento\Ui\Component\Form;
1920

2021
/**
21-
* Class adds a grid with links
22+
* Class adds a grid with links.
23+
*
2224
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2325
*/
2426
class Links extends AbstractModifier
@@ -86,7 +88,7 @@ public function __construct(
8688
}
8789

8890
/**
89-
* {@inheritdoc}
91+
* @inheritdoc
9092
*/
9193
public function modifyData(array $data)
9294
{
@@ -101,7 +103,7 @@ public function modifyData(array $data)
101103
}
102104

103105
/**
104-
* {@inheritdoc}
106+
* @inheritdoc
105107
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
106108
*/
107109
public function modifyMeta(array $meta)
@@ -160,6 +162,8 @@ public function modifyMeta(array $meta)
160162
}
161163

162164
/**
165+
* Get dynamic rows meta.
166+
*
163167
* @return array
164168
*/
165169
protected function getDynamicRows()
@@ -180,6 +184,8 @@ protected function getDynamicRows()
180184
}
181185

182186
/**
187+
* Get single link record meta.
188+
*
183189
* @return array
184190
*/
185191
protected function getRecord()
@@ -221,6 +227,8 @@ protected function getRecord()
221227
}
222228

223229
/**
230+
* Get link title meta.
231+
*
224232
* @return array
225233
*/
226234
protected function getTitleColumn()
@@ -232,6 +240,7 @@ protected function getTitleColumn()
232240
'label' => __('Title'),
233241
'showLabel' => false,
234242
'dataScope' => '',
243+
'sortOrder' => 10,
235244
];
236245
$titleField['arguments']['data']['config'] = [
237246
'formElement' => Form\Element\Input::NAME,
@@ -247,6 +256,8 @@ protected function getTitleColumn()
247256
}
248257

249258
/**
259+
* Get link price meta.
260+
*
250261
* @return array
251262
*/
252263
protected function getPriceColumn()
@@ -258,6 +269,7 @@ protected function getPriceColumn()
258269
'label' => __('Price'),
259270
'showLabel' => false,
260271
'dataScope' => '',
272+
'sortOrder' => 20,
261273
];
262274
$priceField['arguments']['data']['config'] = [
263275
'formElement' => Form\Element\Input::NAME,
@@ -281,6 +293,8 @@ protected function getPriceColumn()
281293
}
282294

283295
/**
296+
* Get link file element meta.
297+
*
284298
* @return array
285299
*/
286300
protected function getFileColumn()
@@ -292,6 +306,7 @@ protected function getFileColumn()
292306
'label' => __('File'),
293307
'showLabel' => false,
294308
'dataScope' => '',
309+
'sortOrder' => 30,
295310
];
296311
$fileTypeField['arguments']['data']['config'] = [
297312
'formElement' => Form\Element\Select::NAME,
@@ -344,6 +359,8 @@ protected function getFileColumn()
344359
}
345360

346361
/**
362+
* Get sample container meta.
363+
*
347364
* @return array
348365
*/
349366
protected function getSampleColumn()
@@ -355,6 +372,7 @@ protected function getSampleColumn()
355372
'label' => __('Sample'),
356373
'showLabel' => false,
357374
'dataScope' => '',
375+
'sortOrder' => 40,
358376
];
359377
$sampleTypeField['arguments']['data']['config'] = [
360378
'formElement' => Form\Element\Select::NAME,
@@ -403,6 +421,8 @@ protected function getSampleColumn()
403421
}
404422

405423
/**
424+
* Get link "is sharable" element meta.
425+
*
406426
* @return array
407427
*/
408428
protected function getShareableColumn()
@@ -413,13 +433,16 @@ protected function getShareableColumn()
413433
'componentType' => Form\Field::NAME,
414434
'dataType' => Form\Element\DataType\Number::NAME,
415435
'dataScope' => 'is_shareable',
436+
'sortOrder' => 50,
416437
'options' => $this->shareable->toOptionArray(),
417438
];
418439

419440
return $shareableField;
420441
}
421442

422443
/**
444+
* Get link "max downloads" element meta.
445+
*
423446
* @return array
424447
*/
425448
protected function getMaxDownloadsColumn()
@@ -431,6 +454,7 @@ protected function getMaxDownloadsColumn()
431454
'label' => __('Max. Downloads'),
432455
'showLabel' => false,
433456
'dataScope' => '',
457+
'sortOrder' => 60,
434458
];
435459
$numberOfDownloadsField['arguments']['data']['config'] = [
436460
'formElement' => Form\Element\Input::NAME,

0 commit comments

Comments
 (0)