Skip to content

Commit 17441d9

Browse files
committed
Merge remote-tracking branch 'magento2/2.3-develop' into MPI_PR_2019_06_21
2 parents ef9553f + 890bf89 commit 17441d9

File tree

13 files changed

+123
-38
lines changed

13 files changed

+123
-38
lines changed

app/code/Magento/Braintree/view/adminhtml/web/js/braintree.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,11 @@ define([
295295

296296
self.$selector.validate().form();
297297
self.$selector.trigger('afterValidate.beforeSubmit');
298-
$('body').trigger('processStop');
299298

300299
// validate parent form
301300
if (self.$selector.validate().errorList.length) {
301+
$('body').trigger('processStop');
302+
302303
return false;
303304
}
304305

app/code/Magento/CatalogUrlRewrite/Model/ResourceModel/Category/Product.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
7+
declare(strict_types=1);
8+
69
namespace Magento\CatalogUrlRewrite\Model\ResourceModel\Category;
710

811
use Magento\Framework\Model\ResourceModel\Db\AbstractDb;
@@ -49,7 +52,7 @@ protected function _construct()
4952
public function saveMultiple(array $insertData)
5053
{
5154
$connection = $this->getConnection();
52-
if (sizeof($insertData) <= self::CHUNK_SIZE) {
55+
if (count($insertData) <= self::CHUNK_SIZE) {
5356
return $connection->insertMultiple($this->getTable(self::TABLE_NAME), $insertData);
5457
}
5558
$data = array_chunk($insertData, self::CHUNK_SIZE);
@@ -98,10 +101,13 @@ public function removeMultipleByProductCategory(array $filter)
98101
private function prepareSelect($data)
99102
{
100103
$select = $this->getConnection()->select();
101-
$select->from($this->getTable(DbStorage::TABLE_NAME), 'url_rewrite_id');
102-
104+
$select->from(DbStorage::TABLE_NAME);
105+
$select->join(
106+
self::TABLE_NAME,
107+
DbStorage::TABLE_NAME . '.url_rewrite_id = ' . self::TABLE_NAME . '.url_rewrite_id'
108+
);
103109
foreach ($data as $column => $value) {
104-
$select->where($this->getConnection()->quoteIdentifier($column) . ' IN (?)', $value);
110+
$select->where(DbStorage::TABLE_NAME . '.' . $column . ' IN (?)', $value);
105111
}
106112
return $select;
107113
}

app/code/Magento/CatalogUrlRewrite/Observer/UrlRewriteHandler.php

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,19 @@ public function generateProductUrlRewrites(Category $category): array
143143
if ($category->getChangedProductIds()) {
144144
$this->generateChangedProductUrls($mergeDataProvider, $category, $storeId, $saveRewriteHistory);
145145
} else {
146-
$mergeDataProvider->merge(
147-
$this->getCategoryProductsUrlRewrites(
148-
$category,
149-
$storeId,
150-
$saveRewriteHistory,
151-
$category->getEntityId()
152-
)
153-
);
146+
$categoryStoreIds = $this->getCategoryStoreIds($category);
147+
148+
foreach ($categoryStoreIds as $categoryStoreId) {
149+
$this->isSkippedProduct[$category->getEntityId()] = [];
150+
$mergeDataProvider->merge(
151+
$this->getCategoryProductsUrlRewrites(
152+
$category,
153+
$categoryStoreId,
154+
$saveRewriteHistory,
155+
$category->getEntityId()
156+
)
157+
);
158+
}
154159
}
155160

156161
foreach ($this->childrenCategoriesProvider->getChildren($category, true) as $childCategory) {
@@ -241,7 +246,7 @@ private function getCategoryProductsUrlRewrites(
241246
$productCollection = $this->productCollectionFactory->create();
242247

243248
$productCollection->addCategoriesFilter(['eq' => [$category->getEntityId()]])
244-
->setStoreId($storeId)
249+
->addStoreFilter($storeId)
245250
->addAttributeToSelect('name')
246251
->addAttributeToSelect('visibility')
247252
->addAttributeToSelect('url_key')

app/code/Magento/CatalogUrlRewrite/Test/Unit/Observer/UrlRewriteHandlerTest.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,14 @@ public function testGenerateProductUrlRewrites()
138138
->willReturn(1);
139139
$category->expects($this->any())
140140
->method('getData')
141-
->with('save_rewrites_history')
142-
->willReturn(true);
141+
->withConsecutive(
142+
[$this->equalTo('save_rewrites_history')],
143+
[$this->equalTo('initial_setup_flag')]
144+
)
145+
->willReturnOnConsecutiveCalls(
146+
true,
147+
null
148+
);
143149

144150
/* @var \Magento\Catalog\Model\Category|\PHPUnit_Framework_MockObject_MockObject $childCategory1 */
145151
$childCategory1 = $this->getMockBuilder(\Magento\Catalog\Model\Category::class)
@@ -175,6 +181,7 @@ public function testGenerateProductUrlRewrites()
175181
->method('addIdFilter')
176182
->willReturnSelf();
177183
$productCollection->expects($this->any())->method('setStoreId')->willReturnSelf();
184+
$productCollection->expects($this->any())->method('addStoreFilter')->willReturnSelf();
178185
$productCollection->expects($this->any())->method('addAttributeToSelect')->willReturnSelf();
179186
$iterator = new \ArrayIterator([]);
180187
$productCollection->expects($this->any())->method('getIterator')->will($this->returnValue($iterator));

app/code/Magento/CustomerImportExport/Model/Import/Customer.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,12 @@ private function getCustomerEntityFieldsToUpdate(array $entitiesToUpdate): array
288288
{
289289
$firstCustomer = reset($entitiesToUpdate);
290290
$columnsToUpdate = array_keys($firstCustomer);
291-
$customerFieldsToUpdate = array_filter($this->customerFields, function ($field) use ($columnsToUpdate) {
292-
return in_array($field, $columnsToUpdate);
293-
});
291+
$customerFieldsToUpdate = array_filter(
292+
$this->customerFields,
293+
function ($field) use ($columnsToUpdate) {
294+
return in_array($field, $columnsToUpdate);
295+
}
296+
);
294297
return $customerFieldsToUpdate;
295298
}
296299

@@ -423,6 +426,9 @@ protected function _prepareDataForUpdate(array $rowData)
423426
$attributeParameters = $this->_attributes[$attributeCode];
424427
if (in_array($attributeParameters['type'], ['select', 'boolean'])) {
425428
$value = $this->getSelectAttrIdByValue($attributeParameters, $value);
429+
if ($attributeCode === CustomerInterface::GENDER && $value === 0) {
430+
$value = null;
431+
}
426432
} elseif ('multiselect' == $attributeParameters['type']) {
427433
$ids = [];
428434
foreach (explode($multiSeparator, mb_strtolower($value)) as $subValue) {
@@ -519,10 +525,8 @@ protected function _importData()
519525
if (!isset($attributesToSave[$tableName])) {
520526
$attributesToSave[$tableName] = [];
521527
}
522-
$attributesToSave[$tableName] = array_diff_key(
523-
$attributesToSave[$tableName],
524-
$customerAttributes
525-
) + $customerAttributes;
528+
$attributes = array_diff_key($attributesToSave[$tableName], $customerAttributes);
529+
$attributesToSave[$tableName] = $attributes + $customerAttributes;
526530
}
527531
}
528532
}
@@ -578,13 +582,9 @@ protected function _validateRowForUpdate(array $rowData, $rowNumber)
578582
$this->addRowError(self::ERROR_INVALID_STORE, $rowNumber);
579583
}
580584
// check password
581-
if (isset(
582-
$rowData['password']
583-
) && strlen(
584-
$rowData['password']
585-
) && $this->string->strlen(
586-
$rowData['password']
587-
) < self::MIN_PASSWORD_LENGTH
585+
if (isset($rowData['password'])
586+
&& strlen($rowData['password'])
587+
&& $this->string->strlen($rowData['password']) < self::MIN_PASSWORD_LENGTH
588588
) {
589589
$this->addRowError(self::ERROR_PASSWORD_LENGTH, $rowNumber);
590590
}

app/code/Magento/Quote/etc/webapi_rest/di.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
</type>
1212
<type name="Magento\Quote\Model\QuoteRepository">
1313
<plugin name="accessControl" type="Magento\Quote\Model\QuoteRepository\Plugin\AccessChangeQuoteControl" />
14+
<plugin name="authorization" type="Magento\Quote\Model\QuoteRepository\Plugin\Authorization" />
1415
</type>
1516
</config>

app/code/Magento/Quote/etc/webapi_soap/di.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
</type>
1212
<type name="Magento\Quote\Model\QuoteRepository">
1313
<plugin name="accessControl" type="Magento\Quote\Model\QuoteRepository\Plugin\AccessChangeQuoteControl" />
14+
<plugin name="authorization" type="Magento\Quote\Model\QuoteRepository\Plugin\Authorization" />
1415
</type>
1516
</config>

app/code/Magento/Sales/etc/webapi_rest/di.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
9-
<type name="Magento\Quote\Model\QuoteRepository">
10-
<plugin name="authorization" type="Magento\Quote\Model\QuoteRepository\Plugin\Authorization" />
11-
</type>
129
<type name="Magento\Sales\Model\ResourceModel\Order">
1310
<plugin name="authorization" type="Magento\Sales\Model\ResourceModel\Order\Plugin\Authorization" />
1411
</type>

app/code/Magento/Sales/etc/webapi_soap/di.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
9-
<type name="Magento\Quote\Model\QuoteRepository">
10-
<plugin name="authorization" type="Magento\Quote\Model\QuoteRepository\Plugin\Authorization" />
11-
</type>
129
<type name="Magento\Sales\Model\ResourceModel\Order">
1310
<plugin name="authorization" type="Magento\Sales\Model\ResourceModel\Order\Plugin\Authorization" />
1411
</type>

app/code/Magento/Ui/view/base/web/js/grid/columns/expandable.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,11 @@ define([
6767
}
6868
});
6969

70-
return labels.sort();
70+
return labels.sort(
71+
function (labelFirst, labelSecond) {
72+
return labelFirst.toLowerCase().localeCompare(labelSecond.toLowerCase());
73+
}
74+
);
7175
},
7276

7377
/**

0 commit comments

Comments
 (0)