Skip to content

Commit cd7035a

Browse files
authored
Merge branch '2.4-develop' into AC-2259-update-phpcs-fixer
2 parents 35702ea + 1f37c78 commit cd7035a

File tree

78 files changed

+1031
-232
lines changed

Some content is hidden

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

78 files changed

+1031
-232
lines changed

app/code/Magento/AsynchronousOperations/Model/BulkManagement.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,18 @@ public function __construct(
104104
*/
105105
public function scheduleBulk($bulkUuid, array $operations, $description, $userId = null)
106106
{
107-
$metadata = $this->metadataPool->getMetadata(BulkSummaryInterface::class);
108-
$connection = $this->resourceConnection->getConnectionByName($metadata->getEntityConnectionName());
109-
// save bulk summary and related operations
110-
$connection->beginTransaction();
111107
$userType = $this->userContext->getUserType();
112108
if ($userType === null) {
113109
$userType = UserContextInterface::USER_TYPE_ADMIN;
114110
}
111+
if ($userId === null && $userType === UserContextInterface::USER_TYPE_ADMIN) {
112+
$userId = $this->userContext->getUserId();
113+
}
114+
115+
$metadata = $this->metadataPool->getMetadata(BulkSummaryInterface::class);
116+
$connection = $this->resourceConnection->getConnectionByName($metadata->getEntityConnectionName());
117+
// save bulk summary and related operations
118+
$connection->beginTransaction();
115119
try {
116120
/** @var BulkSummaryInterface $bulkSummary */
117121
$bulkSummary = $this->bulkSummaryFactory->create();

app/code/Magento/Backend/view/adminhtml/web/js/dashboard/chart.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* See COPYING.txt for license details.
44
*/
55

6-
/*global define*/
76
/*global FORM_KEY*/
87
define([
98
'jquery',

app/code/Magento/Backend/view/adminhtml/web/js/dashboard/totals.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* See COPYING.txt for license details.
44
*/
55

6-
/*global define*/
76
/*global FORM_KEY*/
87
define([
98
'jquery',

app/code/Magento/Bundle/view/adminhtml/web/js/bundle-product.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
/*global FORM_KEY*/
77
/*global bSelection*/
8-
/*global $H*/
98
/**
109
* @api
1110
*/
@@ -186,7 +185,9 @@ define([
186185
});
187186
bSelection.gridRemoval.each(function (pair) {
188187
$optionBox.find('.col-sku').filter(function () {
189-
return $(this).text().trim() === pair.key; // find row by SKU
188+
let text = $(this).text();
189+
190+
return text.trim() === pair.key; // find row by SKU
190191
}).closest('tr').find('button.delete').trigger('click');
191192
});
192193
widget.refreshSortableElements();

app/code/Magento/Captcha/view/frontend/web/js/model/captcha.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* See COPYING.txt for license details.
44
*/
55

6-
/*global alert*/
76
define([
87
'jquery',
98
'ko',

app/code/Magento/Catalog/view/adminhtml/web/catalog/base-image-uploader.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* See COPYING.txt for license details.
44
*/
55

6-
/*global alert:true*/
76
define([
87
'jquery',
98
'mage/template',

app/code/Magento/Catalog/view/adminhtml/web/catalog/category/assign-products.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
* See COPYING.txt for license details.
44
*/
55

6-
/* global $, $H */
7-
86
define([
97
'mage/adminhtml/grid'
108
], function () {

app/code/Magento/Catalog/view/base/web/js/price-utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ define([
2727
* @return {String}
2828
*/
2929
function stringPad(string, times) {
30-
return (new Array(times + 1)).join(string);
30+
return new Array(times + 1).join(string);
3131
}
3232

3333
/**

app/code/Magento/CatalogGraphQl/DataProvider/Product/LayeredNavigation/Builder/Category.php

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Magento\CatalogGraphQl\DataProvider\Product\LayeredNavigation\Builder;
99

10+
use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory;
1011
use Magento\CatalogGraphQl\DataProvider\CategoryAttributesMapper;
1112
use Magento\CatalogGraphQl\DataProvider\Category\Query\CategoryAttributeQuery;
1213
use Magento\CatalogGraphQl\DataProvider\Product\LayeredNavigation\LayerBuilderInterface;
@@ -19,7 +20,9 @@
1920
use Magento\CatalogGraphQl\DataProvider\Product\LayeredNavigation\Builder\Aggregations;
2021

2122
/**
22-
* @inheritdoc
23+
* Category layer builder
24+
*
25+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2326
*/
2427
class Category implements LayerBuilderInterface
2528
{
@@ -63,6 +66,11 @@ class Category implements LayerBuilderInterface
6366
*/
6467
private $layerFormatter;
6568

69+
/**
70+
* @var CollectionFactory
71+
*/
72+
private $categoryCollectionFactory;
73+
6674
/**
6775
* @var Aggregations\Category\IncludeDirectChildrenOnly
6876
*/
@@ -75,21 +83,24 @@ class Category implements LayerBuilderInterface
7583
* @param ResourceConnection $resourceConnection
7684
* @param LayerFormatter $layerFormatter
7785
* @param Aggregations\Category\IncludeDirectChildrenOnly $includeDirectChildrenOnly
86+
* @param CollectionFactory $categoryCollectionFactory
7887
*/
7988
public function __construct(
8089
CategoryAttributeQuery $categoryAttributeQuery,
8190
CategoryAttributesMapper $attributesMapper,
8291
RootCategoryProvider $rootCategoryProvider,
8392
ResourceConnection $resourceConnection,
8493
LayerFormatter $layerFormatter,
85-
Aggregations\Category\IncludeDirectChildrenOnly $includeDirectChildrenOnly
94+
Aggregations\Category\IncludeDirectChildrenOnly $includeDirectChildrenOnly,
95+
CollectionFactory $categoryCollectionFactory
8696
) {
8797
$this->categoryAttributeQuery = $categoryAttributeQuery;
8898
$this->attributesMapper = $attributesMapper;
8999
$this->resourceConnection = $resourceConnection;
90100
$this->rootCategoryProvider = $rootCategoryProvider;
91101
$this->layerFormatter = $layerFormatter;
92102
$this->includeDirectChildrenOnly = $includeDirectChildrenOnly;
103+
$this->categoryCollectionFactory = $categoryCollectionFactory;
93104
}
94105

95106
/**
@@ -112,6 +123,11 @@ function (AggregationValueInterface $value) {
112123
$bucket->getValues()
113124
);
114125

126+
if ($storeId) {
127+
$storeFilteredCategoryIds = $this->getStoreCategoryIds($storeId);
128+
$categoryIds = \array_intersect($categoryIds, $storeFilteredCategoryIds);
129+
}
130+
115131
$categoryIds = \array_diff($categoryIds, [$this->rootCategoryProvider->getRootCategory($storeId)]);
116132
$categoryLabels = \array_column(
117133
$this->attributesMapper->getAttributesValues(
@@ -158,4 +174,25 @@ private function isBucketEmpty(?BucketInterface $bucket): bool
158174
{
159175
return null === $bucket || !$bucket->getValues();
160176
}
177+
178+
/**
179+
* List of store categories
180+
*
181+
* @param int $storeId
182+
* @return array
183+
*/
184+
private function getStoreCategoryIds(int $storeId): array
185+
{
186+
$storeRootCategoryId = $this->rootCategoryProvider->getRootCategory($storeId);
187+
$collection = $this->categoryCollectionFactory->create();
188+
$select = $collection->getSelect();
189+
$connection = $collection->getConnection();
190+
$select->where(
191+
$connection->quoteInto(
192+
'e.path LIKE ? OR e.entity_id=' . $connection->quote($storeRootCategoryId, 'int'),
193+
'%/' . $storeRootCategoryId . '/%'
194+
)
195+
);
196+
return $collection->getAllIds();
197+
}
161198
}

app/code/Magento/CatalogUrlRewrite/Model/Products/AdaptUrlRewritesToVisibilityAttribute.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,12 @@ public function __construct(
6565
*
6666
* @param array $productIds
6767
* @param int $visibility
68+
* @param int $storeId
6869
* @throws UrlAlreadyExistsException
6970
*/
70-
public function execute(array $productIds, int $visibility): void
71+
public function execute(array $productIds, int $visibility, int $storeId): void
7172
{
72-
$products = $this->getProductsByIds($productIds);
73+
$products = $this->getProductsByIds($productIds, $storeId);
7374

7475
/** @var Product $product */
7576
foreach ($products as $product) {
@@ -110,11 +111,13 @@ public function execute(array $productIds, int $visibility): void
110111
* Get Product Models by Id's
111112
*
112113
* @param array $productIds
114+
* @param int $storeId
113115
* @return array
114116
*/
115-
private function getProductsByIds(array $productIds): array
117+
private function getProductsByIds(array $productIds, int $storeId): array
116118
{
117119
$productCollection = $this->productCollectionFactory->create();
120+
$productCollection->setStoreId($storeId);
118121
$productCollection->addAttributeToSelect(ProductInterface::VISIBILITY);
119122
$productCollection->addAttributeToSelect('url_key');
120123
$productCollection->addFieldToFilter(

0 commit comments

Comments
 (0)