Skip to content

Commit fe2dcff

Browse files
committed
Merge branch '2.3-develop' into MAGETWO-86867-cleanup
2 parents d6f761a + af84959 commit fe2dcff

File tree

104 files changed

+3380
-1252
lines changed

Some content is hidden

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

104 files changed

+3380
-1252
lines changed

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,6 @@
145145
<item name="dev" xsi:type="const">Magento\Config\Model\Config\Structure\ElementVisibilityInterface::HIDDEN</item>
146146
<item name="general/locale/code" xsi:type="const">Magento\Config\Model\Config\Structure\ElementVisibilityInterface::DISABLED</item>
147147
</argument>
148-
<argument name="exemptions" xsi:type="array">
149-
<item name="dev/debug/debug_logging" xsi:type="string"/>
150-
</argument>
151148
</arguments>
152149
</type>
153150
<type name="Magento\Backend\Model\Search\Config\Result\Builder">

app/code/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/BundlePanel.php

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,8 @@ protected function getBundleOptions()
314314
'template' => 'ui/dynamic-rows/templates/collapsible',
315315
'additionalClasses' => 'admin__field-wide',
316316
'dataScope' => 'data.bundle_options',
317-
'bundleSelectionsName' => 'product_bundle_container.bundle_selections'
317+
'isDefaultFieldScope' => 'is_default',
318+
'bundleSelectionsName' => 'product_bundle_container.bundle_selections',
318319
],
319320
],
320321
],
@@ -378,7 +379,10 @@ protected function getBundleOptions()
378379
'selection_qty' => '',
379380
],
380381
'links' => ['insertData' => '${ $.provider }:${ $.dataProvider }'],
381-
'source' => 'product'
382+
'imports' => [
383+
'inputType' => '${$.provider}:${$.dataScope}.type',
384+
],
385+
'source' => 'product',
382386
],
383387
],
384388
],
@@ -594,11 +598,14 @@ protected function getBundleSelections()
594598
'config' => [
595599
'componentType' => Container::NAME,
596600
'isTemplate' => true,
597-
'component' => 'Magento_Bundle/js/components/bundle-record',
601+
'component' => 'Magento_Ui/js/dynamic-rows/record',
598602
'is_collection' => true,
599603
'imports' => [
600-
'onTypeChanged' => '${ $.provider }:${ $.bundleOptionsDataScope }.type'
601-
]
604+
'inputType' => '${$.parentName}:inputType',
605+
],
606+
'exports' => [
607+
'isDefaultValue' => '${$.parentName}:isDefaultValue.${$.index}',
608+
],
602609
],
603610
],
604611
],
@@ -691,11 +698,15 @@ protected function getBundleSelections()
691698
'componentType' => Form\Field::NAME,
692699
'formElement' => Form\Element\Checkbox::NAME,
693700
'dataType' => Form\Element\DataType\Price::NAME,
701+
'component' => 'Magento_Bundle/js/components/bundle-user-defined-checkbox',
694702
'label' => __('User Defined'),
695703
'dataScope' => 'selection_can_change_qty',
696704
'value' => '1',
697705
'valueMap' => ['true' => '1', 'false' => '0'],
698706
'sortOrder' => 110,
707+
'imports' => [
708+
'inputType' => '${$.parentName}:inputType',
709+
],
699710
],
700711
],
701712
],

app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-checkbox.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ define([
1414
clearing: false,
1515
parentContainer: '',
1616
parentSelections: '',
17-
changer: ''
17+
changer: '',
18+
exports: {
19+
value: '${$.parentName}:isDefaultValue'
20+
}
1821
},
1922

2023
/**
@@ -58,10 +61,6 @@ define([
5861

5962
this.prefer = typeMap[type];
6063
this.elementTmpl(this.templates[typeMap[type]]);
61-
62-
if (this.prefer === 'radio' && this.checked()) {
63-
this.clearValues();
64-
}
6564
},
6665

6766
/**

app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-dynamic-rows-grid.js

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,57 @@ define([
1414
label: '',
1515
columnsHeader: false,
1616
columnsHeaderAfterRender: true,
17-
addButton: false
17+
addButton: false,
18+
isDefaultFieldScope: 'is_default',
19+
defaultRecords: {
20+
use: [],
21+
moreThanOne: false,
22+
state: {}
23+
},
24+
listens: {
25+
inputType: 'onInputTypeChange',
26+
isDefaultValue: 'onIsDefaultValue'
27+
}
28+
},
29+
30+
/**
31+
* Handler for type select.
32+
*
33+
* @param {String} inputType - changed.
34+
*/
35+
onInputTypeChange: function (inputType) {
36+
if (this.defaultRecords.moreThanOne && (inputType === 'radio' || inputType === 'select')) {
37+
_.each(this.defaultRecords.use, function (index, counter) {
38+
this.source.set(
39+
this.dataScope + '.bundle_selections.' + index + '.' + this.isDefaultFieldScope,
40+
counter ? '0' : '1'
41+
);
42+
}.bind(this));
43+
}
44+
},
45+
46+
/**
47+
* Handler for is_default field.
48+
*
49+
* @param {Object} data - changed data.
50+
*/
51+
onIsDefaultValue: function (data) {
52+
var cb,
53+
use = 0;
54+
55+
this.defaultRecords.use = [];
56+
57+
cb = function (elem, key) {
58+
59+
if (~~elem) {
60+
this.defaultRecords.use.push(key);
61+
use++;
62+
}
63+
64+
this.defaultRecords.moreThanOne = use > 1;
65+
}.bind(this);
66+
67+
_.each(data, cb);
1868
},
1969

2070
/**
@@ -29,7 +79,6 @@ define([
2979
recordIndex;
3080

3181
this.parsePagesData(data);
32-
this.templates.record.bundleOptionsDataScope = this.dataScope;
3382

3483
if (newData.length) {
3584
if (this.insertData().length) {
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
define([
7+
'Magento_Ui/js/form/element/single-checkbox'
8+
], function (Checkbox) {
9+
'use strict';
10+
11+
return Checkbox.extend({
12+
defaults: {
13+
listens: {
14+
inputType: 'onInputTypeChange'
15+
}
16+
},
17+
18+
/**
19+
* Handler for "inputType" property
20+
*
21+
* @param {String} data
22+
*/
23+
onInputTypeChange: function (data) {
24+
data === 'checkbox' || data === 'multi' ?
25+
this.clear()
26+
.visible(false) :
27+
this.visible(true);
28+
}
29+
});
30+
});

app/code/Magento/Catalog/Model/Indexer/Product/Eav/AbstractAction.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\Catalog\Model\Indexer\Product\Eav;
77

8+
use Magento\Catalog\Model\ResourceModel\Product\Indexer\Eav\AbstractEav;
9+
810
/**
911
* Abstract action reindex class
1012
*/
@@ -51,7 +53,7 @@ abstract public function execute($ids);
5153
/**
5254
* Retrieve array of EAV type indexers
5355
*
54-
* @return \Magento\Catalog\Model\ResourceModel\Product\Indexer\Eav\AbstractEav[]
56+
* @return AbstractEav[]
5557
*/
5658
public function getIndexers()
5759
{
@@ -69,7 +71,7 @@ public function getIndexers()
6971
* Retrieve indexer instance by type
7072
*
7173
* @param string $type
72-
* @return \Magento\Catalog\Model\ResourceModel\Product\Indexer\Eav\AbstractEav
74+
* @return AbstractEav
7375
* @throws \Magento\Framework\Exception\LocalizedException
7476
*/
7577
public function getIndexer($type)
@@ -108,7 +110,7 @@ public function reindex($ids = null)
108110
/**
109111
* Synchronize data between index storage and original storage
110112
*
111-
* @param \Magento\Catalog\Model\ResourceModel\Product\Indexer\Eav\AbstractEav $indexer
113+
* @param AbstractEav $indexer
112114
* @param string $destinationTable
113115
* @param array $ids
114116
* @throws \Exception
@@ -134,16 +136,17 @@ protected function syncData($indexer, $destinationTable, $ids)
134136
/**
135137
* Retrieve product relations by children and parent
136138
*
137-
* @param \Magento\Catalog\Model\ResourceModel\Product\Indexer\Eav\AbstractEav $indexer
139+
* @param AbstractEav $indexer
138140
* @param array $ids
139-
*
140141
* @param bool $onlyParents
141142
* @return array $ids
142143
*/
143-
protected function processRelations($indexer, $ids, $onlyParents = false)
144+
protected function processRelations(AbstractEav $indexer, array $ids, bool $onlyParents = false)
144145
{
145146
$parentIds = $indexer->getRelationsByChild($ids);
147+
$parentIds = array_unique(array_merge($parentIds, $ids));
146148
$childIds = $onlyParents ? [] : $indexer->getRelationsByParent($parentIds);
149+
147150
return array_unique(array_merge($ids, $childIds, $parentIds));
148151
}
149152
}

app/code/Magento/Catalog/Model/Product.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2108,6 +2108,8 @@ public function reset()
21082108
/**
21092109
* Get cache tags associated with object id
21102110
*
2111+
* @deprecated
2112+
* @see \Magento\Catalog\Model\Product::getIdentities
21112113
* @return string[]
21122114
*/
21132115
public function getCacheIdTags()

app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Eav/AbstractEav.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ public function reindexEntities($processIds)
8282
$this->_prepareIndex($processIds);
8383
$this->_prepareRelationIndex($processIds);
8484
$this->_removeNotVisibleEntityFromIndex();
85+
8586
return $this;
8687
}
8788

@@ -159,11 +160,12 @@ protected function _removeNotVisibleEntityFromIndex()
159160
* @param array $parentIds the parent entity ids limitation
160161
* @return \Magento\Framework\DB\Select
161162
*/
162-
protected function _prepareRelationIndexSelect($parentIds = null)
163+
protected function _prepareRelationIndexSelect(array $parentIds = null)
163164
{
164165
$connection = $this->getConnection();
165166
$idxTable = $this->getIdxTable();
166167
$linkField = $this->getMetadataPool()->getMetadata(ProductInterface::class)->getLinkField();
168+
167169
$select = $connection->select()->from(
168170
['l' => $this->getTable('catalog_product_relation')],
169171
[]
@@ -179,6 +181,14 @@ protected function _prepareRelationIndexSelect($parentIds = null)
179181
['i' => $idxTable],
180182
'l.child_id = i.entity_id AND cs.store_id = i.store_id',
181183
[]
184+
)->join(
185+
['sw' => $this->getTable('store_website')],
186+
"cs.website_id = sw.website_id",
187+
[]
188+
)->join(
189+
['cpw' => $this->getTable('catalog_product_website')],
190+
'i.entity_id = cpw.product_id AND sw.website_id = cpw.website_id',
191+
[]
182192
)->group(
183193
['parent_id', 'i.attribute_id', 'i.store_id', 'i.value', 'l.child_id']
184194
)->columns(

app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Eav/AbstractActionTest.php

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,20 @@ public function testReindexWithoutArgumentsExecutesReindexAll()
113113
$this->_model->reindex();
114114
}
115115

116-
public function testReindexWithNotNullArgumentExecutesReindexEntities()
117-
{
118-
$childIds = [1, 2, 3];
119-
$parentIds = [4];
120-
$reindexIds = array_merge($childIds, $parentIds);
116+
/**
117+
* @param array $ids
118+
* @param array $parentIds
119+
* @param array $childIds
120+
* @return void
121+
* @dataProvider reindexEntitiesDataProvider
122+
*/
123+
public function testReindexWithNotNullArgumentExecutesReindexEntities(
124+
array $ids,
125+
array $parentIds,
126+
array $childIds
127+
) : void {
128+
$reindexIds = array_unique(array_merge($ids, $parentIds, $childIds));
129+
121130
$connectionMock = $this->getMockBuilder(\Magento\Framework\DB\Adapter\AdapterInterface::class)
122131
->getMockForAbstractClass();
123132

@@ -129,11 +138,23 @@ public function testReindexWithNotNullArgumentExecutesReindexEntities()
129138
->disableOriginalConstructor()
130139
->getMock();
131140

132-
$eavSource->expects($this->once())->method('getRelationsByChild')->with($childIds)->willReturn($childIds);
133-
$eavSource->expects($this->once())->method('getRelationsByParent')->with($childIds)->willReturn($parentIds);
141+
$eavSource->expects($this->once())
142+
->method('getRelationsByChild')
143+
->with($ids)
144+
->willReturn($parentIds);
145+
$eavSource->expects($this->once())
146+
->method('getRelationsByParent')
147+
->with(array_unique(array_merge($parentIds, $ids)))
148+
->willReturn($childIds);
134149

135-
$eavDecimal->expects($this->once())->method('getRelationsByChild')->with($reindexIds)->willReturn($reindexIds);
136-
$eavDecimal->expects($this->once())->method('getRelationsByParent')->with($reindexIds)->willReturn([]);
150+
$eavDecimal->expects($this->once())
151+
->method('getRelationsByChild')
152+
->with($reindexIds)
153+
->willReturn($parentIds);
154+
$eavDecimal->expects($this->once())
155+
->method('getRelationsByParent')
156+
->with(array_unique(array_merge($parentIds, $reindexIds)))
157+
->willReturn($childIds);
137158

138159
$eavSource->expects($this->once())->method('getConnection')->willReturn($connectionMock);
139160
$eavDecimal->expects($this->once())->method('getConnection')->willReturn($connectionMock);
@@ -153,6 +174,18 @@ public function testReindexWithNotNullArgumentExecutesReindexEntities()
153174
->method('create')
154175
->will($this->returnValue($eavDecimal));
155176

156-
$this->_model->reindex($childIds);
177+
$this->_model->reindex($ids);
178+
}
179+
180+
/**
181+
* @return array
182+
*/
183+
public function reindexEntitiesDataProvider() : array
184+
{
185+
return [
186+
[[4], [], [1, 2, 3]],
187+
[[3], [4], []],
188+
[[5], [], []],
189+
];
157190
}
158191
}

app/code/Magento/Checkout/Block/Registration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function getEmailAddress()
9191
*/
9292
public function getCreateAccountUrl()
9393
{
94-
return $this->getUrl('checkout/account/create');
94+
return $this->getUrl('checkout/account/delegateCreate');
9595
}
9696

9797
/**

0 commit comments

Comments
 (0)