Skip to content

Commit 7365554

Browse files
author
Magento CICD
authored
merge magento/2.2-develop into magento-tango/PR-2.2
2 parents 045d826 + 9304040 commit 7365554

File tree

242 files changed

+17900
-254
lines changed

Some content is hidden

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

242 files changed

+17900
-254
lines changed

app/code/Magento/Backend/Controller/Adminhtml/Noroute/Index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function execute()
4141
{
4242
/** @var \Magento\Backend\Model\View\Result\Page $resultPage */
4343
$resultPage = $this->resultPageFactory->create();
44-
$resultPage->setStatusHeader(404, '1.1', 'Forbidden');
44+
$resultPage->setStatusHeader(404, '1.1', 'Not Found');
4545
$resultPage->setHeader('Status', '404 File not found');
4646
$resultPage->addHandle('adminhtml_noroute');
4747
return $resultPage;

app/code/Magento/Backend/etc/adminhtml/di.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,4 +147,9 @@
147147
</argument>
148148
</arguments>
149149
</type>
150+
<type name="Magento\Framework\View\Layout\Generator\Block">
151+
<arguments>
152+
<argument name="defaultClass" xsi:type="string">Magento\Backend\Block\Template</argument>
153+
</arguments>
154+
</type>
150155
</config>

app/code/Magento/Bundle/Model/OptionRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ public function save(
208208
}
209209
} else {
210210
if (!$existingOption->getOptionId()) {
211-
throw new NoSuchEntityException('Requested option doesn\'t exist');
211+
throw new NoSuchEntityException(__('Requested option doesn\'t exist'));
212212
}
213213

214214
$option->setData(array_merge($existingOption->getData(), $option->getData()));

app/code/Magento/CatalogInventory/Model/Indexer/Stock/AbstractAction.php

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
use Magento\Framework\App\ObjectManager;
1212
use Magento\Framework\App\ResourceConnection;
13+
use Magento\Framework\EntityManager\MetadataPool;
1314

1415
/**
1516
* Abstract action reindex class
@@ -70,25 +71,33 @@ abstract class AbstractAction
7071
*/
7172
private $cacheCleaner;
7273

74+
/**
75+
* @var MetadataPool
76+
*/
77+
private $metadataPool;
78+
7379
/**
7480
* @param ResourceConnection $resource
7581
* @param \Magento\CatalogInventory\Model\ResourceModel\Indexer\StockFactory $indexerFactory
7682
* @param \Magento\Catalog\Model\Product\Type $catalogProductType
7783
* @param \Magento\Framework\Indexer\CacheContext $cacheContext
7884
* @param \Magento\Framework\Event\ManagerInterface $eventManager
85+
* @param MetadataPool|null $metadataPool
7986
*/
8087
public function __construct(
8188
ResourceConnection $resource,
8289
\Magento\CatalogInventory\Model\ResourceModel\Indexer\StockFactory $indexerFactory,
8390
\Magento\Catalog\Model\Product\Type $catalogProductType,
8491
\Magento\Framework\Indexer\CacheContext $cacheContext,
85-
\Magento\Framework\Event\ManagerInterface $eventManager
92+
\Magento\Framework\Event\ManagerInterface $eventManager,
93+
MetadataPool $metadataPool = null
8694
) {
8795
$this->_resource = $resource;
8896
$this->_indexerFactory = $indexerFactory;
8997
$this->_catalogProductType = $catalogProductType;
9098
$this->cacheContext = $cacheContext;
9199
$this->eventManager = $eventManager;
100+
$this->metadataPool = $metadataPool ?: ObjectManager::getInstance()->get(MetadataPool::class);
92101
}
93102

94103
/**
@@ -154,10 +163,15 @@ protected function _getTable($entityName)
154163
public function getRelationsByChild($childIds)
155164
{
156165
$connection = $this->_getConnection();
157-
$select = $connection->select()
158-
->from($this->_getTable('catalog_product_relation'), 'parent_id')
159-
->where('child_id IN(?)', $childIds);
160-
166+
$linkField = $this->metadataPool->getMetadata(\Magento\Catalog\Api\Data\ProductInterface::class)
167+
->getLinkField();
168+
$select = $connection->select()->from(
169+
['cpe' => $this->_getTable('catalog_product_entity')],
170+
'entity_id'
171+
)->join(
172+
['relation' => $this->_getTable('catalog_product_relation')],
173+
'relation.parent_id = cpe.' . $linkField
174+
)->where('child_id IN(?)', $childIds);
161175
return $connection->fetchCol($select);
162176
}
163177

@@ -230,7 +244,8 @@ protected function _reindexRows($productIds = [])
230244
if (!is_array($productIds)) {
231245
$productIds = [$productIds];
232246
}
233-
247+
$parentIds = $this->getRelationsByChild($productIds);
248+
$productIds = $parentIds ? array_unique(array_merge($parentIds, $productIds)) : $productIds;
234249
$this->getCacheCleaner()->clean($productIds, function () use ($productIds) {
235250
$this->doReindex($productIds);
236251
});
@@ -248,13 +263,10 @@ private function doReindex($productIds = [])
248263
{
249264
$connection = $this->_getConnection();
250265

251-
$parentIds = $this->getRelationsByChild($productIds);
252-
$processIds = $parentIds ? array_merge($parentIds, $productIds) : $productIds;
253-
254266
// retrieve product types by processIds
255267
$select = $connection->select()
256268
->from($this->_getTable('catalog_product_entity'), ['entity_id', 'type_id'])
257-
->where('entity_id IN(?)', $processIds);
269+
->where('entity_id IN(?)', $productIds);
258270
$pairs = $connection->fetchPairs($select);
259271

260272
$byType = [];
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\CatalogInventory\Model\Plugin;
7+
8+
use Magento\Catalog\Model\Product\Action as ProductAction;
9+
10+
/**
11+
* Plugin for Magento\Catalog\Model\Product\Action
12+
*/
13+
class ReindexUpdatedProducts
14+
{
15+
/**
16+
* @var \Magento\CatalogInventory\Model\Indexer\Stock\Processor
17+
*/
18+
private $indexerProcessor;
19+
20+
/**
21+
* @param \Magento\CatalogInventory\Model\Indexer\Stock\Processor $indexerProcessor
22+
*/
23+
public function __construct(\Magento\CatalogInventory\Model\Indexer\Stock\Processor $indexerProcessor)
24+
{
25+
$this->indexerProcessor = $indexerProcessor;
26+
}
27+
28+
/**
29+
* Reindex on product attribute mass change
30+
*
31+
* @param ProductAction $subject
32+
* @param ProductAction $action
33+
* @param array $productIds
34+
* @return ProductAction
35+
*
36+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
37+
*/
38+
public function afterUpdateAttributes(
39+
ProductAction $subject,
40+
ProductAction $action,
41+
$productIds
42+
) {
43+
$this->indexerProcessor->reindexList(array_unique($productIds));
44+
return $action;
45+
}
46+
}

app/code/Magento/CatalogInventory/etc/di.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@
7878
<type name="Magento\Catalog\Model\Product">
7979
<plugin name="catalogInventoryAfterLoad" type="Magento\CatalogInventory\Model\Plugin\AfterProductLoad"/>
8080
</type>
81+
<type name="Magento\Catalog\Model\Product\Action">
82+
<plugin name="ReindexUpdatedProducts" type="Magento\CatalogInventory\Model\Plugin\ReindexUpdatedProducts"/>
83+
</type>
8184
<type name="Magento\CatalogInventory\Setup\UpgradeData">
8285
<arguments>
8386
<argument name="indexerProcessor" xsi:type="object">Magento\CatalogInventory\Model\Indexer\Stock\Processor</argument>

app/code/Magento/Checkout/view/frontend/web/js/region-updater.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ define([
206206
regionInput.removeClass('required-entry');
207207
}
208208

209-
regionList.removeClass('required-entry').hide();
209+
regionList.removeClass('required-entry').prop('disabled', 'disabled').hide();
210210
regionInput.show();
211211
label.attr('for', regionInput.attr('id'));
212212
}

app/code/Magento/Review/Block/Product/ReviewRenderer.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ public function getReviewsSummaryHtml(
5757
$templateType = self::DEFAULT_VIEW,
5858
$displayIfNoReviews = false
5959
) {
60+
if (!$product->getRatingSummary()) {
61+
$this->_reviewFactory->create()->getEntitySummary($product, $this->_storeManager->getStore()->getId());
62+
}
63+
6064
if (!$product->getRatingSummary() && !$displayIfNoReviews) {
6165
return '';
6266
}
@@ -68,9 +72,6 @@ public function getReviewsSummaryHtml(
6872

6973
$this->setDisplayIfEmpty($displayIfNoReviews);
7074

71-
if (!$product->getRatingSummary()) {
72-
$this->_reviewFactory->create()->getEntitySummary($product, $this->_storeManager->getStore()->getId());
73-
}
7475
$this->setProduct($product);
7576

7677
return $this->toHtml();

app/code/Magento/Search/view/frontend/web/form-mini.js

Lines changed: 42 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -286,46 +286,50 @@ define([
286286
$.getJSON(this.options.url, {
287287
q: value
288288
}, $.proxy(function (data) {
289-
$.each(data, function (index, element) {
290-
var html;
291-
292-
element.index = index;
293-
html = template({
294-
data: element
289+
if (data.length) {
290+
$.each(data, function (index, element) {
291+
var html;
292+
293+
element.index = index;
294+
html = template({
295+
data: element
296+
});
297+
dropdown.append(html);
295298
});
296-
dropdown.append(html);
297-
});
298-
this.responseList.indexList = this.autoComplete.html(dropdown)
299-
.css(clonePosition)
300-
.show()
301-
.find(this.options.responseFieldElements + ':visible');
302-
303-
this._resetResponseList(false);
304-
this.element.removeAttr('aria-activedescendant');
305-
306-
if (this.responseList.indexList.length) {
307-
this._updateAriaHasPopup(true);
308-
} else {
309-
this._updateAriaHasPopup(false);
310-
}
311299

312-
this.responseList.indexList
313-
.on('click', function (e) {
314-
this.responseList.selected = $(e.currentTarget);
315-
this.searchForm.trigger('submit');
316-
}.bind(this))
317-
.on('mouseenter mouseleave', function (e) {
318-
this.responseList.indexList.removeClass(this.options.selectClass);
319-
$(e.target).addClass(this.options.selectClass);
320-
this.responseList.selected = $(e.target);
321-
this.element.attr('aria-activedescendant', $(e.target).attr('id'));
322-
}.bind(this))
323-
.on('mouseout', function (e) {
324-
if (!this._getLastElement() && this._getLastElement().hasClass(this.options.selectClass)) {
325-
$(e.target).removeClass(this.options.selectClass);
326-
this._resetResponseList(false);
327-
}
328-
}.bind(this));
300+
this.responseList.indexList = this.autoComplete.html(dropdown)
301+
.css(clonePosition)
302+
.show()
303+
.find(this.options.responseFieldElements + ':visible');
304+
305+
this._resetResponseList(false);
306+
this.element.removeAttr('aria-activedescendant');
307+
308+
if (this.responseList.indexList.length) {
309+
this._updateAriaHasPopup(true);
310+
} else {
311+
this._updateAriaHasPopup(false);
312+
}
313+
314+
this.responseList.indexList
315+
.on('click', function (e) {
316+
this.responseList.selected = $(e.currentTarget);
317+
this.searchForm.trigger('submit');
318+
}.bind(this))
319+
.on('mouseenter mouseleave', function (e) {
320+
this.responseList.indexList.removeClass(this.options.selectClass);
321+
$(e.target).addClass(this.options.selectClass);
322+
this.responseList.selected = $(e.target);
323+
this.element.attr('aria-activedescendant', $(e.target).attr('id'));
324+
}.bind(this))
325+
.on('mouseout', function (e) {
326+
if (!this._getLastElement() &&
327+
this._getLastElement().hasClass(this.options.selectClass)) {
328+
$(e.target).removeClass(this.options.selectClass);
329+
this._resetResponseList(false);
330+
}
331+
}.bind(this));
332+
}
329333
}, this));
330334
} else {
331335
this._resetResponseList(true);
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Signifyd\Api;
7+
8+
/**
9+
* Signifyd case creation interface
10+
*
11+
* Interface of service for new Signifyd case creation and registering it on Magento side.
12+
* Implementation should send request to Signifyd API and create new entity in Magento.
13+
*
14+
* @api
15+
* @since 100.2.0
16+
*/
17+
interface CaseCreationServiceInterface
18+
{
19+
/**
20+
* Create new case for order with specified id.
21+
*
22+
* @param int $orderId
23+
* @return bool
24+
* @throws \Magento\Framework\Exception\NotFoundException If order does not exists
25+
* @throws \Magento\Framework\Exception\AlreadyExistsException If case for $orderId already exists
26+
* @since 100.2.0
27+
*/
28+
public function createForOrder($orderId);
29+
}

0 commit comments

Comments
 (0)