Skip to content

Commit 01a2073

Browse files
Merge pull request #89 from magento-commerce/1.1.13
1.1.13
2 parents 3f6e0a8 + a449bcd commit 01a2073

21 files changed

+3279
-9
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/quality-patches",
33
"description": "Provides quality patches for Magento 2",
44
"type": "magento2-component",
5-
"version": "1.1.12",
5+
"version": "1.1.13",
66
"license": "proprietary",
77
"repositories": {
88
"repo": {

patches-info.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
diff --git a/vendor/magento/module-catalog-staging/Observer/UpdateProductDateAttributes.php b/vendor/magento/module-catalog-staging/Observer/UpdateProductDateAttributes.php
2+
index fe1d772a39c..97039cb8ff6 100644
3+
--- a/vendor/magento/module-catalog-staging/Observer/UpdateProductDateAttributes.php
4+
+++ b/vendor/magento/module-catalog-staging/Observer/UpdateProductDateAttributes.php
5+
@@ -121,10 +121,13 @@ class UpdateProductDateAttributes implements ObserverInterface
6+
$localStartTime->format(DateTime::DATETIME_PHP_FORMAT)
7+
);
8+
} else {
9+
- $date = $product->getData('is_new')
10+
- ? $this->localeDate->date()->format(DateTime::DATETIME_PHP_FORMAT)
11+
- : $product->getData('news_from_date');
12+
- $this->setDateTime($product, self::$startDateKeys, $date);
13+
+ if ($product->getData('is_new')) {
14+
+ $date = $product->getData('news_from_date') ??
15+
+ $this->localeDate->date()->format(DateTime::DATETIME_PHP_FORMAT);
16+
+ $this->setDateTime($product, self::$startDateKeys, $date);
17+
+ } else {
18+
+ $this->setDateTime($product, self::$startDateKeys, null);
19+
+ }
20+
}
21+
22+
if ($updatedIn < VersionManager::MAX_VERSION) {
23+
@@ -132,7 +135,9 @@ class UpdateProductDateAttributes implements ObserverInterface
24+
$localEndTime = $this->localeDate->date($dateTime);
25+
$this->setDateTime($product, self::$endDateKeys, $localEndTime->format(DateTime::DATETIME_PHP_FORMAT));
26+
} else {
27+
- $this->setDateTime($product, self::$endDateKeys, null);
28+
+ $date = $product->getData('is_new') && $product->getData('news_to_date') ?
29+
+ $product->getData('news_to_date') : null;
30+
+ $this->setDateTime($product, self::$endDateKeys, $date);
31+
}
32+
}
33+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
diff --git a/vendor/magento/module-customer-segment/Model/Customer.php b/vendor/magento/module-customer-segment/Model/Customer.php
2+
index 9ac45f6facc..415c2ea9396 100644
3+
--- a/vendor/magento/module-customer-segment/Model/Customer.php
4+
+++ b/vendor/magento/module-customer-segment/Model/Customer.php
5+
@@ -277,6 +277,7 @@ public function processCustomerEvent($eventName, $customerId)
6+
*/
7+
public function addVisitorToWebsiteSegments($visitorSession, $websiteId, $segmentIds)
8+
{
9+
+ $segmentIds = array_unique(array_merge($this->getVisitorsSegmentsForWebsite($websiteId), $segmentIds));
10+
$visitorSegmentIds = $visitorSession->getCustomerSegmentIds();
11+
if (!is_array($visitorSegmentIds)) {
12+
$visitorSegmentIds = [];
13+
diff --git a/vendor/magento/module-target-rule/Model/ResourceModel/Index.php b/vendor/magento/module-target-rule/Model/ResourceModel/Index.php
14+
index 4f9a53eb781..7c0cea05baf 100644
15+
--- a/vendor/magento/module-target-rule/Model/ResourceModel/Index.php
16+
+++ b/vendor/magento/module-target-rule/Model/ResourceModel/Index.php
17+
@@ -3,6 +3,7 @@
18+
* Copyright © Magento, Inc. All rights reserved.
19+
* See COPYING.txt for license details.
20+
*/
21+
+
22+
namespace Magento\TargetRule\Model\ResourceModel;
23+
24+
use Magento\Catalog\Model\Product\Visibility;
25+
@@ -22,10 +23,10 @@
26+
use Magento\Framework\Registry;
27+
use Magento\Store\Model\Store;
28+
use Magento\Store\Model\StoreManagerInterface;
29+
-use Magento\TargetRule\Model\Index as TargetRuleIndex;
30+
-use Magento\TargetRule\Model\Rule;
31+
use Magento\TargetRule\Helper\Data as TargetRuleHelper;
32+
+use Magento\TargetRule\Model\Index as TargetRuleIndex;
33+
use Magento\TargetRule\Model\ResourceModel\Rule as ResourceModelRule;
34+
+use Magento\TargetRule\Model\Rule;
35+
36+
/**
37+
* TargetRule Product Index by Rule Product List Type Resource Model
38+
@@ -138,8 +139,8 @@ class Index extends AbstractDb
39+
* @param CustomerSegmentHelper $customerSegmentData
40+
* @param TargetRuleHelper $targetRuleData
41+
* @param Registry $coreRegistry
42+
- * @param Stock $stockHelper
43+
- * @param string $connectionName
44+
+ * @param Stock|null $stockHelper
45+
+ * @param string|null $connectionName
46+
* @param HttpContext|null $httpContext
47+
* @param StockConfigurationInterface|null $stockConfiguration
48+
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
49+
@@ -654,7 +655,10 @@ protected function _getSegmentsIdsFromCurrentCustomer(int $customerId = null, in
50+
if ($websiteId === null) {
51+
$websiteId = $this->_storeManager->getWebsite()->getId();
52+
}
53+
- $segmentIds = $this->_customer->getCustomerSegmentIdsForWebsite((int)$customerId, (int)$websiteId);
54+
+
55+
+ $segmentIds = empty($customerId)
56+
+ ? (array)$this->httpContext->getValue(CustomerSegmentHelper::CONTEXT_SEGMENT)
57+
+ : $this->_customer->getCustomerSegmentIdsForWebsite((int)$customerId, (int)$websiteId);
58+
59+
if (count($segmentIds)) {
60+
$segmentIds = $this->_segmentCollectionFactory->getActiveSegmentsByIds($segmentIds);
Lines changed: 259 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,259 @@
1+
diff --git a/vendor/magento/module-shared-catalog/Controller/Adminhtml/SharedCatalog/Configure/Save.php b/vendor/magento/module-shared-catalog/Controller/Adminhtml/SharedCatalog/Configure/Save.php
2+
index 15e9457744..f1c5db7e5a 100644
3+
--- a/vendor/magento/module-shared-catalog/Controller/Adminhtml/SharedCatalog/Configure/Save.php
4+
+++ b/vendor/magento/module-shared-catalog/Controller/Adminhtml/SharedCatalog/Configure/Save.php
5+
@@ -27,6 +27,9 @@ use Psr\Log\LoggerInterface;
6+
7+
/**
8+
* Save shared catalog structure and pricing.
9+
+ *
10+
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
11+
+ * @SuppressWarnings(PHPMD.ExcessiveParameterList)
12+
*/
13+
class Save extends Action implements HttpPostActionInterface
14+
{
15+
@@ -137,7 +140,8 @@ class Save extends Action implements HttpPostActionInterface
16+
try {
17+
$resultDiff = $this->diffProcessor->getDiff($currentStorage, $sharedCatalogId);
18+
19+
- $storeId = $this->getRequest()->getParam('store_id');
20+
+ // store_id filter stand for store group id (group_id from store_group)
21+
+ $storeId = (int)$this->getRequest()->getParam('store_id');
22+
$sharedCatalog = $this->configureCategory->saveConfiguredCategories(
23+
$currentStorage,
24+
$sharedCatalogId,
25+
@@ -185,7 +189,7 @@ class Save extends Action implements HttpPostActionInterface
26+
* @throws LocalizedException
27+
* @throws NoSuchEntityException
28+
*/
29+
- private function excludeWebsites($storeId, $customerGroupId)
30+
+ private function excludeWebsites(?int $storeId, int $customerGroupId)
31+
{
32+
if ($storeId > 0) {
33+
$allWebsiteIds = [];
34+
@@ -195,8 +199,8 @@ class Save extends Action implements HttpPostActionInterface
35+
$allWebsiteIds[] = $website->getId();
36+
}
37+
38+
- //get website id which should be included
39+
- $websiteId = $this->storeManager->getStore($storeId)->getWebsiteId();
40+
+ //get website id which should be included based on selected store group
41+
+ $websiteId = $this->storeManager->getGroup($storeId)->getWebsiteId();
42+
43+
//exclude websites from customer group
44+
$excludeWebsiteIds = array_diff($allWebsiteIds, [$websiteId]);
45+
diff --git a/vendor/magento/module-shared-catalog/Model/Configure/Category.php b/vendor/magento/module-shared-catalog/Model/Configure/Category.php
46+
index 4612b47f2d..b4f4e5277f 100644
47+
--- a/vendor/magento/module-shared-catalog/Model/Configure/Category.php
48+
+++ b/vendor/magento/module-shared-catalog/Model/Configure/Category.php
49+
@@ -62,6 +62,7 @@ class Category
50+
$assignedCategoriesIds = $currentStorage->getAssignedCategoriesIds();
51+
$unassignedCategoriesIds = $currentStorage->getUnassignedCategoriesIds();
52+
53+
+ //store_id actually stands for store group id ( group_id )
54+
if ($sharedCatalog->getStoreId() === null) {
55+
$sharedCatalog->setStoreId($storeId);
56+
$this->sharedCatalogRepository->save($sharedCatalog);
57+
diff --git a/vendor/magento/module-shared-catalog/Plugin/Backend/Block/Adminhtml/Store/SwitcherRolePermissions.php b/vendor/magento/module-shared-catalog/Plugin/Backend/Block/Adminhtml/Store/SwitcherRolePermissions.php
58+
new file mode 100644
59+
index 0000000000..6060fe1d09
60+
--- /dev/null
61+
+++ b/vendor/magento/module-shared-catalog/Plugin/Backend/Block/Adminhtml/Store/SwitcherRolePermissions.php
62+
@@ -0,0 +1,59 @@
63+
+<?php
64+
+/**
65+
+ * Copyright © Magento, Inc. All rights reserved.
66+
+ * See COPYING.txt for license details.
67+
+ */
68+
+declare(strict_types=1);
69+
+
70+
+namespace Magento\SharedCatalog\Plugin\Backend\Block\Adminhtml\Store;
71+
+
72+
+use Magento\Backend\Model\Auth\Session;
73+
+use Magento\Framework\Stdlib\ArrayManager;
74+
+use Magento\SharedCatalog\Block\Adminhtml\Store\Switcher;
75+
+
76+
+/**
77+
+ * Plugin for store switch permission based on role
78+
+ */
79+
+class SwitcherRolePermissions
80+
+{
81+
+ /**
82+
+ * @var Session
83+
+ */
84+
+ private $backendAuthSession;
85+
+
86+
+ /**
87+
+ * @var ArrayManager
88+
+ */
89+
+ private $arrayManager;
90+
+
91+
+ /**
92+
+ * @param Session $backendAuthSession
93+
+ * @param ArrayManager $arrayManager
94+
+ */
95+
+ public function __construct(
96+
+ Session $backendAuthSession,
97+
+ ArrayManager $arrayManager
98+
+ ) {
99+
+ $this->backendAuthSession = $backendAuthSession;
100+
+ $this->arrayManager = $arrayManager;
101+
+ }
102+
+
103+
+ /**
104+
+ * Remove 'All Stores' for website restricted users
105+
+ *
106+
+ * @param Switcher $subject
107+
+ * @param array $result
108+
+ * @return array
109+
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
110+
+ */
111+
+ public function afterGetStoreOptionsAsArray(
112+
+ Switcher $subject,
113+
+ array $result
114+
+ ):array {
115+
+ $role = $this->backendAuthSession->getUser()->getRole();
116+
+ if (!$role->getGwsIsAll() && $this->arrayManager->exists(Switcher::ALL_STORES_ID, $result)) {
117+
+ array_shift($result);
118+
+ }
119+
+ return $result;
120+
+ }
121+
+}
122+
diff --git a/vendor/magento/module-shared-catalog/Plugin/Ui/DataProvider/WebsiteRolePermissions.php b/vendor/magento/module-shared-catalog/Plugin/Ui/DataProvider/WebsiteRolePermissions.php
123+
new file mode 100644
124+
index 0000000000..1399345b75
125+
--- /dev/null
126+
+++ b/vendor/magento/module-shared-catalog/Plugin/Ui/DataProvider/WebsiteRolePermissions.php
127+
@@ -0,0 +1,61 @@
128+
+<?php
129+
+/**
130+
+ * Copyright © Magento, Inc. All rights reserved.
131+
+ * See COPYING.txt for license details.
132+
+ */
133+
+declare(strict_types=1);
134+
+
135+
+namespace Magento\SharedCatalog\Plugin\Ui\DataProvider;
136+
+
137+
+use Magento\Backend\Model\Auth\Session;
138+
+use Magento\Framework\Stdlib\ArrayManager;
139+
+use Magento\SharedCatalog\Ui\DataProvider\Website as Websites;
140+
+
141+
+/**
142+
+ * Plugin for store switch permission based on role
143+
+ *
144+
+ * @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
145+
+ */
146+
+class WebsiteRolePermissions
147+
+{
148+
+ /**
149+
+ * @var ArrayManager
150+
+ */
151+
+ private $arrayManager;
152+
+
153+
+ /**
154+
+ * @var Session
155+
+ */
156+
+ private $backendAuthSession;
157+
+
158+
+ /**
159+
+ * @param Session $backendAuthSession
160+
+ * @param ArrayManager $arrayManager
161+
+ */
162+
+ public function __construct(
163+
+ Session $backendAuthSession,
164+
+ ArrayManager $arrayManager
165+
+ ) {
166+
+ $this->backendAuthSession = $backendAuthSession;
167+
+ $this->arrayManager = $arrayManager;
168+
+ }
169+
+
170+
+ /**
171+
+ * Remove 'All Stores' for website restricted users
172+
+ *
173+
+ * @param Websites $subject
174+
+ * @param array $result
175+
+ * @return array
176+
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
177+
+ */
178+
+ public function afterGetWebsites(
179+
+ Websites $subject,
180+
+ array $result
181+
+ ):array {
182+
+ $role = $this->backendAuthSession->getUser()->getRole();
183+
+ if (!$role->getGwsIsAll() && $this->arrayManager->exists(0, $result)) {
184+
+ array_shift($result);
185+
+ }
186+
+ return $result;
187+
+ }
188+
+}
189+
diff --git a/vendor/magento/module-shared-catalog/Ui/DataProvider/Configure/AbstractDataProvider.php b/vendor/magento/module-shared-catalog/Ui/DataProvider/Configure/AbstractDataProvider.php
190+
index da9714ad5f..719ce9bbf3 100644
191+
--- a/vendor/magento/module-shared-catalog/Ui/DataProvider/Configure/AbstractDataProvider.php
192+
+++ b/vendor/magento/module-shared-catalog/Ui/DataProvider/Configure/AbstractDataProvider.php
193+
@@ -5,8 +5,9 @@
194+
*/
195+
namespace Magento\SharedCatalog\Ui\DataProvider\Configure;
196+
197+
-use Magento\SharedCatalog\Model\Form\Storage\WizardFactory as WizardStorageFactory;
198+
use Magento\SharedCatalog\Model\Form\Storage\UrlBuilder;
199+
+use Magento\SharedCatalog\Model\Form\Storage\WizardFactory as WizardStorageFactory;
200+
+use Magento\Store\Model\Store;
201+
202+
/**
203+
* Products grid in shared catalog wizard data provider.
204+
@@ -68,6 +69,7 @@ abstract class AbstractDataProvider extends \Magento\SharedCatalog\Ui\DataProvid
205+
*/
206+
public function addFilter(\Magento\Framework\Api\Filter $filter)
207+
{
208+
+ //@phpstan-ignore-next-line as adding return statement cause of backward compatibility issue
209+
switch ($filter->getField()) {
210+
case 'websites':
211+
if ($filter->getValue() != 0) {
212+
@@ -113,8 +115,17 @@ abstract class AbstractDataProvider extends \Magento\SharedCatalog\Ui\DataProvid
213+
$categoryId = !empty($filters['category_id']) ? $filters['category_id'] : '';
214+
$collection = $this->categoryTree->getCategoryProductsCollectionById($categoryId);
215+
if (empty($filters['store_id']) && empty($filters['websites'])) {
216+
- $collection->setStore(\Magento\Store\Model\Store::DEFAULT_STORE_ID);
217+
+ $collection->setStore(Store::DEFAULT_STORE_ID);
218+
}
219+
+
220+
+ //from ui the "Stores" dropdown contains group_id from store_group,
221+
+ //instead of store_id from store table
222+
+ //so the default_store_id from the selected store group is chosen for filtering
223+
+ if (!empty($filters['store_id'])) {
224+
+ $storeId = $this->storeManager->getGroup($filters['store_id'])->getDefaultStoreId();
225+
+ $collection->setStore($storeId);
226+
+ }
227+
+
228+
$collection->addWebsiteNamesToResult();
229+
230+
return $collection;
231+
diff --git a/vendor/magento/module-shared-catalog/etc/adminhtml/di.xml b/vendor/magento/module-shared-catalog/etc/adminhtml/di.xml
232+
index a07a514023..f8e0e0182c 100644
233+
--- a/vendor/magento/module-shared-catalog/etc/adminhtml/di.xml
234+
+++ b/vendor/magento/module-shared-catalog/etc/adminhtml/di.xml
235+
@@ -136,4 +136,12 @@
236+
<plugin name="catalog_category_permissions_row_block_plugin"
237+
type="Magento\SharedCatalog\Plugin\CatalogPermissions\Block\Adminhtml\Catalog\Category\Tab\Permissions\RowPlugin" />
238+
</type>
239+
+ <type name="Magento\SharedCatalog\Block\Adminhtml\Store\Switcher">
240+
+ <plugin name="shared_catalog_restrict_stores_for_restricted_users"
241+
+ type="Magento\SharedCatalog\Plugin\Backend\Block\Adminhtml\Store\SwitcherRolePermissions" />
242+
+ </type>
243+
+ <type name="Magento\SharedCatalog\Ui\DataProvider\Website">
244+
+ <plugin name="shared_catalog_restrict_websites_for_restricted_users"
245+
+ type="Magento\SharedCatalog\Plugin\Ui\DataProvider\WebsiteRolePermissions" />
246+
+ </type>
247+
</config>
248+
diff --git a/vendor/magento/module-shared-catalog/view/adminhtml/web/js/grid/filters/configure/filters.js b/vendor/magento/module-shared-catalog/view/adminhtml/web/js/grid/filters/configure/filters.js
249+
index c2536b28c4..ba9694f971 100644
250+
--- a/vendor/magento/module-shared-catalog/view/adminhtml/web/js/grid/filters/configure/filters.js
251+
+++ b/vendor/magento/module-shared-catalog/view/adminhtml/web/js/grid/filters/configure/filters.js
252+
@@ -59,6 +59,7 @@ define([
253+
selectedStoreId = selectedStore.id;
254+
}
255+
this.storeFilter().value(selectedStoreId);
256+
+ this.filters['store_id'] = selectedStoreId;
257+
this.apply();
258+
},
259+

0 commit comments

Comments
 (0)