Skip to content

Commit 13b966a

Browse files
authored
Merge branch '2.4-develop' into fix-missing-vatid-at-multishipping-registration-page
2 parents d01133d + 05a3e7e commit 13b966a

File tree

129 files changed

+1204
-319
lines changed

Some content is hidden

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

129 files changed

+1204
-319
lines changed

app/code/Magento/AdvancedPricingImportExport/Model/Export/AdvancedPricing.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,8 @@ private function fetchTierPrices(array $productIds): array
486486
)
487487
->where(
488488
'ap.' . $productEntityLinkField . ' IN (?)',
489-
$productIds
489+
$productIds,
490+
\Zend_Db::INT_TYPE
490491
);
491492

492493
if ($priceFromFilter !== null) {

app/code/Magento/Backend/App/Area/FrontNameResolver.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,13 @@ public function isHostBackend()
123123
if ($this->scopeConfig->getValue(self::XML_PATH_USE_CUSTOM_ADMIN_URL, ScopeInterface::SCOPE_STORE)) {
124124
$backendUrl = $this->scopeConfig->getValue(self::XML_PATH_CUSTOM_ADMIN_URL, ScopeInterface::SCOPE_STORE);
125125
} else {
126-
$backendUrl = $this->scopeConfig->getValue(Store::XML_PATH_UNSECURE_BASE_URL, ScopeInterface::SCOPE_STORE);
126+
$backendUrl = $this->config->getValue(Store::XML_PATH_UNSECURE_BASE_URL);
127+
if ($backendUrl === null) {
128+
$backendUrl = $this->scopeConfig->getValue(
129+
Store::XML_PATH_UNSECURE_BASE_URL,
130+
ScopeInterface::SCOPE_STORE
131+
);
132+
}
127133
}
128134
$host = $this->request->getServer('HTTP_HOST', '');
129135
return stripos($this->getHostWithPort($backendUrl), (string) $host) !== false;

app/code/Magento/Backend/Block/Widget/Button.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
*/
66
namespace Magento\Backend\Block\Widget;
77

8+
use Magento\Backend\Block\Template\Context;
89
use Magento\Framework\App\ObjectManager;
910
use Magento\Framework\Math\Random;
10-
use Magento\Backend\Block\Template\Context;
1111
use Magento\Framework\View\Helper\SecureHtmlRenderer;
1212

1313
/**
@@ -125,6 +125,9 @@ protected function _prepareAttributes($title, $classes, $disabled)
125125
'value' => $this->getValue(),
126126
'disabled' => $disabled,
127127
];
128+
if ($this->hasData('onclick_attribute')) {
129+
$attributes['onclick'] = $this->getData('onclick_attribute');
130+
}
128131
if ($this->hasData('backend_button_widget_hook_id')) {
129132
$attributes['backend-button-widget-hook-id'] = $this->getData('backend_button_widget_hook_id');
130133
}

app/code/Magento/Backend/Test/Unit/Block/Widget/ButtonTest.php

+12
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,16 @@ public function getAttributesHtmlDataProvider()
9494
]
9595
];
9696
}
97+
98+
/**
99+
* Verifies ability of adding button onclick attribute
100+
*
101+
* @return void
102+
*/
103+
public function testOnClickAttribute(): void
104+
{
105+
$this->_blockMock->setData(['onclick_attribute' => 'value']);
106+
$attributes = $this->_blockMock->getAttributesHtml();
107+
$this->assertStringContainsString('onclick', $attributes);
108+
}
97109
}

app/code/Magento/Bundle/Model/ResourceModel/Selection.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ public function getParentIdsByChild($childId)
145145
['e.entity_id as parent_product_id']
146146
)->where(
147147
$this->getMainTable() . '.product_id IN(?)',
148-
$childId
148+
$childId,
149+
\Zend_Db::INT_TYPE
149150
);
150151

151152
return $connection->fetchCol($select);

app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundlePlaceOrderWithVirtualAndSimpleChildrenTest.xml

+1-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@
4848
<argument name="productId" value="$createFixedBundleProduct.id$"/>
4949
</actionGroup>
5050
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/>
51-
<!--Perform reindex and flush cache-->
52-
<actionGroup ref="AdminReindexAndFlushCache" stepKey="reindexAndFlushCache"/>
51+
<comment userInput="Adding the comment to replace AdminReindexAndFlushCache action group ('indexer:reindex', 'cache:flush' commands) for preserving Backward Compatibility" stepKey="reindexAndFlushCache"/>
5352
</before>
5453
<after>
5554
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProductForBundleItem"/>

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

+8-5
Original file line numberDiff line numberDiff line change
@@ -465,10 +465,11 @@ protected function _copyRelationIndexData($parentIds, $excludeIds = null)
465465
[]
466466
)->where(
467467
'e.entity_id IN(?)',
468-
$parentIds
468+
$parentIds,
469+
\Zend_Db::INT_TYPE
469470
);
470471
if (!empty($excludeIds)) {
471-
$select->where('child_id NOT IN(?)', $excludeIds);
472+
$select->where('child_id NOT IN(?)', $excludeIds, \Zend_Db::INT_TYPE);
472473
}
473474

474475
$children = $this->getConnection()->fetchCol($select);
@@ -479,7 +480,8 @@ protected function _copyRelationIndexData($parentIds, $excludeIds = null)
479480
$this->getIndexTargetTableByDimension($dimensions)
480481
)->where(
481482
'entity_id IN(?)',
482-
$children
483+
$children,
484+
\Zend_Db::INT_TYPE
483485
);
484486
$query = $select->insertFromSelect($this->_defaultIndexerResource->getIdxTable(), [], false);
485487
$this->getConnection()->query($query);
@@ -578,13 +580,14 @@ private function getParentProductsTypes(array $productsIds)
578580
['e.entity_id as parent_id', 'type_id']
579581
)->where(
580582
'l.child_id IN(?)',
581-
$productsIds
583+
$productsIds,
584+
\Zend_Db::INT_TYPE
582585
);
583586
$pairs = $this->getConnection()->fetchPairs($select);
584587

585588
$byType = [];
586589
foreach ($pairs as $productId => $productType) {
587-
$byType[$productType][$productId] = $productId;
590+
$byType[$productType][$productId] = (int)$productId;
588591
}
589592

590593
return $byType;

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ public function getTierPrices($product)
379379
if (array_key_exists('website_price', $price)) {
380380
$value = $price['website_price'];
381381
} else {
382-
$value = $price['price'];
382+
$value = $price['price'] ?? 0;
383383
}
384384
$tierPrice->setValue($value);
385385
$tierPrice->setQty($price['price_qty']);

app/code/Magento/Catalog/Model/ResourceModel/Attribute.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ protected function _clearUselessAttributeValues(\Magento\Framework\Model\Abstrac
101101
$attributeStoreIds = array_keys($this->_storeManager->getStores());
102102
if (!empty($attributeStoreIds)) {
103103
$delCondition = [
104-
'attribute_id = ?' => $object->getId(),
104+
'attribute_id = ?' => (int)$object->getId(),
105105
'store_id IN(?)' => $attributeStoreIds,
106106
];
107107
$this->getConnection()->delete($object->getBackendTable(), $delCondition);

app/code/Magento/Catalog/Model/ResourceModel/Category.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,8 @@ public function verifyIds(array $ids)
575575
'entity_id'
576576
)->where(
577577
'entity_id IN(?)',
578-
$ids
578+
$ids,
579+
\Zend_Db::INT_TYPE
579580
);
580581

581582
return $this->getConnection()->fetchCol($select);

app/code/Magento/Catalog/Model/ResourceModel/Url.php

+14-8
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,8 @@ protected function _getCategoryAttribute($attributeCode, $categoryIds, $storeId)
204204
['value' => $attributeCode, 'entity_id' => 'entity_id']
205205
)->where(
206206
'entity_id IN(?)',
207-
$categoryIds
207+
$categoryIds,
208+
\Zend_Db::INT_TYPE
208209
);
209210
} elseif ($this->_categoryAttributes[$attributeCode]['is_global'] || $storeId == 0) {
210211
$select->from(
@@ -216,7 +217,8 @@ protected function _getCategoryAttribute($attributeCode, $categoryIds, $storeId)
216217
['value']
217218
)->where(
218219
"t1.{$identifierFiled} IN(?)",
219-
$categoryIds
220+
$categoryIds,
221+
\Zend_Db::INT_TYPE
220222
)->where(
221223
'e.attribute_id = :attribute_id'
222224
)->where(
@@ -245,7 +247,8 @@ protected function _getCategoryAttribute($attributeCode, $categoryIds, $storeId)
245247
't1.attribute_id = :attribute_id'
246248
)->where(
247249
"e.entity_id IN(?)",
248-
$categoryIds
250+
$categoryIds,
251+
\Zend_Db::INT_TYPE
249252
)->group('e.entity_id');
250253

251254
$bind['attribute_id'] = $this->_categoryAttributes[$attributeCode]['attribute_id'];
@@ -308,7 +311,8 @@ public function _getProductAttribute($attributeCode, $productIds, $storeId)
308311
0
309312
)->where(
310313
'entity_id IN(?)',
311-
$productIds
314+
$productIds,
315+
\Zend_Db::INT_TYPE
312316
);
313317
} else {
314318
$valueExpr = $connection->getCheckSql('t2.value_id > 0', 't2.value', 't1.value');
@@ -326,7 +330,8 @@ public function _getProductAttribute($attributeCode, $productIds, $storeId)
326330
't1.attribute_id = :attribute_id'
327331
)->where(
328332
't1.entity_id IN(?)',
329-
$productIds
333+
$productIds,
334+
\Zend_Db::INT_TYPE
330335
);
331336
$bind['store_id'] = $storeId;
332337
}
@@ -430,7 +435,7 @@ protected function _getCategories($categoryIds, $storeId = null, $path = null)
430435

431436
// Prepare variables for checking whether categories belong to store
432437
if ($path === null) {
433-
$select->where('main_table.entity_id IN(?)', $categoryIds);
438+
$select->where('main_table.entity_id IN(?)', $categoryIds, \Zend_Db::INT_TYPE);
434439
} else {
435440
// Ensure that path ends with '/', otherwise we can get wrong results - e.g. $path = '1/2' will get '1/20'
436441
if (substr($path, -1) != '/') {
@@ -569,7 +574,7 @@ protected function _getProducts($productIds, $storeId, $entityId, &$lastEntityId
569574
$this->_productLimit
570575
);
571576
if ($productIds !== null) {
572-
$select->where('e.entity_id IN(?)', $productIds);
577+
$select->where('e.entity_id IN(?)', $productIds, \Zend_Db::INT_TYPE);
573578
}
574579

575580
$rowSet = $connection->fetchAll($select, $bind);
@@ -591,7 +596,8 @@ protected function _getProducts($productIds, $storeId, $entityId, &$lastEntityId
591596
['product_id', 'category_id']
592597
)->where(
593598
'product_id IN(?)',
594-
array_keys($products)
599+
array_keys($products),
600+
\Zend_Db::INT_TYPE
595601
);
596602
$categories = $connection->fetchAll($select);
597603
foreach ($categories as $category) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminDeleteAllProductAttributesFilteredByCodeActionGroup">
11+
<annotations>
12+
<description>Open product attributes grid filter it by attribute code and delete all found attributes one by one.</description>
13+
</annotations>
14+
<arguments>
15+
<argument name="codeFilter" type="string" defaultValue="fake-code"/>
16+
</arguments>
17+
18+
<amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/>
19+
<!-- It sometimes is loading too long for default 10s -->
20+
<waitForPageLoad time="60" stepKey="waitForPageFullyLoaded"/>
21+
<click selector="{{AdminProductAttributeGridSection.ResetFilter}}" stepKey="clearExistingFilters"/>
22+
<fillField selector="{{AdminProductAttributeGridSection.FilterByAttributeCode}}" userInput="{{codeFilter}}" stepKey="fillAttributeCodeFilterField"/>
23+
<click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="applyGridFilter"/>
24+
<helper class="\Magento\Catalog\Test\Mftf\Helper\CatalogHelper" method="deleteAllProductAttributesOneByOne" stepKey="deleteAllProductAttributesOneByOne">
25+
<argument name="notEmptyRow">{{AdminDataGridTableSection.firstNotEmptyRow2}}</argument>
26+
<argument name="modalAcceptButton">{{AdminConfirmationModalSection.ok}}</argument>
27+
<argument name="deleteButton">{{AdminMainActionsSection.delete}}</argument>
28+
<argument name="successMessageContainer">{{AdminMessagesSection.success}}</argument>
29+
<argument name="successMessage">You deleted the product attribute.</argument>
30+
</helper>
31+
<waitForElementVisible selector="{{AdminDataGridTableSection.dataGridEmpty}}" stepKey="waitDataGridEmptyMessageAppears"/>
32+
<see selector="{{AdminDataGridTableSection.dataGridEmpty}}" userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage"/>
33+
<click selector="{{AdminProductAttributeGridSection.ResetFilter}}" stepKey="clearExistingFiltersAgain"/>
34+
</actionGroup>
35+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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\Catalog\Test\Mftf\Helper;
9+
10+
use Facebook\WebDriver\Remote\RemoteWebDriver as FacebookWebDriver;
11+
use Facebook\WebDriver\WebDriverBy;
12+
use Magento\FunctionalTestingFramework\Helper\Helper;
13+
use Magento\FunctionalTestingFramework\Module\MagentoWebDriver;
14+
15+
/**
16+
* Class for MFTF helpers for Catalog module.
17+
*/
18+
class CatalogHelper extends Helper
19+
{
20+
/**
21+
* Delete all product attributes one by one.
22+
*
23+
* @param string $notEmptyRow
24+
* @param string $modalAcceptButton
25+
* @param string $deleteButton
26+
* @param string $successMessageContainer
27+
* @param string $successMessage
28+
* @retrun void
29+
*/
30+
public function deleteAllProductAttributesOneByOne(
31+
string $notEmptyRow,
32+
string $modalAcceptButton,
33+
string $deleteButton,
34+
string $successMessageContainer,
35+
string $successMessage
36+
): void {
37+
try {
38+
/** @var MagentoWebDriver $webDriver */
39+
$magentoWebDriver = $this->getModule('\Magento\FunctionalTestingFramework\Module\MagentoWebDriver');
40+
/** @var FacebookWebDriver $webDriver */
41+
$webDriver = $magentoWebDriver->webDriver;
42+
$gridRows = $webDriver->findElements(WebDriverBy::cssSelector($notEmptyRow));
43+
while (!empty($gridRows)) {
44+
$gridRows[0]->click();
45+
$magentoWebDriver->waitForPageLoad(30);
46+
$magentoWebDriver->click($deleteButton);
47+
$magentoWebDriver->waitForPageLoad(30);
48+
$magentoWebDriver->waitForElementVisible($modalAcceptButton);
49+
$magentoWebDriver->click($modalAcceptButton);
50+
$magentoWebDriver->waitForPageLoad(60);
51+
$magentoWebDriver->waitForElementVisible($successMessageContainer);
52+
$magentoWebDriver->see($successMessage, $successMessageContainer);
53+
$gridRows = $webDriver->findElements(WebDriverBy::cssSelector($notEmptyRow));
54+
}
55+
} catch (\Exception $e) {
56+
$this->fail($e->getMessage());
57+
}
58+
}
59+
}

app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsVisibleInCategoryTest.xml

+1-4
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,7 @@
6969
</actionGroup>
7070
<actionGroup ref="AdminSubmitAdvancedInventoryFormActionGroup" stepKey="clickDoneButton"/>
7171
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/>
72-
<!--Run re-index task -->
73-
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
74-
<argument name="indices" value=""/>
75-
</actionGroup>
72+
<comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/>
7673

7774
<!--Verify product is visible in category front page -->
7875
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="goToHomepage"/>

app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithAnchorFieldTest.xml

+1-4
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,7 @@
7070
<argument name="targetPath" value="catalog/category/view/id/{$categoryId}"/>
7171
</actionGroup>
7272

73-
<!--Clear cache and reindex-->
74-
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
75-
<argument name="indices" value=""/>
76-
</actionGroup>
73+
<comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/>
7774
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
7875
<argument name="tags" value=""/>
7976
</actionGroup>

app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveFlatCategoryAndUpdateAsInactiveTest.xml

+3-11
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@
3030
<actionGroup ref="CreateStoreViewActionGroup" stepKey="createCustomStoreViewFr">
3131
<argument name="storeView" value="customStoreFR"/>
3232
</actionGroup>
33-
<!--Run full reindex and clear caches -->
34-
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
35-
<argument name="indices" value=""/>
36-
</actionGroup>
33+
<comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/>
3734
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
3835
<argument name="tags" value=""/>
3936
</actionGroup>
@@ -47,9 +44,7 @@
4744
<after>
4845
<magentoCLI stepKey="setFlatCatalogCategory" command="config:set catalog/frontend/flat_catalog_category 0 "/>
4946
<magentoCLI stepKey="setIndexerMode" command="indexer:set-mode" arguments="realtime" />
50-
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="indexerReindex">
51-
<argument name="indices" value=""/>
52-
</actionGroup>
47+
<comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="indexerReindex"/>
5348
<deleteData stepKey="deleteCategory" createDataKey="createCategory"/>
5449
<actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreViewEn">
5550
<argument name="customStore" value="customStoreEN"/>
@@ -68,10 +63,7 @@
6863
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="seeSuccessMessage"/>
6964
<see selector="{{AdminCategoryContentSection.categoryPageTitle}}" userInput="{{CatNotActive.name}}" stepKey="seeUpdatedCategoryTitle"/>
7065
<dontSeeCheckboxIsChecked selector="{{AdminCategoryBasicFieldSection.enableCategoryLabel}}" stepKey="verifyInactiveCategory"/>
71-
<!--Run full reindex and clear caches -->
72-
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
73-
<argument name="indices" value=""/>
74-
</actionGroup>
66+
<comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/>
7567
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
7668
<argument name="tags" value=""/>
7769
</actionGroup>

0 commit comments

Comments
 (0)