Skip to content

Commit bd6b79d

Browse files
Merge remote-tracking branch 'upstream/2.2-develop' into 2.2-develop
2 parents d040a1b + 9cfd602 commit bd6b79d

File tree

9 files changed

+60
-27
lines changed

9 files changed

+60
-27
lines changed

app/code/Magento/Backend/Block/GlobalSearch.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public function getWidgetInitOptions()
7373
'filterProperty' => 'name',
7474
'preventClickPropagation' => false,
7575
'minLength' => 2,
76+
'submitInputOnEnter' => false,
7677
]
7778
];
7879
}

app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Widget/Chooser/Sku.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ protected function _prepareColumns()
207207
public function getGridUrl()
208208
{
209209
return $this->getUrl(
210-
'catalog_rule/*/chooser',
210+
'*/*/chooser',
211211
['_current' => true, 'current_grid_id' => $this->getId(), 'collapse' => null]
212212
);
213213
}

app/code/Magento/CatalogSearch/Ui/DataProvider/Product/AddFulltextFilterToCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Magento\Ui\DataProvider\AddFilterToCollectionInterface;
1212

1313
/**
14-
* Class AddFulltextFilterToCollection
14+
* Adds FullText search to Product Data Provider
1515
*/
1616
class AddFulltextFilterToCollection implements AddFilterToCollectionInterface
1717
{

app/code/Magento/Paypal/Model/Express/Checkout.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,9 @@ public function place($token, $shippingMethodCode = null)
809809
case \Magento\Sales\Model\Order::STATE_PROCESSING:
810810
case \Magento\Sales\Model\Order::STATE_COMPLETE:
811811
case \Magento\Sales\Model\Order::STATE_PAYMENT_REVIEW:
812-
$this->orderSender->send($order);
812+
if (!$order->getEmailSent()) {
813+
$this->orderSender->send($order);
814+
}
813815
$this->_checkoutSession->start();
814816
break;
815817
default:

app/code/Magento/Quote/Model/ResourceModel/Quote/Item/Collection.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ class Collection extends \Magento\Framework\Model\ResourceModel\Db\VersionContro
4545
*/
4646
protected $_quoteConfig;
4747

48+
/**
49+
* @var \Magento\Store\Model\StoreManagerInterface|null
50+
*/
51+
private $storeManager;
52+
4853
/**
4954
* @param \Magento\Framework\Data\Collection\EntityFactory $entityFactory
5055
* @param \Psr\Log\LoggerInterface $logger
@@ -56,6 +61,7 @@ class Collection extends \Magento\Framework\Model\ResourceModel\Db\VersionContro
5661
* @param \Magento\Quote\Model\Quote\Config $quoteConfig
5762
* @param \Magento\Framework\DB\Adapter\AdapterInterface $connection
5863
* @param \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource
64+
* @param \Magento\Store\Model\StoreManagerInterface|null $storeManager
5965
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
6066
*/
6167
public function __construct(
@@ -68,7 +74,8 @@ public function __construct(
6874
\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory,
6975
\Magento\Quote\Model\Quote\Config $quoteConfig,
7076
\Magento\Framework\DB\Adapter\AdapterInterface $connection = null,
71-
\Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null
77+
\Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null,
78+
\Magento\Store\Model\StoreManagerInterface $storeManager = null
7279
) {
7380
parent::__construct(
7481
$entityFactory,
@@ -82,6 +89,10 @@ public function __construct(
8289
$this->_itemOptionCollectionFactory = $itemOptionCollectionFactory;
8390
$this->_productCollectionFactory = $productCollectionFactory;
8491
$this->_quoteConfig = $quoteConfig;
92+
93+
// Backward compatibility constructor parameters
94+
$this->storeManager = $storeManager ?:
95+
\Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Store\Model\StoreManagerInterface::class);
8596
}
8697

8798
/**
@@ -101,7 +112,10 @@ protected function _construct()
101112
*/
102113
public function getStoreId()
103114
{
104-
return (int)$this->_productCollectionFactory->create()->getStoreId();
115+
// Fallback to current storeId if no quote is provided
116+
// (see https://github.com/magento/magento2/commit/9d3be732a88884a66d667b443b3dc1655ddd0721)
117+
return $this->_quote === null ?
118+
(int) $this->storeManager->getStore()->getId() : (int) $this->_quote->getStoreId();
105119
}
106120

107121
/**

app/code/Magento/Search/Model/SynonymAnalyzer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function getSynonymsForPhrase($phrase)
8282
/**
8383
* Helper method to find the matching of $pattern to $synonymGroupsToExamine.
8484
* If matches, the particular array index is returned.
85-
* Otherwise false will be returned.
85+
* Otherwise null will be returned.
8686
*
8787
* @param string $pattern
8888
* @param array $synonymGroupsToExamine

app/code/Magento/Ui/view/base/web/js/modal/modal.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,12 @@ define([
336336
* Set z-index and margin for modal and overlay.
337337
*/
338338
_setActive: function () {
339-
var zIndex = this.modal.zIndex();
339+
var zIndex = this.modal.zIndex(),
340+
baseIndex = zIndex + this._getVisibleCount();
340341

342+
this.overlay.zIndex(++baseIndex);
341343
this.prevOverlayIndex = this.overlay.zIndex();
342-
this.modal.zIndex(zIndex + this._getVisibleCount());
343-
this.overlay.zIndex(zIndex + (this._getVisibleCount() - 1));
344+
this.modal.zIndex(this.overlay.zIndex() + 1);
344345

345346
if (this._getVisibleSlideCount()) {
346347
this.modal.css('marginLeft', this.options.modalLeftMargin * this._getVisibleSlideCount());
@@ -354,7 +355,14 @@ define([
354355
this.modal.removeAttr('style');
355356

356357
if (this.overlay) {
357-
this.overlay.zIndex(this.prevOverlayIndex);
358+
// In cases when one modal is closed but there is another modal open (e.g. admin notifications)
359+
// to avoid collisions between overlay and modal zIndexes
360+
// overlay zIndex is set to be less than modal one
361+
if (this._getVisibleCount() === 1) {
362+
this.overlay.zIndex(this.prevOverlayIndex - 1);
363+
} else {
364+
this.overlay.zIndex(this.prevOverlayIndex);
365+
}
358366
}
359367
},
360368

dev/tests/functional/tests/app/Magento/CatalogRule/Test/Page/Adminhtml/CatalogRuleNew.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
<page name="CatalogRuleNew" area="Adminhtml" mca="catalog_rule/promo_catalog/new" module="Magento_CatalogRule">
1010
<block name="formPageActions" class="Magento\CatalogRule\Test\Block\Adminhtml\FormPageActions" locator=".page-main-actions" strategy="css selector"/>
1111
<block name="editForm" class="Magento\CatalogRule\Test\Block\Adminhtml\Promo\Catalog\Edit\PromoForm" locator="[id='page:main-container']" strategy="css selector"/>
12-
<block name="modalBlock" class="Magento\Ui\Test\Block\Adminhtml\Modal" locator="._show[data-role=modal][style='z-index: 900;']" strategy="css selector"/>
12+
<block name="modalBlock" class="Magento\Ui\Test\Block\Adminhtml\Modal" locator="._show[data-role=modal][style='z-index: 902;']" strategy="css selector"/>
1313
</page>
1414
</config>

lib/web/mage/backend/suggest.js

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@
6565
inputWrapper: '<div class="mage-suggest"><div class="mage-suggest-inner"></div></div>',
6666
dropdownWrapper: '<div class="mage-suggest-dropdown"></div>',
6767
preventClickPropagation: true,
68-
currentlySelected: null
68+
currentlySelected: null,
69+
submitInputOnEnter: true
6970
},
7071

7172
/**
@@ -79,7 +80,6 @@
7980
label: ''
8081
};
8182
this.templates = {};
82-
8383
this._renderedContext = null;
8484
this._selectedItem = this._nonSelectedItem;
8585
this._control = this.options.controls || {};
@@ -312,18 +312,23 @@
312312
click: this.search
313313
}, this.options.events));
314314

315+
this._bindSubmit();
315316
this._bindDropdown();
316317
},
317318

318319
/**
319-
* @param {Object} event - event object
320+
* @param {Object} event
320321
* @private
321322
*/
322323
_toggleEnter: function (event) {
323324
var suggestList,
324325
activeItems,
325326
selectedItem;
326327

328+
if (!this.options.submitInputOnEnter) {
329+
event.preventDefault();
330+
}
331+
327332
suggestList = $(event.currentTarget.parentNode).find('ul').first();
328333
activeItems = suggestList.find('._active');
329334

@@ -333,12 +338,22 @@
333338
if (selectedItem.find('a') && selectedItem.find('a').attr('href') !== undefined) {
334339
window.location = selectedItem.find('a').attr('href');
335340
event.preventDefault();
336-
337-
return false;
338341
}
339342
}
340343
},
341344

345+
/**
346+
* Bind handlers for submit on enter
347+
* @private
348+
*/
349+
_bindSubmit: function () {
350+
this.element.parents('form').on('submit', function (event) {
351+
if (!this.submitInputOnEnter) {
352+
event.preventDefault();
353+
}
354+
});
355+
},
356+
342357
/**
343358
* @param {Object} e - event object
344359
* @private
@@ -465,8 +480,8 @@
465480
}
466481

467482
if (this._trigger('beforeselect', e || null, {
468-
item: this._focused
469-
}) === false) {
483+
item: this._focused
484+
}) === false) {
470485
return;
471486
}
472487
this._selectItem(e);
@@ -701,9 +716,6 @@
701716
if ($.isArray(o.source)) {
702717
response(this.filter(o.source, term));
703718
} else if ($.type(o.source) === 'string') {
704-
if (this._xhr) {
705-
this._xhr.abort();
706-
}
707719
ajaxData = {};
708720
ajaxData[this.options.termAjaxArgument] = term;
709721

@@ -729,10 +741,6 @@
729741
_abortSearch: function () {
730742
this.element.removeClass(this.options.loadingClass);
731743
clearTimeout(this._searchTimeout);
732-
733-
if (this._xhr) {
734-
this._xhr.abort();
735-
}
736744
},
737745

738746
/**
@@ -905,8 +913,8 @@
905913
'<li class="mage-suggest-search-field" data-role="parent-choice-element"><' +
906914
'label class="mage-suggest-search-label"></label></li></ul>',
907915
choiceTemplate: '<li class="mage-suggest-choice button"><div><%- text %></div>' +
908-
'<span class="mage-suggest-choice-close" tabindex="-1" ' +
909-
'data-mage-init=\'{"actionLink":{"event":"removeOption"}}\'></span></li>',
916+
'<span class="mage-suggest-choice-close" tabindex="-1" ' +
917+
'data-mage-init=\'{"actionLink":{"event":"removeOption"}}\'></span></li>',
910918
selectedClass: 'mage-suggest-selected'
911919
},
912920

0 commit comments

Comments
 (0)