Skip to content

Commit a80915c

Browse files
author
Magento CICD
authored
merge magento/2.1-develop into magento-chaika/PR_in_2.1
2 parents fb239e9 + a91df24 commit a80915c

File tree

17 files changed

+164
-35
lines changed

17 files changed

+164
-35
lines changed

app/code/Magento/Catalog/Model/Indexer/Category/Flat/AbstractAction.php

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,25 +369,55 @@ protected function getAttributeValues($entityIds, $storeId)
369369
}
370370
$values = [];
371371

372-
foreach ($entityIds as $entityId) {
373-
$values[$entityId] = [];
372+
$linkIds = $this->getLinkIds($entityIds);
373+
foreach ($linkIds as $linkId) {
374+
$values[$linkId] = [];
374375
}
376+
375377
$attributes = $this->getAttributes();
376378
$attributesType = ['varchar', 'int', 'decimal', 'text', 'datetime'];
379+
$linkField = $this->getCategoryMetadata()->getLinkField();
377380
foreach ($attributesType as $type) {
378381
foreach ($this->getAttributeTypeValues($type, $entityIds, $storeId) as $row) {
379-
if (isset($row[$this->getCategoryMetadata()->getLinkField()]) && isset($row['attribute_id'])) {
382+
if (isset($row[$linkField]) && isset($row['attribute_id'])) {
380383
$attributeId = $row['attribute_id'];
381384
if (isset($attributes[$attributeId])) {
382385
$attributeCode = $attributes[$attributeId]['attribute_code'];
383-
$values[$row[$this->getCategoryMetadata()->getLinkField()]][$attributeCode] = $row['value'];
386+
$values[$row[$linkField]][$attributeCode] = $row['value'];
384387
}
385388
}
386389
}
387390
}
391+
388392
return $values;
389393
}
390394

395+
/**
396+
* Translate entity ids into link ids
397+
*
398+
* Used for rows with no EAV attributes set.
399+
*
400+
* @param array $entityIds
401+
* @return array
402+
*/
403+
private function getLinkIds(array $entityIds)
404+
{
405+
$linkField = $this->getCategoryMetadata()->getLinkField();
406+
if ($linkField === 'entity_id') {
407+
return $entityIds;
408+
}
409+
410+
$select = $this->connection->select()->from(
411+
['e' => $this->connection->getTableName($this->getTableName('catalog_category_entity'))],
412+
[$linkField]
413+
)->where(
414+
'e.entity_id IN (?)',
415+
$entityIds
416+
);
417+
418+
return $this->connection->fetchCol($select);
419+
}
420+
391421
/**
392422
* Return attribute values for given entities and store of specific attribute type
393423
*

app/code/Magento/Catalog/Model/Indexer/Category/Flat/Action/Full.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,22 @@ protected function populateFlatTables(array $stores)
6464
}
6565
/** @TODO Do something with chunks */
6666
$categoriesIdsChunks = array_chunk($categoriesIds[$store->getRootCategoryId()], 500);
67+
6768
foreach ($categoriesIdsChunks as $categoriesIdsChunk) {
6869
$attributesData = $this->getAttributeValues($categoriesIdsChunk, $store->getId());
70+
$linkField = $this->categoryMetadata->getLinkField();
71+
6972
$data = [];
7073
foreach ($categories[$store->getRootCategoryId()] as $category) {
71-
if (!isset($attributesData[$category[$this->categoryMetadata->getLinkField()]])) {
74+
if (!isset($attributesData[$category[$linkField]])) {
7275
continue;
7376
}
7477
$category['store_id'] = $store->getId();
7578
$data[] = $this->prepareValuesToInsert(
76-
array_merge($category, $attributesData[$category[$this->categoryMetadata->getLinkField()]])
79+
array_merge($category, $attributesData[$category[$linkField]])
7780
);
7881
}
82+
7983
$this->connection->insertMultiple(
8084
$this->addTemporaryTableSuffix($this->getMainStoreTable($store->getId())),
8185
$data

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,22 +69,24 @@ public function reindex(array $entityIds = [], $useTempTable = false)
6969
$categoriesIdsChunk = $this->filterIdsByStore($categoriesIdsChunk, $store);
7070

7171
$attributesData = $this->getAttributeValues($categoriesIdsChunk, $store->getId());
72+
$linkField = $this->categoryMetadata->getLinkField();
7273
$data = [];
7374
foreach ($categoriesIdsChunk as $categoryId) {
74-
if (!isset($attributesData[$categoryId])) {
75-
continue;
76-
}
77-
7875
try {
7976
$category = $this->categoryRepository->get($categoryId);
8077
} catch (NoSuchEntityException $e) {
8178
continue;
8279
}
8380

81+
$categoryData = $category->getData();
82+
if (!isset($attributesData[$categoryData[$linkField]])) {
83+
continue;
84+
}
85+
8486
$data[] = $this->prepareValuesToInsert(
8587
array_merge(
86-
$category->getData(),
87-
$attributesData[$categoryId],
88+
$categoryData,
89+
$attributesData[$categoryData[$linkField]],
8890
['store_id' => $store->getId()]
8991
)
9092
);

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,11 @@ protected function _createTemporaryFlatTable($storeId)
179179

180180
$columnComment = isset($fieldProp['comment']) ? $fieldProp['comment'] : $fieldName;
181181

182+
if ($fieldName == 'created_at') {
183+
$columnDefinition['nullable'] = true;
184+
$columnDefinition['default'] = null;
185+
}
186+
182187
$table->addColumn($fieldName, $fieldProp['type'], $columnLength, $columnDefinition, $columnComment);
183188
}
184189

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ public function getProduct()
191191
public function saveValues()
192192
{
193193
foreach ($this->getValues() as $value) {
194+
$this->isDeleted(false);
194195
$this->setData(
195196
$value
196197
)->setData(

app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ define(
261261
emailValidationResult = customer.isLoggedIn();
262262

263263
if (!quote.shippingMethod()) {
264-
this.errorValidationMessage('Please specify a shipping method.');
264+
this.errorValidationMessage($t('Please specify a shipping method.'));
265265

266266
return false;
267267
}

app/code/Magento/Customer/Api/CustomerRepositoryInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function save(\Magento\Customer\Api\Data\CustomerInterface $customer, $pa
3737
public function get($email, $websiteId = null);
3838

3939
/**
40-
* Get customer by customer ID.
40+
* Get customer by Customer ID.
4141
*
4242
* @param int $customerId
4343
* @return \Magento\Customer\Api\Data\CustomerInterface
@@ -69,7 +69,7 @@ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCr
6969
public function delete(\Magento\Customer\Api\Data\CustomerInterface $customer);
7070

7171
/**
72-
* Delete customer by ID.
72+
* Delete customer by Customer ID.
7373
*
7474
* @param int $customerId
7575
* @return bool true on success

app/code/Magento/Customer/Model/AccountManagement.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,8 +523,13 @@ public function initiatePasswordReset($email, $template, $websiteId = null)
523523
default:
524524
throw new InputException(
525525
__(
526-
'Invalid value of "%value" provided for the %fieldName field.',
527-
['value' => $template, 'fieldName' => 'email type']
526+
'Invalid value of "%value" provided for the %fieldName field. Possible values are %template1 or %template2.',
527+
[
528+
'value' => $template,
529+
'fieldName' => 'template',
530+
'template1' => AccountManagement::EMAIL_REMINDER,
531+
'template2' => AccountManagement::EMAIL_RESET
532+
]
528533
)
529534
);
530535
}

app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,10 +1192,6 @@ public function testInitiatePasswordResetEmailReset()
11921192
$this->assertTrue($this->accountManagement->initiatePasswordReset($email, $template));
11931193
}
11941194

1195-
/**
1196-
* @expectedException \Magento\Framework\Exception\InputException
1197-
* @expectedExceptionMessage Invalid value of "" provided for the email type field
1198-
*/
11991195
public function testInitiatePasswordResetNoTemplate()
12001196
{
12011197
$storeId = 1;
@@ -1211,6 +1207,10 @@ public function testInitiatePasswordResetNoTemplate()
12111207

12121208
$this->prepareInitiatePasswordReset($email, $templateIdentifier, $sender, $storeId, $customerId, $hash);
12131209

1210+
$this->setExpectedException(
1211+
\Magento\Framework\Exception\InputException::class,
1212+
'Invalid value of "" provided for the template field. Possible values are email_reminder or email_reset.'
1213+
);
12141214
$this->accountManagement->initiatePasswordReset($email, $template);
12151215
}
12161216

app/code/Magento/Customer/etc/webapi.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
<resource ref="anonymous"/>
123123
</resources>
124124
</route>
125-
<route url="/V1/customers/:id" method="PUT">
125+
<route url="/V1/customers/:customerId" method="PUT">
126126
<service class="Magento\Customer\Api\CustomerRepositoryInterface" method="save"/>
127127
<resources>
128128
<resource ref="Magento_Customer::manage"/>

0 commit comments

Comments
 (0)