Skip to content

Commit 8068746

Browse files
committed
Merge remote-tracking branch 'mainline/2.3-develop' into PANDA-PR-2.3
2 parents f836c69 + 4b49996 commit 8068746

File tree

137 files changed

+2453
-879
lines changed

Some content is hidden

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

137 files changed

+2453
-879
lines changed

app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages/popup.phtml

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,12 @@
1919
</ul>
2020
</div>
2121

22-
<script>
23-
require([
24-
"jquery",
25-
"Magento_Ui/js/modal/modal"
26-
], function($){
27-
if (this.modal) {
28-
this.modal.html($('[data-role="system_messages_list"]').html());
29-
} else {
30-
this.modal = $('[data-role="system_messages_list"]').modal({
31-
modalClass: 'modal-system-messages ui-popup-message',
32-
type: 'popup',
33-
buttons: []
34-
});
22+
<script type="text/x-magento-init">
23+
{
24+
"[data-role=system_messages_list]": {
25+
"Magento_AdminNotification/js/system/messages/popup": {
26+
class: 'modal-system-messages ui-popup-message'
27+
}
28+
}
3529
}
36-
this.modal.modal('openModal');
37-
});
38-
</script>
30+
</script>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
define([
7+
'jquery',
8+
'Magento_Ui/js/modal/modal'
9+
], function ($) {
10+
'use strict';
11+
12+
return function (data, element) {
13+
if (this.modal) {
14+
this.modal.html($(element).html());
15+
} else {
16+
this.modal = $(element).modal({
17+
modalClass: data.class,
18+
type: 'popup',
19+
buttons: []
20+
});
21+
}
22+
this.modal.modal('openModal');
23+
};
24+
});

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

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,7 @@ protected function initializeProductData(array $productData, $createNew)
334334
unset($productData['media_gallery']);
335335
if ($createNew) {
336336
$product = $this->productFactory->create();
337-
if ($this->storeManager->hasSingleStore()) {
338-
$product->setWebsiteIds([$this->storeManager->getStore(true)->getWebsiteId()]);
339-
}
337+
$this->assignProductToWebsites($product);
340338
} else {
341339
$this->removeProductFromLocalCache($productData['sku']);
342340
$product = $this->get($productData['sku']);
@@ -345,31 +343,20 @@ protected function initializeProductData(array $productData, $createNew)
345343
foreach ($productData as $key => $value) {
346344
$product->setData($key, $value);
347345
}
348-
$this->assignProductToWebsites($product, $createNew);
349346

350347
return $product;
351348
}
352349

353350
/**
354351
* @param \Magento\Catalog\Model\Product $product
355-
* @param bool $createNew
356352
* @return void
357353
*/
358-
private function assignProductToWebsites(\Magento\Catalog\Model\Product $product, $createNew)
354+
private function assignProductToWebsites(\Magento\Catalog\Model\Product $product)
359355
{
360-
$websiteIds = $product->getWebsiteIds();
361-
362-
if (!$this->storeManager->hasSingleStore()) {
363-
$websiteIds = array_unique(
364-
array_merge(
365-
$websiteIds,
366-
[$this->storeManager->getStore()->getWebsiteId()]
367-
)
368-
);
369-
}
370-
371-
if ($createNew && $this->storeManager->getStore(true)->getCode() == \Magento\Store\Model\Store::ADMIN_CODE) {
356+
if ($this->storeManager->getStore(true)->getCode() == \Magento\Store\Model\Store::ADMIN_CODE) {
372357
$websiteIds = array_keys($this->storeManager->getWebsites());
358+
} else {
359+
$websiteIds = [$this->storeManager->getStore()->getWebsiteId()];
373360
}
374361

375362
$product->setWebsiteIds($websiteIds);

app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,6 @@ public function testGetBySkuFromCacheInitializedInGetById()
553553

554554
public function testSaveExisting()
555555
{
556-
$this->storeManagerMock->expects($this->any())->method('getWebsites')->willReturn([1 => 'default']);
557556
$this->resourceModelMock->expects($this->any())->method('getIdBySku')->will($this->returnValue(100));
558557
$this->productFactoryMock->expects($this->any())
559558
->method('create')
@@ -566,7 +565,6 @@ public function testSaveExisting()
566565
->expects($this->once())
567566
->method('toNestedArray')
568567
->will($this->returnValue($this->productData));
569-
$this->productMock->expects($this->once())->method('getWebsiteIds')->willReturn([]);
570568
$this->productMock->expects($this->atLeastOnce())->method('getSku')->willReturn($this->productData['sku']);
571569

572570
$this->assertEquals($this->productMock, $this->model->save($this->productMock));
@@ -588,7 +586,6 @@ public function testSaveNew()
588586
->expects($this->once())
589587
->method('toNestedArray')
590588
->will($this->returnValue($this->productData));
591-
$this->productMock->method('getWebsiteIds')->willReturn([]);
592589
$this->productMock->method('getSku')->willReturn('simple');
593590

594591
$this->assertEquals($this->productMock, $this->model->save($this->productMock));
@@ -615,7 +612,6 @@ public function testSaveUnableToSaveException()
615612
->expects($this->once())
616613
->method('toNestedArray')
617614
->will($this->returnValue($this->productData));
618-
$this->productMock->method('getWebsiteIds')->willReturn([]);
619615
$this->productMock->method('getSku')->willReturn('simple');
620616

621617
$this->model->save($this->productMock);
@@ -642,7 +638,6 @@ public function testSaveException()
642638
->expects($this->once())
643639
->method('toNestedArray')
644640
->will($this->returnValue($this->productData));
645-
$this->productMock->expects($this->once())->method('getWebsiteIds')->willReturn([]);
646641
$this->productMock->method('getSku')->willReturn('simple');
647642

648643
$this->model->save($this->productMock);
@@ -667,7 +662,6 @@ public function testSaveInvalidProductException()
667662
->expects($this->once())
668663
->method('toNestedArray')
669664
->will($this->returnValue($this->productData));
670-
$this->productMock->expects($this->once())->method('getWebsiteIds')->willReturn([]);
671665
$this->productMock->method('getSku')->willReturn('simple');
672666

673667
$this->model->save($this->productMock);
@@ -697,9 +691,6 @@ public function testSaveThrowsTemporaryStateExceptionIfDatabaseConnectionErrorOc
697691
->expects($this->once())
698692
->method('toNestedArray')
699693
->will($this->returnValue($this->productData));
700-
$this->productMock->expects($this->once())
701-
->method('getWebsiteIds')
702-
->willReturn([]);
703694
$this->productMock->method('getSku')->willReturn('simple');
704695

705696
$this->model->save($this->productMock);
@@ -847,7 +838,6 @@ public function testSaveExistingWithOptions(array $newOptions, array $existingOp
847838
->method('toNestedArray')
848839
->will($this->returnValue($this->productData));
849840

850-
$this->initializedProductMock->expects($this->once())->method('getWebsiteIds')->willReturn([]);
851841
$this->initializedProductMock->expects($this->atLeastOnce())
852842
->method('getSku')->willReturn($this->productData['sku']);
853843
$this->productMock->expects($this->atLeastOnce())->method('getSku')->willReturn($this->productData['sku']);
@@ -1083,7 +1073,6 @@ public function testSaveWithLinks(array $newLinks, array $existingLinks, array $
10831073
$outputLinks[] = $outputLink;
10841074
}
10851075
}
1086-
$this->initializedProductMock->expects($this->once())->method('getWebsiteIds')->willReturn([]);
10871076

10881077
if (!empty($outputLinks)) {
10891078
$this->initializedProductMock->expects($this->once())
@@ -1264,7 +1253,6 @@ public function testSaveExistingWithNewMediaGalleryEntries()
12641253
'media_type' => 'media_type',
12651254
]
12661255
);
1267-
$this->initializedProductMock->expects($this->once())->method('getWebsiteIds')->willReturn([]);
12681256
$this->initializedProductMock->expects($this->atLeastOnce())
12691257
->method('getSku')->willReturn($this->productData['sku']);
12701258
$this->productMock->expects($this->atLeastOnce())->method('getSku')->willReturn($this->productData['sku']);
@@ -1305,7 +1293,6 @@ public function testSaveWithDifferentWebsites()
13051293
2 => ['second'],
13061294
3 => ['third']
13071295
]);
1308-
$this->productMock->expects($this->once())->method('getWebsiteIds')->willReturn([1,2,3]);
13091296
$this->productMock->expects($this->once())->method('setWebsiteIds')->willReturn([2,3]);
13101297
$this->productMock->method('getSku')->willReturn('simple');
13111298

@@ -1377,7 +1364,6 @@ public function testSaveExistingWithMediaGalleryEntries()
13771364
$this->mediaGalleryProcessor->expects($this->once())
13781365
->method('setMediaAttribute')
13791366
->with($this->initializedProductMock, ['image', 'small_image'], 'filename1');
1380-
$this->initializedProductMock->expects($this->once())->method('getWebsiteIds')->willReturn([]);
13811367
$this->initializedProductMock->expects($this->atLeastOnce())
13821368
->method('getSku')->willReturn($this->productData['sku']);
13831369
$this->productMock->expects($this->atLeastOnce())->method('getSku')->willReturn($this->productData['sku']);

app/code/Magento/Catalog/etc/adminhtml/menu.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
<add id="Magento_Catalog::catalog_categories" title="Categories" translate="title" module="Magento_Catalog" sortOrder="20" parent="Magento_Catalog::inventory" action="catalog/category/" resource="Magento_Catalog::categories"/>
1313
<add id="Magento_Catalog::catalog_attributes_attributes" title="Product" translate="title" module="Magento_Catalog" sortOrder="30" parent="Magento_Backend::stores_attributes" action="catalog/product_attribute/" resource="Magento_Catalog::attributes_attributes"/>
1414
<add id="Magento_Catalog::catalog_attributes_sets" title="Attribute Set" translate="title" module="Magento_Catalog" sortOrder="40" parent="Magento_Backend::stores_attributes" action="catalog/product_set/" resource="Magento_Catalog::sets"/>
15-
1615
<add id="Magento_Catalog::inventory" title="Inventory" translate="title" module="Magento_Catalog" sortOrder="10" parent="Magento_Catalog::catalog" dependsOnModule="Magento_Catalog" resource="Magento_Catalog::catalog"/>
1716
</menu>
1817
</config>

app/code/Magento/Catalog/etc/db_schema.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1809,7 +1809,7 @@
18091809
<constraint xsi:type="foreign" name="CAT_PRD_FRONTEND_ACTION_CSTR_ID_CSTR_ENTT_ENTT_ID"
18101810
table="catalog_product_frontend_action" column="customer_id" referenceTable="customer_entity"
18111811
referenceColumn="entity_id" onDelete="CASCADE"/>
1812-
<constraint xsi:type="foreign" name="PRODUCT_FRONTEND_ACTION_PRODUCT_ID"
1812+
<constraint xsi:type="foreign" name="CAT_PRD_FRONTEND_ACTION_PRD_ID_CAT_PRD_ENTT_ENTT_ID"
18131813
table="catalog_product_frontend_action" column="product_id" referenceTable="catalog_product_entity"
18141814
referenceColumn="entity_id" onDelete="CASCADE" />
18151815
<constraint xsi:type="unique" name="CATALOG_PRODUCT_FRONTEND_ACTION_VISITOR_ID_PRODUCT_ID_TYPE_ID">

app/code/Magento/Catalog/etc/db_schema_whitelist.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,7 +1096,8 @@
10961096
"index": {
10971097
"CAT_CTGR_PRD_IDX_REPLICA_PRD_ID_STORE_ID_CTGR_ID_VISIBILITY": true,
10981098
"IDX_87EB2E3059853CF89A75B4C55074810B": true,
1099-
"CAT_CTGR_PRD_IDX_PRD_ID_STORE_ID_CTGR_ID_VISIBILITY": true
1099+
"CAT_CTGR_PRD_IDX_PRD_ID_STORE_ID_CTGR_ID_VISIBILITY": true,
1100+
"CAT_CTGR_PRD_IDX_STORE_ID_CTGR_ID_VISIBILITY_IS_PARENT_POSITION": true
11001101
},
11011102
"constraint": {
11021103
"PRIMARY": true
@@ -1114,8 +1115,9 @@
11141115
"constraint": {
11151116
"PRIMARY": true,
11161117
"CAT_PRD_FRONTEND_ACTION_CSTR_ID_CSTR_ENTT_ENTT_ID": true,
1118+
"CAT_PRD_FRONTEND_ACTION_PRD_ID_CAT_PRD_ENTT_ENTT_ID": true,
11171119
"CATALOG_PRODUCT_FRONTEND_ACTION_VISITOR_ID_PRODUCT_ID_TYPE_ID": true,
11181120
"CATALOG_PRODUCT_FRONTEND_ACTION_CUSTOMER_ID_PRODUCT_ID_TYPE_ID": true
11191121
}
11201122
}
1121-
}
1123+
}

app/code/Magento/CatalogImportExport/Model/Import/Product.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Magento\CatalogImportExport\Model\Import\Product\MediaGalleryProcessor;
1111
use Magento\CatalogImportExport\Model\Import\Product\ImageTypeProcessor;
1212
use Magento\CatalogImportExport\Model\Import\Product\RowValidatorInterface as ValidatorInterface;
13+
use Magento\CatalogInventory\Api\Data\StockItemInterface;
1314
use Magento\CatalogImportExport\Model\StockItemImporterInterface;
1415
use Magento\Framework\App\Filesystem\DirectoryList;
1516
use Magento\Framework\App\ObjectManager;
@@ -2618,7 +2619,10 @@ private function _setStockUseConfigFieldsValues($rowData)
26182619
{
26192620
$useConfigFields = [];
26202621
foreach ($rowData as $key => $value) {
2621-
$useConfigName = self::INVENTORY_USE_CONFIG_PREFIX . $key;
2622+
$useConfigName = $key === StockItemInterface::ENABLE_QTY_INCREMENTS
2623+
? StockItemInterface::USE_CONFIG_ENABLE_QTY_INC
2624+
: self::INVENTORY_USE_CONFIG_PREFIX . $key;
2625+
26222626
if (isset($this->defaultStockData[$key])
26232627
&& isset($this->defaultStockData[$useConfigName])
26242628
&& !empty($value)
@@ -2715,7 +2719,12 @@ protected function checkUrlKeyDuplicates()
27152719
);
27162720
foreach ($urlKeyDuplicates as $entityData) {
27172721
$rowNum = $this->rowNumbers[$entityData['store_id']][$entityData['request_path']];
2718-
$this->addRowError(ValidatorInterface::ERROR_DUPLICATE_URL_KEY, $rowNum);
2722+
$message = sprintf(
2723+
$this->retrieveMessageTemplate(ValidatorInterface::ERROR_DUPLICATE_URL_KEY),
2724+
$entityData['request_path'],
2725+
$entityData['sku']
2726+
);
2727+
$this->addRowError(ValidatorInterface::ERROR_DUPLICATE_URL_KEY, $rowNum, 'url_key', $message);
27192728
}
27202729
}
27212730
}

app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Widget/CategoriesJson.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __construct(Context $context, Registry $coreRegistry)
3232
/**
3333
* Initialize category object in registry
3434
*
35-
* @return Category
35+
* @return Category|bool
3636
*/
3737
protected function _initCategory()
3838
{

app/code/Magento/CatalogRule/etc/db_schema.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
<constraint xsi:type="primary" name="PRIMARY">
6161
<column name="rule_product_id"/>
6262
</constraint>
63-
<constraint xsi:type="unique" name="IDX_EAA51B56FF092A0DCB795D1CEF812B7B">
63+
<constraint xsi:type="unique" name="UNQ_EAA51B56FF092A0DCB795D1CEF812B7B">
6464
<column name="rule_id"/>
6565
<column name="from_time"/>
6666
<column name="to_time"/>
@@ -198,7 +198,7 @@
198198
<constraint xsi:type="primary" name="PRIMARY">
199199
<column name="rule_product_id"/>
200200
</constraint>
201-
<constraint xsi:type="unique" name="IDX_EAA51B56FF092A0DCB795D1CEF812B7B">
201+
<constraint xsi:type="unique" name="UNQ_EAA51B56FF092A0DCB795D1CEF812B7B">
202202
<column name="rule_id"/>
203203
<column name="from_time"/>
204204
<column name="to_time"/>

0 commit comments

Comments
 (0)