Skip to content

Commit 5418840

Browse files
Merge pull request #207 from magento-commerce/1.1.69-release
1.1.69 release
2 parents 48f313f + 740d3ff commit 5418840

25 files changed

+2052
-3
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 AdobeCommerce & Magento OpenSource",
44
"type": "magento2-component",
5-
"version": "1.1.68",
5+
"version": "1.1.69",
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: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
diff --git a/vendor/magento/module-reward/Model/System/Config/Backend/Balance.php b/vendor/magento/module-reward/Model/System/Config/Backend/Balance.php
2+
index c3b26591b1bb..87a6431a4a2e 100644
3+
--- a/vendor/magento/module-reward/Model/System/Config/Backend/Balance.php
4+
+++ b/vendor/magento/module-reward/Model/System/Config/Backend/Balance.php
5+
@@ -28,12 +28,12 @@ public function beforeSave()
6+
return $this;
7+
}
8+
9+
- if ($this->getFieldsetDataValue('min_points_balance') < 0) {
10+
+ if ((int)$this->getFieldsetDataValue('min_points_balance') < 0) {
11+
$message = __('The "Minimum Reward Points Balance" is invalid. '
12+
. 'The balance needs to be a positive number or left empty. Verify and try again.');
13+
throw new LocalizedException($message);
14+
}
15+
- if ($this->getFieldsetDataValue('max_points_balance') < 0) {
16+
+ if ((int)$this->getFieldsetDataValue('max_points_balance') < 0) {
17+
$message = __('The "Cap Reward Points Balance" is invalid. '
18+
. 'The balance needs to be a positive number or left empty. Verify and try again.');
19+
throw new LocalizedException($message);
Lines changed: 254 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,254 @@
1+
diff --git a/vendor/magento/module-catalog-permissions/etc/di.xml b/vendor/magento/module-catalog-permissions/etc/di.xml
2+
index 01640cc..f1a96cd 100644
3+
--- a/vendor/magento/module-catalog-permissions/etc/di.xml
4+
+++ b/vendor/magento/module-catalog-permissions/etc/di.xml
5+
@@ -81,7 +81,7 @@
6+
<type name="Magento\Indexer\Console\Command\IndexerSetDimensionsModeCommand">
7+
<arguments>
8+
<argument name="dimensionSwitchers" xsi:type="array">
9+
- <item name="catalogpermissions_category" xsi:type="object">Magento\CatalogPermissions\Model\Indexer\Category\ModeSwitcher</item>
10+
+ <item name="catalogpermissions_category" xsi:type="object">Magento\CatalogPermissions\Model\Indexer\Category\ModeSwitcher\Proxy</item>
11+
</argument>
12+
</arguments>
13+
</type>
14+
diff --git a/vendor/magento/module-resource-connections/DB/Adapter/Pdo/MysqlProxy.php b/vendor/magento/module-resource-connections/DB/Adapter/Pdo/MysqlProxy.php
15+
index ce9c9d5..a30e608 100644
16+
--- a/vendor/magento/module-resource-connections/DB/Adapter/Pdo/MysqlProxy.php
17+
+++ b/vendor/magento/module-resource-connections/DB/Adapter/Pdo/MysqlProxy.php
18+
@@ -36,12 +36,12 @@ class MysqlProxy extends Mysql
19+
protected $masterConnectionOnly = false;
20+
21+
/**
22+
- * @var \Magento\Framework\DB\Adapter\Pdo\Mysql
23+
+ * @var Mysql|null
24+
*/
25+
protected $masterConnection;
26+
27+
/**
28+
- * @var \Magento\Framework\DB\Adapter\Pdo\Mysql
29+
+ * @var Mysql|null
30+
*/
31+
protected $slaveConnection;
32+
33+
@@ -75,6 +75,11 @@ class MysqlProxy extends Mysql
34+
private bool $synchronousReplication = false;
35+
36+
/**
37+
+ * @var bool
38+
+ */
39+
+ private bool $isCausalityCheckOnReadForSlaveEnabled = false;
40+
+
41+
+ /**
42+
* Constructor
43+
*
44+
* @param LoggerInterface $logger
45+
@@ -91,11 +96,10 @@ class MysqlProxy extends Mysql
46+
$this->logger = $logger;
47+
$this->selectFactory = $selectFactory;
48+
$this->mysqlFactory = $mysqlFactory ?: ObjectManager::getInstance()->get(MysqlFactory::class);
49+
+ $this->masterConfig = $config;
50+
if (!isset($config['slave'])) {
51+
- $this->masterConfig = $config;
52+
$this->setUseMasterConnection();
53+
} else {
54+
- $this->masterConfig = $config;
55+
unset($this->masterConfig['slave']);
56+
$this->slaveConfig = array_merge($this->masterConfig, $config['slave']);
57+
$this->synchronousReplication = $this->slaveConfig['synchronous_replication'] ?? false;
58+
@@ -103,6 +107,23 @@ class MysqlProxy extends Mysql
59+
}
60+
61+
/**
62+
+ * @inheritdoc
63+
+ */
64+
+ public function _resetState() : void
65+
+ {
66+
+ if ($this->masterConnection) {
67+
+ $this->masterConnection->_resetState();
68+
+ }
69+
+ if ($this->slaveConnection) {
70+
+ $this->slaveConnection->_resetState();
71+
+ }
72+
+ $this->masterConnection = null;
73+
+ $this->slaveConnection = null;
74+
+ $this->isCausalityCheckOnReadForSlaveEnabled = false;
75+
+ parent::_resetState();
76+
+ }
77+
+
78+
+ /**
79+
* Set master connection
80+
*
81+
* @return $this
82+
@@ -192,9 +213,7 @@ class MysqlProxy extends Mysql
83+
return $this->getSlaveConnection();
84+
}
85+
86+
- if ($this->synchronousReplication === false) {
87+
- $this->setUseMasterConnection();
88+
- }
89+
+ $this->prepareReadOnlyConnection();
90+
91+
return $this->getMasterConnection();
92+
}
93+
@@ -219,6 +238,7 @@ class MysqlProxy extends Mysql
94+
if ($this->synchronousReplication
95+
&& $this->getMasterConnection()->getTransactionLevel() === 0) {
96+
$this->masterConnectionOnly = false;
97+
+ $this->setCausalityCheckOnReadForSlave();
98+
}
99+
return $this;
100+
}
101+
@@ -570,9 +590,7 @@ class MysqlProxy extends Mysql
102+
*/
103+
public function insertForce($table, array $bind)
104+
{
105+
- if ($this->synchronousReplication !== true) {
106+
- $this->setUseMasterConnection();
107+
- }
108+
+ $this->prepareReadOnlyConnection();
109+
return $this->getMasterConnection()->insertForce($table, $bind);
110+
}
111+
112+
@@ -581,9 +599,7 @@ class MysqlProxy extends Mysql
113+
*/
114+
public function insertOnDuplicate($table, array $data, array $fields = [])
115+
{
116+
- if ($this->synchronousReplication !== true) {
117+
- $this->setUseMasterConnection();
118+
- }
119+
+ $this->prepareReadOnlyConnection();
120+
return $this->getMasterConnection()->insertOnDuplicate($table, $data, $fields);
121+
}
122+
123+
@@ -592,9 +608,7 @@ class MysqlProxy extends Mysql
124+
*/
125+
public function insertMultiple($table, array $data)
126+
{
127+
- if ($this->synchronousReplication !== true) {
128+
- $this->setUseMasterConnection();
129+
- }
130+
+ $this->prepareReadOnlyConnection();
131+
return $this->getMasterConnection()->insertMultiple($table, $data);
132+
}
133+
134+
@@ -603,9 +617,7 @@ class MysqlProxy extends Mysql
135+
*/
136+
public function insertArray($table, array $columns, array $data, $strategy = 0)
137+
{
138+
- if ($this->synchronousReplication !== true) {
139+
- $this->setUseMasterConnection();
140+
- }
141+
+ $this->prepareReadOnlyConnection();
142+
return $this->getMasterConnection()->insertArray($table, $columns, $data, $strategy);
143+
}
144+
145+
@@ -988,9 +1000,7 @@ class MysqlProxy extends Mysql
146+
*/
147+
public function insertFromSelect(Select $select, $table, array $fields = [], $mode = false)
148+
{
149+
- if ($this->synchronousReplication !== true) {
150+
- $this->setUseMasterConnection();
151+
- }
152+
+ $this->prepareReadOnlyConnection();
153+
return $this->getMasterConnection()->insertFromSelect($select, $table, $fields, $mode);
154+
}
155+
156+
@@ -1007,9 +1017,7 @@ class MysqlProxy extends Mysql
157+
*/
158+
public function updateFromSelect(Select $select, $table)
159+
{
160+
- if ($this->synchronousReplication !== true) {
161+
- $this->setUseMasterConnection();
162+
- }
163+
+ $this->prepareReadOnlyConnection();
164+
return $this->getMasterConnection()->updateFromSelect($select, $table);
165+
}
166+
167+
@@ -1018,9 +1026,7 @@ class MysqlProxy extends Mysql
168+
*/
169+
public function deleteFromSelect(Select $select, $table)
170+
{
171+
- if ($this->synchronousReplication !== true) {
172+
- $this->setUseMasterConnection();
173+
- }
174+
+ $this->prepareReadOnlyConnection();
175+
return $this->getMasterConnection()->deleteFromSelect($select, $table);
176+
}
177+
178+
@@ -1054,9 +1060,7 @@ class MysqlProxy extends Mysql
179+
*/
180+
public function forUpdate($sql)
181+
{
182+
- if ($this->synchronousReplication !== true) {
183+
- $this->setUseMasterConnection();
184+
- }
185+
+ $this->prepareReadOnlyConnection();
186+
return $this->getMasterConnection()->forUpdate($sql);
187+
}
188+
189+
@@ -1257,9 +1261,7 @@ class MysqlProxy extends Mysql
190+
*/
191+
public function insert($table, array $bind)
192+
{
193+
- if ($this->synchronousReplication !== true) {
194+
- $this->setUseMasterConnection();
195+
- }
196+
+ $this->prepareReadOnlyConnection();
197+
return $this->getMasterConnection()->insert($table, $bind);
198+
}
199+
200+
@@ -1268,20 +1270,48 @@ class MysqlProxy extends Mysql
201+
*/
202+
public function update($table, array $bind, $where = '')
203+
{
204+
- if ($this->synchronousReplication !== true) {
205+
- $this->setUseMasterConnection();
206+
- }
207+
+ $this->prepareReadOnlyConnection();
208+
return $this->getMasterConnection()->update($table, $bind, $where);
209+
}
210+
211+
/**
212+
+ * Prepare connection for read-only operations.
213+
+ *
214+
+ * @return void
215+
+ */
216+
+ private function prepareReadOnlyConnection(): void
217+
+ {
218+
+ $this->synchronousReplication ? $this->setCausalityCheckOnReadForSlave() : $this->setUseMasterConnection();
219+
+ }
220+
+
221+
+ /**
222+
+ * Enforces strict causality check on READ statements for slave node.
223+
+ *
224+
+ * This is required to prevent slave from reading stale data after write operation on master.
225+
+ *
226+
+ * @see https://galeracluster.com/library/documentation/mysql-wsrep-options.html#wsrep-sync-wait
227+
+ * @return void
228+
+ */
229+
+ private function setCausalityCheckOnReadForSlave(): void
230+
+ {
231+
+ if ($this->isCausalityCheckOnReadForSlaveEnabled) {
232+
+ return;
233+
+ }
234+
+ try {
235+
+ $this->getSlaveConnection()->query('SET SESSION wsrep_sync_wait=1');
236+
+ //phpcs:ignore Magento2.CodeAnalysis.EmptyBlock
237+
+ } catch (\Throwable $e) {
238+
+ // ignore exception, we cannot do anything here
239+
+ }
240+
+ $this->isCausalityCheckOnReadForSlaveEnabled = true;
241+
+ }
242+
+
243+
+ /**
244+
* @inheritDoc
245+
*/
246+
public function delete($table, $where = '')
247+
{
248+
- if ($this->synchronousReplication !== true) {
249+
- $this->setUseMasterConnection();
250+
- }
251+
+ $this->prepareReadOnlyConnection();
252+
return $this->getMasterConnection()->delete($table, $where);
253+
}
254+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
diff --git a/vendor/magento/module-negotiable-quote/Controller/Adminhtml/Quote/GetItemHash.php b/vendor/magento/module-negotiable-quote/Controller/Adminhtml/Quote/GetItemHash.php
2+
index dc5b5b4336c6..7796bb3fa93c 100644
3+
--- a/vendor/magento/module-negotiable-quote/Controller/Adminhtml/Quote/GetItemHash.php
4+
+++ b/vendor/magento/module-negotiable-quote/Controller/Adminhtml/Quote/GetItemHash.php
5+
@@ -63,10 +63,14 @@ public function execute(): ResultInterface
6+
throw new LocalizedException(__('There was a problem updating configuration'));
7+
}
8+
$items = $quote->getAllVisibleItems();
9+
- $item = end($items);
10+
$responseData = [];
11+
- $responseData['new_config_hash'] = $this->quoteItemHashHandler->getItemHashToIdItem($item);
12+
- $responseData['previous_config_hash'] = $data['item_hash'];
13+
+ if (empty($items)) {
14+
+ $responseData['new_config_hash'] = $responseData['previous_config_hash'] = $data['item_hash'];
15+
+ } else {
16+
+ $item = end($items);
17+
+ $responseData['new_config_hash'] = $this->quoteItemHashHandler->getItemHashToIdItem($item);
18+
+ $responseData['previous_config_hash'] = $data['item_hash'];
19+
+ }
20+
$resultJson->setData($responseData);
21+
return $resultJson;
22+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
diff --git a/vendor/magento/module-company/Model/ResourceModel/Company/Collection.php b/vendor/magento/module-company/Model/ResourceModel/Company/Collection.php
2+
index 045e2f3ca1a9..89a09d47bfe4 100644
3+
--- a/vendor/magento/module-company/Model/ResourceModel/Company/Collection.php
4+
+++ b/vendor/magento/module-company/Model/ResourceModel/Company/Collection.php
5+
@@ -31,6 +31,11 @@ class Collection extends AbstractCollection
6+
*/
7+
protected $_idFieldName = 'entity_id';
8+
9+
+ /**
10+
+ * @var array[]
11+
+ */
12+
+ protected $_map = ['fields' => ['entity_id' => 'main_table.entity_id']];
13+
+
14+
/**
15+
* Standard collection initialization.
16+
*
17+
diff --git a/vendor/magento/module-company/Plugin/Company/CollectionFilter.php b/vendor/magento/module-company/Plugin/Company/CollectionFilter.php
18+
index cd5d83a1799f..f7e41d695844 100644
19+
--- a/vendor/magento/module-company/Plugin/Company/CollectionFilter.php
20+
+++ b/vendor/magento/module-company/Plugin/Company/CollectionFilter.php
21+
@@ -106,19 +106,34 @@ private function filterCollection(Collection $collection): void
22+
*/
23+
private function tableBasedFilterByCompanyAdmin(Collection $collection, Role $role): void
24+
{
25+
- $restrictedWebsiteIds = $role->getGwsWebsites();
26+
-
27+
- $existsSelect = $collection->getConnection()->select()->from(
28+
- ['admin_entity' => $collection->getTable('company_advanced_customer_entity')]
29+
- )->joinLeft(
30+
- ['customer_grid_flat' => $collection->getTable('customer_grid_flat')],
31+
- 'admin_entity.customer_id = customer_grid_flat.entity_id',
32+
- ['website_id' => 'website_id']
33+
- )->where('customer_grid_flat.website_id IN (?)', $restrictedWebsiteIds);
34+
-
35+
- $collection->getSelect()->exists(
36+
- $existsSelect,
37+
- 'admin_entity.company_id = main_table.entity_id'
38+
+ $select = $collection->getSelect();
39+
+ if (!$select->getPart(Select::FROM)) {
40+
+ return;
41+
+ }
42+
+ $customerTableAlias = null;
43+
+ $customerTable = $collection->getTable('customer_grid_flat');
44+
+ // Check if the customer table is already joined in the select
45+
+ foreach ($select->getPart(Select::FROM) as $correlationName => $table) {
46+
+ if ($table['tableName'] === $customerTable) {
47+
+ $customerTableAlias = $correlationName ?: $table;
48+
+ break;
49+
+ }
50+
+ }
51+
+ // If the customer table is not joined, we join it
52+
+ if ($customerTableAlias === null) {
53+
+ $customerTableAlias = 'customer_grid_flat';
54+
+ $select
55+
+ ->joinLeft(
56+
+ [$customerTableAlias => $customerTable],
57+
+ $customerTableAlias . '.entity_id=main_table.super_user_id',
58+
+ []
59+
+ );
60+
+ }
61+
+ // Add website filter based on the role's allowed websites
62+
+ $websiteIds = $role->getGwsWebsites();
63+
+ $select->where(
64+
+ $customerTableAlias . '.website_id IN (?)',
65+
+ is_array($websiteIds) ? array_map(fn ($id) => (int) $id, $websiteIds) : $websiteIds
66+
);
67+
}
68+
}
69+

0 commit comments

Comments
 (0)