Skip to content

Commit c5c94de

Browse files
Merge branch 'develop' of github.com:magento-folks/magento2ce into bugfix
2 parents ec90002 + 14028aa commit c5c94de

File tree

53 files changed

+977
-277
lines changed

Some content is hidden

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

53 files changed

+977
-277
lines changed

app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,10 @@ public function execute()
9999
return $this->ajaxRequestResponse($category, $resultPage);
100100
}
101101

102+
$resultPageTitle = $categoryId ? $category->getName() . ' (ID: ' . $categoryId . ')' : __('Categories');
102103
$resultPage->setActiveMenu('Magento_Catalog::catalog_categories');
103104
$resultPage->getConfig()->getTitle()->prepend(__('Categories'));
104-
$resultPage->getConfig()->getTitle()->prepend($categoryId ? $category->getName() : __('Categories'));
105+
$resultPage->getConfig()->getTitle()->prepend($resultPageTitle);
105106
$resultPage->addBreadcrumb(__('Manage Catalog Categories'), __('Manage Categories'));
106107

107108
$block = $resultPage->getLayout()->getBlock('catalog.wysiwyg.js');

app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@
208208
},
209209

210210
submit : function() {
211+
var i, child, newNode;
212+
211213
if( TreePanels.root.firstChild == TreePanels.root.lastChild ) {
212214
return;
213215
}
@@ -221,6 +223,7 @@
221223

222224
if( editSet.currentNode && editSet.currentNode.attributes.cls == 'folder' ) {
223225
TreePanels.root.removeChild(editSet.currentNode);
226+
224227
for( i in editSet.currentNode.childNodes ) {
225228
if( editSet.currentNode.childNodes[i].id ) {
226229
child = editSet.currentNode.childNodes[i];
@@ -231,12 +234,20 @@
231234
}
232235
}
233236
}
237+
234238
editSet.req.removeGroups[editSet.currentNode.id] = editSet.currentNode.id;
235239
editSet.currentNode = false;
236240
}
237241
},
238242

239243
SystemNodesExists : function(currentNode) {
244+
if (!currentNode) {
245+
alert({
246+
content: '<?php echo $block->escapeJs(__('Please select a node.')) ?>'
247+
});
248+
return;
249+
}
250+
240251
for (i in currentNode.childNodes) {
241252
if (currentNode.childNodes[i].id) {
242253
child = editSet.currentNode.childNodes[i];
@@ -253,31 +264,40 @@
253264

254265
addGroup : function() {
255266
prompt({
267+
title: "<?php /* @escapeNotVerified */ echo __('Add New Group') ?>",
256268
content: "<?php /* @escapeNotVerified */ echo __('Please enter a new group name.') ?>",
257269
value: "",
270+
validation: true,
271+
validationRules: ['required-entry'],
272+
attributesForm: {
273+
novalidate: 'novalidate',
274+
action: ''
275+
},
276+
attributesField: {
277+
name: 'name',
278+
'data-validate': '{required:true}',
279+
maxlength: '255'
280+
},
258281
actions: {
259282
confirm: function (group_name) {
260283
group_name = group_name.strip();
261-
if( group_name == '' ) {
262-
self.addGroup();
263-
} else if( group_name != false && group_name != null && group_name != '' ) {
264-
265-
if (!editSet.validateGroupName(group_name, 0)) {
266-
return;
267-
}
268-
269-
var newNode = new Ext.tree.TreeNode({
270-
text : group_name.escapeHTML(),
271-
cls : 'folder',
272-
allowDrop : true,
273-
allowDrag : true
274-
});
275-
TreePanels.root.appendChild(newNode);
276-
newNode.addListener('beforemove', editSet.groupBeforeMove);
277-
newNode.addListener('beforeinsert', editSet.groupBeforeInsert);
278-
newNode.addListener('beforeappend', editSet.groupBeforeInsert);
279-
newNode.addListener('click', editSet.register);
284+
285+
if (!editSet.validateGroupName(group_name, 0)) {
286+
return;
280287
}
288+
289+
var newNode = new Ext.tree.TreeNode({
290+
text : group_name.escapeHTML(),
291+
cls : 'folder',
292+
allowDrop : true,
293+
allowDrag : true
294+
});
295+
296+
TreePanels.root.appendChild(newNode);
297+
newNode.addListener('beforemove', editSet.groupBeforeMove);
298+
newNode.addListener('beforeinsert', editSet.groupBeforeInsert);
299+
newNode.addListener('beforeappend', editSet.groupBeforeInsert);
300+
newNode.addListener('click', editSet.register);
281301
}
282302
}
283303
});
@@ -302,7 +322,7 @@
302322
}
303323
for (var i=0; i < TreePanels.root.childNodes.length; i++) {
304324
if (TreePanels.root.childNodes[i].text.toLowerCase() == name.toLowerCase() && TreePanels.root.childNodes[i].id != exceptNodeId) {
305-
errorText = '<?php /* @escapeNotVerified */ echo __('An attribute group named "/name/" already exists".') ?>';
325+
errorText = '<?php /* @escapeNotVerified */ echo __('An attribute group named "/name/" already exists.') ?>';
306326
alert({
307327
content: errorText.replace("/name/",name)
308328
});

app/code/Magento/Catalog/view/adminhtml/web/catalog/product-attributes.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ define([
66
'jquery',
77
'underscore',
88
'uiRegistry',
9-
'jquery/ui'
9+
'jquery/ui',
10+
'mage/translate'
1011
], function ($, _, registry) {
1112
'use strict';
1213

app/code/Magento/Catalog/view/adminhtml/web/component/image-size-field.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ define([
77
'jquery',
88
'Magento_Ui/js/lib/validation/utils',
99
'Magento_Ui/js/form/element/abstract',
10-
'Magento_Ui/js/lib/validation/validator'
10+
'Magento_Ui/js/lib/validation/validator',
11+
'mage/translate'
1112
], function ($, utils, Abstract, validator) {
1213
'use strict';
1314

app/code/Magento/Catalog/view/frontend/web/js/view/compare-products.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,31 @@
44
*/
55
define([
66
'uiComponent',
7-
'Magento_Customer/js/customer-data'
7+
'Magento_Customer/js/customer-data',
8+
'mage/translate'
89
], function (Component, customerData) {
910
'use strict';
1011

1112
var sidebarInitialized = false;
1213

1314
function initSidebar() {
1415
if (sidebarInitialized) {
15-
return ;
16+
return;
1617
}
1718
sidebarInitialized = true;
1819
require([
1920
'jquery',
2021
'mage/mage'
2122
], function ($) {
23+
/*eslint-disable max-len*/
2224
$('[data-role=compare-products-sidebar]').mage('compareItems', {
23-
"removeConfirmMessage": $.mage.__(
24-
"Are you sure you want to remove this item from your Compare Products list?"
25-
),
26-
"removeSelector": "#compare-items a.action.delete",
27-
"clearAllConfirmMessage": $.mage.__(
28-
"Are you sure you want to remove all items from your Compare Products list?"
29-
),
30-
"clearAllSelector": "#compare-clear-all"
25+
'removeConfirmMessage': $.mage.__('Are you sure you want to remove this item from your Compare Products list?'),
26+
'removeSelector': '#compare-items a.action.delete',
27+
'clearAllConfirmMessage': $.mage.__('Are you sure you want to remove all items from your Compare Products list?'),
28+
'clearAllSelector': '#compare-clear-all'
3129
});
30+
31+
/*eslint-enable max-len*/
3232
});
3333
}
3434

app/code/Magento/CatalogInventory/Block/Stockqty/AbstractStockqty.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ abstract class AbstractStockqty extends \Magento\Framework\View\Element\Template
1515
{
1616
/**
1717
* Threshold qty config path
18+
* @deprecated
19+
* @see \Magento\CatalogInventory\Model\Configuration::XML_PATH_STOCK_THRESHOLD_QTY
1820
*/
1921
const XML_PATH_STOCK_THRESHOLD_QTY = 'cataloginventory/options/stock_threshold_qty';
2022

app/code/Magento/CatalogInventory/Model/Configuration.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ class Configuration implements StockConfigurationInterface
9696
*/
9797
const XML_PATH_DISPLAY_PRODUCT_STOCK_STATUS = 'cataloginventory/options/display_product_stock_status';
9898

99+
/**
100+
* Threshold qty config path
101+
*/
102+
const XML_PATH_STOCK_THRESHOLD_QTY = 'cataloginventory/options/stock_threshold_qty';
103+
99104
/**
100105
* @var ConfigInterface
101106
*/
@@ -385,6 +390,19 @@ public function getDefaultConfigValue($field, $store = null)
385390
);
386391
}
387392

393+
/**
394+
* @param null|string|bool|int|\Magento\Store\Model\Store $store
395+
* @return string|null
396+
*/
397+
public function getStockThresholdQty($store = null)
398+
{
399+
return $this->scopeConfig->getValue(
400+
self::XML_PATH_STOCK_THRESHOLD_QTY,
401+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
402+
$store
403+
);
404+
}
405+
388406
/**
389407
* Retrieve inventory item options (used in config)
390408
*

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

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88

99
namespace Magento\CatalogInventory\Model\Indexer\Stock;
1010

11-
use Magento\Catalog\Model\Category;
12-
use Magento\Catalog\Model\Product;
11+
use Magento\Framework\App\ObjectManager;
1312
use Magento\Framework\App\ResourceConnection;
1413

1514
/**
@@ -66,6 +65,11 @@ abstract class AbstractAction
6665
*/
6766
private $eventManager;
6867

68+
/**
69+
* @var CacheCleaner
70+
*/
71+
private $cacheCleaner;
72+
6973
/**
7074
* @param ResourceConnection $resource
7175
* @param \Magento\CatalogInventory\Model\ResourceModel\Indexer\StockFactory $indexerFactory
@@ -219,14 +223,31 @@ protected function _deleteOldRelations($tableName)
219223
* Refresh entities index
220224
*
221225
* @param array $productIds
222-
* @return array Affected ids
226+
* @return $this
223227
*/
224228
protected function _reindexRows($productIds = [])
225229
{
226-
$connection = $this->_getConnection();
227230
if (!is_array($productIds)) {
228231
$productIds = [$productIds];
229232
}
233+
234+
$this->getCacheCleaner()->clean($productIds, function () use ($productIds) {
235+
$this->doReindex($productIds);
236+
});
237+
238+
return $this;
239+
}
240+
241+
/**
242+
* Refresh entities index
243+
*
244+
* @param array $productIds
245+
* @return void
246+
*/
247+
private function doReindex($productIds = [])
248+
{
249+
$connection = $this->_getConnection();
250+
230251
$parentIds = $this->getRelationsByChild($productIds);
231252
$processIds = $parentIds ? array_merge($parentIds, $productIds) : $productIds;
232253

@@ -247,11 +268,17 @@ protected function _reindexRows($productIds = [])
247268
$indexer->reindexEntity($byType[$indexer->getTypeId()]);
248269
}
249270
}
250-
251-
$this->cacheContext->registerEntities(Product::CACHE_TAG, $productIds);
252-
$this->eventManager->dispatch('clean_cache_by_tags', ['object' => $this->cacheContext]);
253-
254-
return $this;
271+
}
272+
273+
/**
274+
* @return CacheCleaner
275+
*/
276+
private function getCacheCleaner()
277+
{
278+
if (null === $this->cacheCleaner) {
279+
$this->cacheCleaner = ObjectManager::getInstance()->get(CacheCleaner::class);
280+
}
281+
return $this->cacheCleaner;
255282
}
256283

257284
/**

0 commit comments

Comments
 (0)