Skip to content

Commit aa365e0

Browse files
author
Volodymyr Kublytskyi
committed
Merge remote-tracking branch 'mainline/2.3-develop' into msi-core-changes-no-history
2 parents be29aa7 + cec4bf4 commit aa365e0

File tree

100 files changed

+3203
-774
lines changed

Some content is hidden

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

100 files changed

+3203
-774
lines changed

app/code/Magento/Backend/Block/System/Store/Grid/Render/Group.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public function render(\Magento\Framework\DataObject $row)
2727
$this->getUrl('adminhtml/*/editGroup', ['group_id' => $row->getGroupId()]) .
2828
'">' .
2929
$this->escapeHtml($row->getData($this->getColumn()->getIndex())) .
30-
'</a>';
30+
'</a><br />'
31+
. '(' . __('Code') . ': ' . $row->getGroupCode() . ')';
3132
}
3233
}

app/code/Magento/Backend/Block/System/Store/Grid/Render/Store.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public function render(\Magento\Framework\DataObject $row)
2727
$this->getUrl('adminhtml/*/editStore', ['store_id' => $row->getStoreId()]) .
2828
'">' .
2929
$this->escapeHtml($row->getData($this->getColumn()->getIndex())) .
30-
'</a>';
30+
'</a><br />' .
31+
'(' . __('Code') . ': ' . $row->getStoreCode() . ')';
3132
}
3233
}

app/code/Magento/Backend/Block/System/Store/Grid/Render/Website.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public function render(\Magento\Framework\DataObject $row)
2424
$this->getUrl('adminhtml/*/editWebsite', ['website_id' => $row->getWebsiteId()]) .
2525
'">' .
2626
$this->escapeHtml($row->getData($this->getColumn()->getIndex())) .
27-
'</a>';
27+
'</a><br />' .
28+
'(' . __('Code') . ': ' . $row->getCode() . ')';
2829
}
2930
}

app/code/Magento/Catalog/Console/Command/ImagesResizeCommand.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ protected function execute(
6969
$productIds = $productCollection->getAllIds();
7070
if (!count($productIds)) {
7171
$output->writeln("<info>No product images to resize</info>");
72-
// we must have an exit code higher than zero to indicate something was wrong
7372
return \Magento\Framework\Console\Cli::RETURN_SUCCESS;
7473
}
7574

app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ public function execute()
113113
$options
114114
);
115115
$valueOptions = (isset($options['value']) && is_array($options['value'])) ? $options['value'] : [];
116+
foreach (array_keys($valueOptions) as $key) {
117+
if (!empty($options['delete'][$key])) {
118+
unset($valueOptions[$key]);
119+
}
120+
}
116121
$this->checkEmptyOption($response, $valueOptions);
117122
}
118123

app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ protected function modifyPriceData($object, $data)
358358
{
359359
/** @var array $priceItem */
360360
foreach ($data as $key => $priceItem) {
361-
if (isset($priceItem['price']) && $priceItem['price'] > 0) {
361+
if (array_key_exists('price', $priceItem)) {
362362
$data[$key]['website_price'] = $priceItem['price'];
363363
}
364364
if ($priceItem['all_groups']) {

app/code/Magento/Catalog/Model/ResourceModel/Collection/AbstractCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public function getDefaultStoreId()
140140
*
141141
* @param string $table
142142
* @param array|int $attributeIds
143-
* @return \Magento\Eav\Model\Entity\Collection\AbstractCollection
143+
* @return \Magento\Framework\DB\Select
144144
*/
145145
protected function _getLoadAttributesSelect($table, $attributeIds = [])
146146
{

app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/Attribute/ValidateTest.php

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,20 @@ public function provideUniqueData()
249249
]
250250
], false
251251
],
252+
'empty and deleted' => [
253+
[
254+
'value' => [
255+
"option_0" => [1, 0],
256+
"option_1" => [2, 0],
257+
"option_2" => ["", ""],
258+
],
259+
'delete' => [
260+
"option_0" => "",
261+
"option_1" => "",
262+
"option_2" => "1",
263+
]
264+
], false
265+
],
252266
];
253267
}
254268

@@ -321,7 +335,34 @@ public function provideEmptyOption()
321335
(object) [
322336
'error' => false,
323337
]
324-
]
338+
],
339+
'empty admin scope options and deleted' => [
340+
[
341+
'value' => [
342+
"option_0" => [''],
343+
],
344+
'delete' => [
345+
'option_0' => '1',
346+
],
347+
],
348+
(object) [
349+
'error' => false,
350+
],
351+
],
352+
'empty admin scope options and not deleted' => [
353+
[
354+
'value' => [
355+
"option_0" => [''],
356+
],
357+
'delete' => [
358+
'option_0' => '0',
359+
],
360+
],
361+
(object) [
362+
'error' => true,
363+
'message' => 'The value of Admin scope can\'t be empty.',
364+
],
365+
],
325366
];
326367
}
327368
}

app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/TierpriceTest.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ public function testSetPriceData()
141141
{
142142
$attributeName = 'tier_price';
143143
$tierPrices = [
144+
[
145+
'price' => 0,
146+
'all_groups' => 1,
147+
],
144148
[
145149
'price' => 10,
146150
'all_groups' => 1,
@@ -153,6 +157,12 @@ public function testSetPriceData()
153157
$productPrice = 20;
154158
$allCustomersGroupId = 32000;
155159
$finalTierPrices = [
160+
[
161+
'price' => 0,
162+
'all_groups' => 1,
163+
'website_price' => 0,
164+
'cust_group' => 32000,
165+
],
156166
[
157167
'price' => 10,
158168
'all_groups' => 1,
@@ -170,8 +180,11 @@ public function testSetPriceData()
170180
->disableOriginalConstructor()->getMock();
171181
$allCustomersGroup = $this->getMockBuilder(\Magento\Customer\Api\Data\GroupInterface::class)
172182
->disableOriginalConstructor()->getMock();
173-
$this->groupManagement->expects($this->once())->method('getAllCustomersGroup')->willReturn($allCustomersGroup);
174-
$allCustomersGroup->expects($this->once())->method('getId')->willReturn($allCustomersGroupId);
183+
$this->groupManagement
184+
->expects($this->exactly(2))
185+
->method('getAllCustomersGroup')
186+
->willReturn($allCustomersGroup);
187+
$allCustomersGroup->expects($this->exactly(2))->method('getId')->willReturn($allCustomersGroupId);
175188
$object->expects($this->once())->method('getPrice')->willReturn($productPrice);
176189
$this->attribute->expects($this->atLeastOnce())->method('isScopeGlobal')->willReturn(true);
177190
$object->expects($this->once())->method('getStoreId')->willReturn(null);

app/code/Magento/CatalogImportExport/Model/Indexer/Product/Flat/Plugin/Import.php

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,30 @@
55
*/
66
namespace Magento\CatalogImportExport\Model\Indexer\Product\Flat\Plugin;
77

8+
use Magento\Catalog\Model\Indexer\Product\Flat\State as FlatState;
9+
810
class Import
911
{
12+
/**
13+
* @var \Magento\Catalog\Model\Indexer\Product\Flat\State
14+
*/
15+
private $flatState;
16+
1017
/**
1118
* @var \Magento\Catalog\Model\Indexer\Product\Flat\Processor
1219
*/
1320
protected $_productFlatIndexerProcessor;
1421

1522
/**
1623
* @param \Magento\Catalog\Model\Indexer\Product\Flat\Processor $productFlatIndexerProcessor
24+
* @param \Magento\Catalog\Model\Indexer\Product\Flat\State $flatState
1725
*/
18-
public function __construct(\Magento\Catalog\Model\Indexer\Product\Flat\Processor $productFlatIndexerProcessor)
19-
{
26+
public function __construct(
27+
\Magento\Catalog\Model\Indexer\Product\Flat\Processor $productFlatIndexerProcessor,
28+
FlatState $flatState
29+
) {
2030
$this->_productFlatIndexerProcessor = $productFlatIndexerProcessor;
31+
$this->flatState = $flatState;
2132
}
2233

2334
/**
@@ -31,7 +42,10 @@ public function __construct(\Magento\Catalog\Model\Indexer\Product\Flat\Processo
3142
*/
3243
public function afterImportSource(\Magento\ImportExport\Model\Import $subject, $import)
3344
{
34-
$this->_productFlatIndexerProcessor->markIndexerAsInvalid();
45+
if ($this->flatState->isFlatEnabled() && !$this->_productFlatIndexerProcessor->isIndexerScheduled()) {
46+
$this->_productFlatIndexerProcessor->markIndexerAsInvalid();
47+
}
48+
3549
return $import;
3650
}
3751
}

app/code/Magento/CatalogImportExport/Test/Unit/Model/Indexer/Product/Flat/Plugin/ImportTest.php

Lines changed: 66 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,79 @@
55
*/
66
namespace Magento\CatalogImportExport\Test\Unit\Model\Indexer\Product\Flat\Plugin;
77

8+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
9+
810
class ImportTest extends \PHPUnit\Framework\TestCase
911
{
10-
public function testAfterImportSource()
12+
/**
13+
* @var \Magento\Catalog\Model\Indexer\Product\Flat\Processor|\PHPUnit_Framework_MockObject_MockObject
14+
*/
15+
private $processorMock;
16+
17+
/**
18+
* @var \Magento\CatalogImportExport\Model\Indexer\Product\Flat\Plugin\Import
19+
*/
20+
private $model;
21+
22+
/**
23+
* @var \Magento\Catalog\Model\Indexer\Product\Flat\State|\PHPUnit_Framework_MockObject_MockObject
24+
*/
25+
private $flatStateMock;
26+
27+
/**
28+
* @var \Magento\ImportExport\Model\Import|\PHPUnit_Framework_MockObject_MockObject
29+
*/
30+
private $subjectMock;
31+
32+
protected function setUp()
1133
{
12-
/**
13-
* @var \Magento\Catalog\Model\Indexer\Product\Flat\Processor|
14-
* \PHPUnit_Framework_MockObject_MockObject $processorMock
15-
*/
16-
$processorMock = $this->createPartialMock(
17-
\Magento\Catalog\Model\Indexer\Product\Flat\Processor::class,
18-
['markIndexerAsInvalid']
34+
$this->processorMock = $this->getMockBuilder(\Magento\Catalog\Model\Indexer\Product\Flat\Processor::class)
35+
->disableOriginalConstructor()
36+
->setMethods(['markIndexerAsInvalid', 'isIndexerScheduled'])
37+
->getMock();
38+
39+
$this->flatStateMock = $this->getMockBuilder(\Magento\Catalog\Model\Indexer\Product\Flat\State::class)
40+
->disableOriginalConstructor()
41+
->setMethods(['isFlatEnabled'])
42+
->getMock();
43+
44+
$this->subjectMock = $this->getMockBuilder(\Magento\ImportExport\Model\Import::class)
45+
->disableOriginalConstructor()
46+
->getMock();
47+
48+
$this->model = (new ObjectManager($this))->getObject(
49+
\Magento\CatalogImportExport\Model\Indexer\Product\Flat\Plugin\Import::class,
50+
[
51+
'productFlatIndexerProcessor' => $this->processorMock,
52+
'flatState' => $this->flatStateMock
53+
]
1954
);
55+
}
2056

21-
$subjectMock = $this->createMock(\Magento\ImportExport\Model\Import::class);
22-
$processorMock->expects($this->once())->method('markIndexerAsInvalid');
57+
public function testAfterImportSourceWithFlatEnabledAndIndexerScheduledDisabled()
58+
{
59+
$this->flatStateMock->expects($this->once())->method('isFlatEnabled')->willReturn(true);
60+
$this->processorMock->expects($this->once())->method('isIndexerScheduled')->willReturn(false);
61+
$this->processorMock->expects($this->once())->method('markIndexerAsInvalid');
62+
$someData = [1, 2, 3];
63+
$this->assertEquals($someData, $this->model->afterImportSource($this->subjectMock, $someData));
64+
}
2365

66+
public function testAfterImportSourceWithFlatDisabledAndIndexerScheduledDisabled()
67+
{
68+
$this->flatStateMock->expects($this->once())->method('isFlatEnabled')->willReturn(false);
69+
$this->processorMock->expects($this->never())->method('isIndexerScheduled')->willReturn(false);
70+
$this->processorMock->expects($this->never())->method('markIndexerAsInvalid');
2471
$someData = [1, 2, 3];
72+
$this->assertEquals($someData, $this->model->afterImportSource($this->subjectMock, $someData));
73+
}
2574

26-
$model = new \Magento\CatalogImportExport\Model\Indexer\Product\Flat\Plugin\Import($processorMock);
27-
$this->assertEquals($someData, $model->afterImportSource($subjectMock, $someData));
75+
public function testAfterImportSourceWithFlatEnabledAndIndexerScheduledEnabled()
76+
{
77+
$this->flatStateMock->expects($this->once())->method('isFlatEnabled')->willReturn(true);
78+
$this->processorMock->expects($this->once())->method('isIndexerScheduled')->willReturn(true);
79+
$this->processorMock->expects($this->never())->method('markIndexerAsInvalid');
80+
$someData = [1, 2, 3];
81+
$this->assertEquals($someData, $this->model->afterImportSource($this->subjectMock, $someData));
2882
}
2983
}

app/code/Magento/CatalogUrlRewrite/Model/Storage/DbStorage.php

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,37 @@
1212
class DbStorage extends BaseDbStorage
1313
{
1414
/**
15-
* @param array $data
16-
* @return \Magento\Framework\DB\Select
15+
* {@inheritDoc}
1716
*/
1817
protected function prepareSelect(array $data)
1918
{
19+
$metadata = [];
20+
if (array_key_exists(UrlRewrite::METADATA, $data)) {
21+
$metadata = $data[UrlRewrite::METADATA];
22+
unset($data[UrlRewrite::METADATA]);
23+
}
24+
2025
$select = $this->connection->select();
21-
$select->from(['url_rewrite' => $this->resource->getTableName('url_rewrite')])
22-
->joinLeft(
23-
['relation' => $this->resource->getTableName(Product::TABLE_NAME)],
24-
'url_rewrite.url_rewrite_id = relation.url_rewrite_id'
25-
)
26-
->where('url_rewrite.entity_id IN (?)', $data['entity_id'])
27-
->where('url_rewrite.entity_type = ?', $data['entity_type'])
28-
->where('url_rewrite.store_id IN (?)', $data['store_id']);
29-
if (empty($data[UrlRewrite::METADATA]['category_id'])) {
26+
$select->from([
27+
'url_rewrite' => $this->resource->getTableName(self::TABLE_NAME)
28+
]);
29+
$select->joinLeft(
30+
['relation' => $this->resource->getTableName(Product::TABLE_NAME)],
31+
'url_rewrite.url_rewrite_id = relation.url_rewrite_id'
32+
);
33+
34+
foreach ($data as $column => $value) {
35+
$select->where('url_rewrite.' . $column . ' IN (?)', $value);
36+
}
37+
if (empty($metadata['category_id'])) {
3038
$select->where('relation.category_id IS NULL');
3139
} else {
32-
$select->where('relation.category_id = ?', $data[UrlRewrite::METADATA]['category_id']);
40+
$select->where(
41+
'relation.category_id = ?',
42+
$metadata['category_id']
43+
);
3344
}
45+
3446
return $select;
3547
}
3648
}

app/code/Magento/Checkout/view/frontend/web/js/model/address-converter.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,20 +72,20 @@ define([
7272
output = {},
7373
streetObject;
7474

75+
$.each(addrs, function (key) {
76+
if (addrs.hasOwnProperty(key) && !$.isFunction(addrs[key])) {
77+
output[self.toUnderscore(key)] = addrs[key];
78+
}
79+
});
80+
7581
if ($.isArray(addrs.street)) {
7682
streetObject = {};
7783
addrs.street.forEach(function (value, index) {
7884
streetObject[index] = value;
7985
});
80-
addrs.street = streetObject;
86+
output.street = streetObject;
8187
}
8288

83-
$.each(addrs, function (key) {
84-
if (addrs.hasOwnProperty(key) && !$.isFunction(addrs[key])) {
85-
output[self.toUnderscore(key)] = addrs[key];
86-
}
87-
});
88-
8989
return output;
9090
},
9191

app/code/Magento/Checkout/view/frontend/web/js/model/step-navigator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ define([
144144
*/
145145
navigateTo: function (code, scrollToElementId) {
146146
var sortedItems = steps().sort(this.sortItems),
147-
bodyElem = $.browser.safari || $.browser.chrome ? $('body') : $('html');
147+
bodyElem = $('body');
148148

149149
scrollToElementId = scrollToElementId || null;
150150

0 commit comments

Comments
 (0)