Skip to content

Commit 03d0e13

Browse files
authored
Merge branch '2.4-develop' into feature/multishipping-item-subtotal
2 parents f1a6226 + 9772213 commit 03d0e13

File tree

225 files changed

+5702
-794
lines changed

Some content is hidden

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

225 files changed

+5702
-794
lines changed

.editorconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,9 @@ trim_trailing_whitespace = true
1010

1111
[*.md]
1212
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml,json}]
15+
indent_size = 2
16+
17+
[{composer, auth}.json]
18+
indent_size = 4

.github/stale.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Configuration for probot-stale - https://github.com/probot/stale
22

33
# Number of days of inactivity before an Issue or Pull Request becomes stale
4-
daysUntilStale: 76
4+
daysUntilStale: 76
55

66
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
77
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
@@ -18,7 +18,7 @@ exemptLabels:
1818
- "Progress: dev in progress"
1919
- "Progress: PR in progress"
2020
- "Progress: done"
21-
- "B2B: GraphQL"
21+
- "B2B: GraphQL"
2222
- "Progress: PR Created"
2323
- "PAP"
2424
- "Project: Login as Customer"

app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit.php

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ public function __construct(
4242
}
4343

4444
/**
45+
* Construct block
46+
*
4547
* @return void
4648
*/
4749
protected function _construct()
@@ -51,6 +53,14 @@ protected function _construct()
5153

5254
parent::_construct();
5355

56+
$this->buttonList->update('save', 'label', __('Save Attribute'));
57+
$this->buttonList->update('save', 'class', 'save primary');
58+
$this->buttonList->update(
59+
'save',
60+
'data_attribute',
61+
['mage-init' => ['button' => ['event' => 'save', 'target' => '#edit_form']]]
62+
);
63+
5464
if ($this->getRequest()->getParam('popup')) {
5565
$this->buttonList->remove('back');
5666
if ($this->getRequest()->getParam('product_tab') != 'variations') {
@@ -64,6 +74,8 @@ protected function _construct()
6474
100
6575
);
6676
}
77+
$this->buttonList->update('reset', 'level', 10);
78+
$this->buttonList->update('save', 'class', 'save action-secondary');
6779
} else {
6880
$this->addButton(
6981
'save_and_edit_button',
@@ -79,14 +91,6 @@ protected function _construct()
7991
);
8092
}
8193

82-
$this->buttonList->update('save', 'label', __('Save Attribute'));
83-
$this->buttonList->update('save', 'class', 'save primary');
84-
$this->buttonList->update(
85-
'save',
86-
'data_attribute',
87-
['mage-init' => ['button' => ['event' => 'save', 'target' => '#edit_form']]]
88-
);
89-
9094
$entityAttribute = $this->_coreRegistry->registry('entity_attribute');
9195
if (!$entityAttribute || !$entityAttribute->getIsUserDefined()) {
9296
$this->buttonList->remove('delete');
@@ -96,14 +100,14 @@ protected function _construct()
96100
}
97101

98102
/**
99-
* {@inheritdoc}
103+
* @inheritdoc
100104
*/
101105
public function addButton($buttonId, $data, $level = 0, $sortOrder = 0, $region = 'toolbar')
102106
{
103107
if ($this->getRequest()->getParam('popup')) {
104108
$region = 'header';
105109
}
106-
parent::addButton($buttonId, $data, $level, $sortOrder, $region);
110+
return parent::addButton($buttonId, $data, $level, $sortOrder, $region);
107111
}
108112

109113
/**

app/code/Magento/Catalog/Block/Product/ListProduct.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ public function getIdentities()
367367
$identities[] = $item->getIdentities();
368368
}
369369
}
370-
$identities = array_merge(...$identities);
370+
$identities = array_merge([], ...$identities);
371371

372372
return $identities;
373373
}

app/code/Magento/Catalog/Block/Product/ProductList/Related.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,11 @@ public function getItems()
143143
*/
144144
public function getIdentities()
145145
{
146-
$identities = [[]];
146+
$identities = [];
147147
foreach ($this->getItems() as $item) {
148148
$identities[] = $item->getIdentities();
149149
}
150-
return array_merge(...$identities);
150+
return array_merge([], ...$identities);
151151
}
152152

153153
/**

app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,10 @@ public function getItemLimit($type = '')
267267
*/
268268
public function getIdentities()
269269
{
270-
$identities = array_map(function (DataObject $item) {
271-
return $item->getIdentities();
272-
}, $this->getItems()) ?: [[]];
273-
274-
return array_merge(...$identities);
270+
$identities = [];
271+
foreach ($this->getItems() as $item) {
272+
$identities[] = $item->getIdentities();
273+
}
274+
return array_merge([], ...$identities);
275275
}
276276
}
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\Catalog\Model\Attribute\Backend;
10+
11+
use Magento\Catalog\Model\AbstractModel;
12+
use Magento\Catalog\Model\ResourceModel\Eav\Attribute;
13+
use Magento\Eav\Model\Entity\Attribute\Backend\DefaultBackend as ParentBackend;
14+
use Magento\Eav\Model\Entity\Attribute\Exception;
15+
use Magento\Framework\DataObject;
16+
use Magento\Framework\Exception\LocalizedException;
17+
use Magento\Framework\Validation\ValidationException;
18+
use Magento\Framework\Validator\HTML\WYSIWYGValidatorInterface;
19+
20+
/**
21+
* Default backend model for catalog attributes.
22+
*/
23+
class DefaultBackend extends ParentBackend
24+
{
25+
/**
26+
* @var WYSIWYGValidatorInterface
27+
*/
28+
private $wysiwygValidator;
29+
30+
/**
31+
* @param WYSIWYGValidatorInterface $wysiwygValidator
32+
*/
33+
public function __construct(WYSIWYGValidatorInterface $wysiwygValidator)
34+
{
35+
$this->wysiwygValidator = $wysiwygValidator;
36+
}
37+
38+
/**
39+
* Validate user HTML value.
40+
*
41+
* @param DataObject $object
42+
* @return void
43+
* @throws LocalizedException
44+
*/
45+
private function validateHtml(DataObject $object): void
46+
{
47+
$attribute = $this->getAttribute();
48+
$code = $attribute->getAttributeCode();
49+
if ($attribute instanceof Attribute && $attribute->getIsHtmlAllowedOnFront()) {
50+
$value = $object->getData($code);
51+
if ($value
52+
&& is_string($value)
53+
&& (!($object instanceof AbstractModel) || $object->getData($code) !== $object->getOrigData($code))
54+
) {
55+
try {
56+
$this->wysiwygValidator->validate($object->getData($code));
57+
} catch (ValidationException $exception) {
58+
$attributeException = new Exception(
59+
__(
60+
'Using restricted HTML elements for "%1". %2',
61+
$attribute->getName(),
62+
$exception->getMessage()
63+
),
64+
$exception
65+
);
66+
$attributeException->setAttributeCode($code)->setPart('backend');
67+
throw $attributeException;
68+
}
69+
}
70+
}
71+
}
72+
73+
/**
74+
* @inheritDoc
75+
*/
76+
public function beforeSave($object)
77+
{
78+
parent::beforeSave($object);
79+
$this->validateHtml($object);
80+
81+
return $this;
82+
}
83+
84+
/**
85+
* @inheritDoc
86+
*/
87+
public function validate($object)
88+
{
89+
$isValid = parent::validate($object);
90+
if ($isValid) {
91+
$this->validateHtml($object);
92+
}
93+
94+
return $isValid;
95+
}
96+
}

app/code/Magento/Catalog/Model/Indexer/Category/Product/Plugin/TableResolver.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ public function afterGetTableName(
5555
string $result,
5656
$modelEntity
5757
) {
58-
if (!is_array($modelEntity) && $modelEntity === AbstractAction::MAIN_INDEX_TABLE) {
58+
if (!is_array($modelEntity) &&
59+
$modelEntity === AbstractAction::MAIN_INDEX_TABLE &&
60+
$this->storeManager->getStore()->getId()
61+
) {
5962
$catalogCategoryProductDimension = new Dimension(
6063
\Magento\Store\Model\Store::ENTITY,
6164
$this->storeManager->getStore()->getId()

app/code/Magento/Catalog/Model/Indexer/Product/Category/Action/Rows.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,14 +270,14 @@ private function getCategoryIdsFromIndex(array $productIds): array
270270
);
271271
$categoryIds[] = $storeCategories;
272272
}
273-
$categoryIds = array_merge(...$categoryIds);
273+
$categoryIds = array_merge([], ...$categoryIds);
274274

275275
$parentCategories = [$categoryIds];
276276
foreach ($categoryIds as $categoryId) {
277277
$parentIds = explode('/', $this->getPathFromCategoryId($categoryId));
278278
$parentCategories[] = $parentIds;
279279
}
280-
$categoryIds = array_unique(array_merge(...$parentCategories));
280+
$categoryIds = array_unique(array_merge([], ...$parentCategories));
281281

282282
return $categoryIds;
283283
}

app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ protected function _fillTemporaryFlatTable(array $tables, $storeId, $valueFieldS
261261

262262
$select->from(
263263
['et' => $entityTemporaryTableName],
264-
array_merge(...$allColumns)
264+
array_merge([], ...$allColumns)
265265
)->joinInner(
266266
['e' => $this->resource->getTableName('catalog_product_entity')],
267267
'e.entity_id = et.entity_id',
@@ -306,7 +306,7 @@ protected function _fillTemporaryFlatTable(array $tables, $storeId, $valueFieldS
306306
$allColumns[] = $columnValueNames;
307307
}
308308
}
309-
$sql = $select->insertFromSelect($temporaryFlatTableName, array_merge(...$allColumns), false);
309+
$sql = $select->insertFromSelect($temporaryFlatTableName, array_merge([], ...$allColumns), false);
310310
$this->_connection->query($sql);
311311
}
312312

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -836,10 +836,7 @@ public function getStoreIds()
836836
$storeIds[] = $websiteStores;
837837
}
838838
}
839-
if ($storeIds) {
840-
$storeIds = array_merge(...$storeIds);
841-
}
842-
$this->setStoreIds($storeIds);
839+
$this->setStoreIds(array_merge([], ...$storeIds));
843840
}
844841
return $this->getData('store_ids');
845842
}

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
use Magento\Catalog\Model\Product\Price\Validation\TierPriceValidator;
1313
use Magento\Catalog\Model\ProductIdLocatorInterface;
1414

15-
/**
16-
* Tier price storage.
17-
*/
1815
class TierPriceStorage implements TierPriceStorageInterface
1916
{
2017
/**
@@ -220,7 +217,7 @@ private function retrieveAffectedIds(array $skus): array
220217
$affectedIds[] = array_keys($productId);
221218
}
222219

223-
return $affectedIds ? array_unique(array_merge(...$affectedIds)) : [];
220+
return array_unique(array_merge([], ...$affectedIds));
224221
}
225222

226223
/**

app/code/Magento/Catalog/Model/ProductLink/ProductLinkQuery.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ private function extractRequestedLinkTypes(array $criteria): array
103103
if (count($linkTypesToLoad) === 1) {
104104
$linkTypesToLoad = $linkTypesToLoad[0];
105105
} else {
106-
$linkTypesToLoad = array_merge(...$linkTypesToLoad);
106+
$linkTypesToLoad = array_merge([], ...$linkTypesToLoad);
107107
}
108108
$linkTypesToLoad = array_flip($linkTypesToLoad);
109109
$linkTypes = array_filter(

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66

77
namespace Magento\Catalog\Model\ResourceModel\Eav;
88

9+
use Magento\Catalog\Model\Attribute\Backend\DefaultBackend;
910
use Magento\Catalog\Model\Attribute\LockValidatorInterface;
11+
use Magento\Eav\Model\Entity;
1012
use Magento\Framework\Api\AttributeValueFactory;
1113
use Magento\Framework\Stdlib\DateTime\DateTimeFormatterInterface;
1214

@@ -902,4 +904,17 @@ public function setIsFilterableInGrid($isFilterableInGrid)
902904
$this->setData(self::IS_FILTERABLE_IN_GRID, $isFilterableInGrid);
903905
return $this;
904906
}
907+
908+
/**
909+
* @inheritDoc
910+
*/
911+
protected function _getDefaultBackendModel()
912+
{
913+
$backend = parent::_getDefaultBackendModel();
914+
if ($backend === Entity::DEFAULT_BACKEND_MODEL) {
915+
$backend = DefaultBackend::class;
916+
}
917+
918+
return $backend;
919+
}
905920
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function build(int $productId, int $storeId) : array
3333
foreach ($this->linkedProductSelectBuilder as $productSelectBuilder) {
3434
$selects[] = $productSelectBuilder->build($productId, $storeId);
3535
}
36-
$selects = array_merge(...$selects);
36+
$selects = array_merge([], ...$selects);
3737

3838
return $selects;
3939
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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="StorefrontCheckPresentSubCategoryActionGroup">
11+
<annotations>
12+
<description>Checks for a subcategory in topmenu</description>
13+
</annotations>
14+
<arguments>
15+
<argument name="parenCategoryName" type="string"/>
16+
<argument name="childCategoryName" type="string"/>
17+
</arguments>
18+
19+
<waitForElementVisible selector="{{StorefrontHeaderSection.NavigationCategoryByName(parenCategoryName)}}" stepKey="waitForTopMenuLoaded"/>
20+
<moveMouseOver selector="{{StorefrontHeaderSection.NavigationCategoryByName(parenCategoryName)}}" stepKey="moveMouseToParentCategory"/>
21+
<seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName(childCategoryName)}}" stepKey="seeSubcategoryInTree"/>
22+
</actionGroup>
23+
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Page/AdminCategoryEditPage.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@
1919
<section name="AdminCategoryModalSection"/>
2020
<section name="AdminCategoryMessagesSection"/>
2121
<section name="AdminCategoryContentSection"/>
22+
<section name="AdminCategoryScheduleDesignUpdateSection"/>
2223
</page>
2324
</pages>

app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryBasicFieldSection/AdminCategoryBasicFieldSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@
2222
<element name="FieldError" type="text" selector=".admin__field-error[data-bind='attr: {for: {{field}}}, text: error']" parameterized="true"/>
2323
<element name="panelFieldControl" type="input" selector="//aside//div[@data-index=&quot;{{arg1}}&quot;]/descendant::*[@name=&quot;{{arg2}}&quot;]" parameterized="true"/>
2424
<element name="productsInCategory" type="input" selector="div[data-index='assign_products']" timeout="30"/>
25+
<element name="scheduleDesignUpdateTab" type="block" selector="div[data-index='schedule_design_update']" timeout="15"/>
2526
</section>
2627
</sections>

0 commit comments

Comments
 (0)