Skip to content

Commit 01f3185

Browse files
author
Gabriel da Gama
authored
Merge branch '2.4-develop' into fix-missing-vatid-at-multishipping-registration-page
2 parents e5444ad + 6e0c28c commit 01f3185

File tree

28 files changed

+733
-71
lines changed

28 files changed

+733
-71
lines changed

app/code/Magento/Catalog/Observer/CategoryProductIndexer.php

+13-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace Magento\Catalog\Observer;
99

1010
use Magento\Catalog\Model\Indexer\Category\Product\Processor;
11+
use Magento\Catalog\Model\Indexer\Category\Flat\State as FlatState;
1112
use Magento\Framework\Event\Observer;
1213
use Magento\Framework\Event\ObserverInterface;
1314

@@ -21,12 +22,21 @@ class CategoryProductIndexer implements ObserverInterface
2122
*/
2223
private $processor;
2324

25+
/**
26+
* @var FlatState
27+
*/
28+
private $flatState;
29+
2430
/**
2531
* @param Processor $processor
32+
* @param FlatState $flatState
2633
*/
27-
public function __construct(Processor $processor)
28-
{
34+
public function __construct(
35+
Processor $processor,
36+
FlatState $flatState
37+
) {
2938
$this->processor = $processor;
39+
$this->flatState = $flatState;
3040
}
3141

3242
/**
@@ -35,7 +45,7 @@ public function __construct(Processor $processor)
3545
public function execute(Observer $observer): void
3646
{
3747
$productIds = $observer->getEvent()->getProductIds();
38-
if (!empty($productIds) && $this->processor->isIndexerScheduled()) {
48+
if (!empty($productIds) && $this->processor->isIndexerScheduled() && $this->flatState->isFlatEnabled()) {
3949
$this->processor->markIndexerAsInvalid();
4050
}
4151
}

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminClickMassUpdateProductAttributesActionGroup.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
</annotations>
1515
<click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickDropdown"/>
1616
<click selector="{{AdminProductGridSection.bulkActionOption('Update attributes')}}" stepKey="clickOption"/>
17-
<seeInCurrentUrl url="catalog/product_action_attribute/edit/" stepKey="seeInUrl"/>
17+
<waitForPageLoad stepKey="waitForBulkUpdatePage"/>
18+
<seeInCurrentUrl url="{{ProductAttributesEditPage.url}}" stepKey="seeInUrl"/>
1819
</actionGroup>
1920
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminMassUpdateProductQtyIncrementsActionGroup">
12+
<arguments>
13+
<argument name="enableQtyIncrements" type="string" defaultValue="Yes"/>
14+
<argument name="qtyIncrements" type="string" defaultValue="2"/>
15+
</arguments>
16+
<click selector="{{AdminUpdateAttributesAdvancedInventorySection.inventory}}" stepKey="openInventoryTab"/>
17+
<checkOption selector="{{AdminUpdateAttributesAdvancedInventorySection.changeEnableQtyIncrements}}" stepKey="changeEnableQtyIncrements"/>
18+
<uncheckOption selector="{{AdminUpdateAttributesAdvancedInventorySection.useConfigEnableQtyIncrements}}" stepKey="uncheckUseConfigEnableQtyIncrements"/>
19+
<selectOption selector="{{AdminUpdateAttributesAdvancedInventorySection.enableQtyIncrements}}" userInput="{{enableQtyIncrements}}" stepKey="setEnableQtyIncrements"/>
20+
<checkOption selector="{{AdminUpdateAttributesAdvancedInventorySection.changeQtyIncrements}}" stepKey="changeQtyIncrements"/>
21+
<uncheckOption selector="{{AdminUpdateAttributesAdvancedInventorySection.useConfigQtyIncrements}}" stepKey="uncheckUseConfigQtyIncrements"/>
22+
<fillField selector="{{AdminUpdateAttributesAdvancedInventorySection.qtyIncrements}}" userInput="{{qtyIncrements}}" stepKey="setQtyIncrements"/>
23+
<click selector="{{AdminUpdateAttributesSection.saveButton}}" stepKey="save"/>
24+
<waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitVisibleSuccessMessage"/>
25+
<see selector="{{AdminMessagesSection.success}}" userInput="Message is added to queue" stepKey="seeSuccessMessage"/>
26+
</actionGroup>
27+
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Section/AdminUpdateAttributesSection/AdminUpdateAttributesAdvancedInventorySection.xml

+6
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,11 @@
1313
<element name="qty" type="input" selector="#inventory_qty"/>
1414
<element name="changeStockAvailability" type="checkbox" selector="#inventory_stock_availability_checkbox"/>
1515
<element name="stockAvailability" type="select" selector="//select[@name='inventory[is_in_stock]']"/>
16+
<element name="enableQtyIncrements" type="select" selector="#inventory_enable_qty_increments"/>
17+
<element name="useConfigEnableQtyIncrements" type="checkbox" selector="#inventory_use_config_enable_qty_increments"/>
18+
<element name="changeEnableQtyIncrements" type="checkbox" selector="#inventory_enable_qty_increments_checkbox"/>
19+
<element name="qtyIncrements" type="input" selector="#inventory_qty_increments"/>
20+
<element name="useConfigQtyIncrements" type="checkbox" selector="#inventory_use_config_qty_increments"/>
21+
<element name="changeQtyIncrements" type="checkbox" selector="#inventory_qty_increments_checkbox"/>
1622
</section>
1723
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminMassUpdateProductQtyIncrementsTest">
12+
<annotations>
13+
<features value="Catalog"/>
14+
<stories value="Mass update advanced inventory attributes"/>
15+
<title value="Admin should be able to mass update product qty increments"/>
16+
<description value="Admin should be able to mass update product qty increments"/>
17+
<severity value="AVERAGE"/>
18+
<testCaseId value="MC-39359"/>
19+
<useCaseId value="MC-36787"/>
20+
<group value="catalog"/>
21+
<group value="CatalogInventory"/>
22+
<group value="product_attributes"/>
23+
</annotations>
24+
<before>
25+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
26+
<createData entity="_defaultCategory" stepKey="createCategory"/>
27+
<createData entity="ApiSimpleProduct" stepKey="createProductOne">
28+
<requiredEntity createDataKey="createCategory"/>
29+
</createData>
30+
<createData entity="ApiSimpleProduct" stepKey="createProductTwo">
31+
<requiredEntity createDataKey="createCategory"/>
32+
</createData>
33+
</before>
34+
<after>
35+
<deleteData createDataKey="createProductOne" stepKey="deleteProductOne"/>
36+
<deleteData createDataKey="createProductTwo" stepKey="deleteProductTwo"/>
37+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
38+
<actionGroup ref="ClearProductsFilterActionGroup" stepKey="clearProductFilter"/>
39+
<actionGroup ref="AdminLogoutActionGroup" stepKey="amOnLogoutPage"/>
40+
</after>
41+
<!-- Navigate to products list page and select created products -->
42+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndex"/>
43+
<actionGroup ref="SearchProductGridByKeyword2ActionGroup" stepKey="searchByKeyword">
44+
<argument name="keyword" value="api-simple-product"/>
45+
</actionGroup>
46+
<actionGroup ref="SortProductsByIdDescendingActionGroup" stepKey="sortProductsByIdDescending"/>
47+
<click selector="{{AdminProductGridSection.productGridCheckboxOnRow('1')}}" stepKey="clickCheckbox1"/>
48+
<click selector="{{AdminProductGridSection.productGridCheckboxOnRow('2')}}" stepKey="clickCheckbox2"/>
49+
<!-- Mass update qty increments -->
50+
<actionGroup ref="AdminClickMassUpdateProductAttributesActionGroup" stepKey="clickMassUpdateProductAttributes"/>
51+
<actionGroup ref="AdminMassUpdateProductQtyIncrementsActionGroup" stepKey="updateQtyIncrements">
52+
<argument name="enableQtyIncrements" value="Yes"/>
53+
<argument name="qtyIncrements" value="2"/>
54+
</actionGroup>
55+
<!-- Start message queue for product attribute consumer -->
56+
<actionGroup ref="CliConsumerStartActionGroup" stepKey="startMessageQueue">
57+
<argument name="consumerName" value="{{AdminProductAttributeUpdateMessageConsumerData.consumerName}}"/>
58+
<argument name="maxMessages" value="{{AdminProductAttributeUpdateMessageConsumerData.messageLimit}}"/>
59+
</actionGroup>
60+
<!-- Open first product for edit and assert that qty increment is updated -->
61+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="goToProductEditPage">
62+
<argument name="productId" value="$createProductOne.id$"/>
63+
</actionGroup>
64+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
65+
<actionGroup ref="AdminClickOnAdvancedInventoryLinkActionGroup" stepKey="clickOnAdvancedInventoryLink"/>
66+
<seeOptionIsSelected selector="{{AdminProductFormAdvancedInventorySection.enableQtyIncrements}}" userInput="Yes" stepKey="assertEnableQtyIncrementsValue"/>
67+
<dontSeeCheckboxIsChecked selector="{{AdminProductFormAdvancedInventorySection.enableQtyIncrementsUseConfigSettings}}" stepKey="assertEnableQtyIncrementsUseConfigSettings"/>
68+
<seeInField selector="{{AdminProductFormAdvancedInventorySection.qtyIncrements}}" userInput="2" stepKey="assertQtyIncrementsValue"/>
69+
<dontSeeCheckboxIsChecked selector="{{AdminProductFormAdvancedInventorySection.qtyIncrementsUseConfigSettings}}" stepKey="assertQtyIncrementsUseConfigSettings"/>
70+
<!-- Open second product for edit and assert that qty increment is updated -->
71+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="goToProductEditPage2">
72+
<argument name="productId" value="$createProductTwo.id$"/>
73+
</actionGroup>
74+
<waitForPageLoad stepKey="waitForProductPageLoad2"/>
75+
<actionGroup ref="AdminClickOnAdvancedInventoryLinkActionGroup" stepKey="clickOnAdvancedInventoryLink2"/>
76+
<seeOptionIsSelected selector="{{AdminProductFormAdvancedInventorySection.enableQtyIncrements}}" userInput="Yes" stepKey="assertEnableQtyIncrementsValue2"/>
77+
<dontSeeCheckboxIsChecked selector="{{AdminProductFormAdvancedInventorySection.enableQtyIncrementsUseConfigSettings}}" stepKey="assertEnableQtyIncrementsUseConfigSettings2"/>
78+
<seeInField selector="{{AdminProductFormAdvancedInventorySection.qtyIncrements}}" userInput="2" stepKey="assertQtyIncrementsValue2"/>
79+
<dontSeeCheckboxIsChecked selector="{{AdminProductFormAdvancedInventorySection.qtyIncrementsUseConfigSettings}}" stepKey="assertQtyIncrementsUseConfigSettings2"/>
80+
</test>
81+
</tests>

app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/inventory.phtml

+1-1
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ if (!is_numeric($defaultMinSaleQty)) {
334334
</div>
335335
<div class="field choice">
336336
<input type="checkbox" id="inventory_use_config_enable_qty_increments"
337-
name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[use_config_enable_qty_increments]"
337+
name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[use_config_enable_qty_inc]"
338338
value="1"
339339
data-role="toggle-editability"
340340
checked="checked"

app/code/Magento/CatalogInventory/Plugin/MassUpdateProductAttribute.php

+11-1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@ class MassUpdateProductAttribute
6464
* @var ProductRepositoryInterface
6565
*/
6666
private $productRepository;
67+
68+
/**
69+
* @var array
70+
*/
71+
private $useConfigFieldMap = [
72+
'enable_qty_increments' => 'use_config_enable_qty_inc'
73+
];
74+
6775
/**
6876
* @param \Magento\CatalogInventory\Model\Indexer\Stock\Processor $stockIndexerProcessor
6977
* @param \Magento\Framework\Api\DataObjectHelper $dataObjectHelper
@@ -146,7 +154,9 @@ private function addConfigSettings($inventoryData)
146154
{
147155
$options = $this->stockConfiguration->getConfigItemOptions();
148156
foreach ($options as $option) {
149-
$useConfig = 'use_config_' . $option;
157+
$useConfig = isset($this->useConfigFieldMap[$option])
158+
? $this->useConfigFieldMap[$option]
159+
: 'use_config_' . $option;
150160
if (isset($inventoryData[$option]) && !isset($inventoryData[$useConfig])) {
151161
$inventoryData[$useConfig] = 0;
152162
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminUpdateCustomerWebsiteInCustomerInformationPageActionGroup">
12+
<annotations>
13+
<description>Update customer website in customer information page</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="websiteName" defaultValue="{{_defaultWebsite.name}}" type="string"/>
17+
</arguments>
18+
<selectOption selector="{{AdminCustomerAccountInformationSection.associateToWebsite}}" userInput="{{websiteName}}" stepKey="changeWebsite"/>
19+
</actionGroup>
20+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminChangeCustomerAssociatedWebsiteTest">
12+
<annotations>
13+
<features value="Customer"/>
14+
<title value="Admin should be able to change customer associated website ID"/>
15+
<description value="Admin should be able to change customer associated website ID"/>
16+
<severity value="AVERAGE"/>
17+
<useCaseId value="MC-38913"/>
18+
<testCaseId value="MC-39764"/>
19+
<stories value="Customer Edit"/>
20+
<group value="customer"/>
21+
</annotations>
22+
<before>
23+
<!--Login to admin-->
24+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
25+
<!--Create second website-->
26+
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createWebsite">
27+
<argument name="newWebsiteName" value="{{NewWebSiteData.name}}"/>
28+
<argument name="websiteCode" value="{{NewWebSiteData.code}}"/>
29+
</actionGroup>
30+
<!--Create store group and associate it to second website-->
31+
<actionGroup ref="AdminCreateNewStoreGroupActionGroup" stepKey="createNewStore">
32+
<argument name="website" value="{{NewWebSiteData.name}}"/>
33+
<argument name="storeGroupName" value="{{NewStoreData.name}}"/>
34+
<argument name="storeGroupCode" value="{{NewStoreData.code}}"/>
35+
</actionGroup>
36+
<!--Create store view and associate it to second store group-->
37+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createCustomStoreView">
38+
<argument name="StoreGroup" value="NewStoreData"/>
39+
<argument name="customStore" value="NewStoreViewData"/>
40+
</actionGroup>
41+
<!--Create customer-->
42+
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
43+
</before>
44+
<after>
45+
<!--Delete customer-->
46+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
47+
<!--Delete custom website-->
48+
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite">
49+
<argument name="websiteName" value="{{NewWebSiteData.name}}"/>
50+
</actionGroup>
51+
<!--Logout from admin-->
52+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/>
53+
</after>
54+
<!--Open customer edit page-->
55+
<actionGroup ref="AdminOpenCustomerEditPageActionGroup" stepKey="openCustomerEditPage">
56+
<argument name="customerId" value="$createCustomer.id$"/>
57+
</actionGroup>
58+
<!--Navigate to "Account Information" tab-->
59+
<actionGroup ref="AdminOpenAccountInformationTabFromCustomerEditPageActionGroup" stepKey="openAccountInformationEditPage"/>
60+
<!--Verify that "Main Website" is selected in website selector-->
61+
<seeOptionIsSelected selector="{{AdminCustomerAccountInformationSection.associateToWebsite}}" userInput="{{_defaultWebsite.name}}" stepKey="assertThatMainWebsiteIsSelected"/>
62+
<!--Change customer website to "Second Website"-->
63+
<actionGroup ref="AdminUpdateCustomerWebsiteInCustomerInformationPageActionGroup" stepKey="updateCustomerWebsite">
64+
<argument name="websiteName" value="{{NewWebSiteData.name}}"/>
65+
</actionGroup>
66+
<!--Verify that changes are saved successfully-->
67+
<actionGroup ref="AdminSaveCustomerAndAssertSuccessMessage" stepKey="assertThatChangesAreSavedSuccessfully"/>
68+
<!--Open customer edit page-->
69+
<actionGroup ref="AdminOpenCustomerEditPageActionGroup" stepKey="openCustomerEditPage2">
70+
<argument name="customerId" value="$createCustomer.id$"/>
71+
</actionGroup>
72+
<!--Navigate to "Account Information" tab-->
73+
<actionGroup ref="AdminOpenAccountInformationTabFromCustomerEditPageActionGroup" stepKey="openAccountInformationEditPage2"/>
74+
<!--Verify that "Second Website" is selected in website selector-->
75+
<seeOptionIsSelected selector="{{AdminCustomerAccountInformationSection.associateToWebsite}}" userInput="{{NewWebSiteData.name}}" stepKey="assertThatSecondWebsiteIsSelected"/>
76+
</test>
77+
</tests>

app/code/Magento/MediaStorage/Service/ImageResize.php

+8-3
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,18 @@ public function resizeFromThemes(array $themes = null): Generator
195195
$this->fileStorageDatabase->saveFileToFilesystem($mediastoragefilename);
196196
}
197197
if ($this->mediaDirectory->isFile($originalImagePath)) {
198-
foreach ($viewImages as $viewImage) {
199-
$this->resize($viewImage, $originalImagePath, $originalImageName);
198+
try {
199+
foreach ($viewImages as $viewImage) {
200+
$this->resize($viewImage, $originalImagePath, $originalImageName);
201+
}
202+
} catch (\Exception $e) {
203+
$error = $e->getMessage();
200204
}
201205
} else {
202206
$error = __('Cannot resize image "%1" - original image not found', $originalImagePath);
203207
}
204208

205-
yield ['filename' => $originalImageName, 'error' => $error] => $count;
209+
yield ['filename' => $originalImageName, 'error' => (string) $error] => $count;
206210
}
207211
}
208212

@@ -276,6 +280,7 @@ private function getUniqueImageIndex(array $imageData): string
276280
* @param string $originalImagePath
277281
* @param array $imageParams
278282
* @return Image
283+
* @throws \InvalidArgumentException
279284
*/
280285
private function makeImage(string $originalImagePath, array $imageParams): Image
281286
{

0 commit comments

Comments
 (0)