Skip to content

Commit f0d995f

Browse files
committed
Merge remote-tracking branch 'mainline/2.2-develop' into MAGETWO-86143
2 parents da7a363 + 44502ff commit f0d995f

File tree

15 files changed

+308
-193
lines changed

15 files changed

+308
-193
lines changed

app/code/Magento/Catalog/view/base/web/js/price-options.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ define([
2020
optionConfig: {},
2121
optionHandlers: {},
2222
optionTemplate: '<%= data.label %>' +
23-
'<% if (data.finalPrice.value) { %>' +
23+
'<% if (data.finalPrice.value > 0) { %>' +
2424
' +<%- data.finalPrice.formatted %>' +
25+
'<% } else if (data.finalPrice.value < 0) { %>' +
26+
' <%- data.finalPrice.formatted %>' +
2527
'<% } %>',
2628
controlContainer: 'dd'
2729
};

app/code/Magento/Catalog/view/frontend/web/js/product/breadcrumbs.js

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,6 @@ define([
1919
menuContainer: '[data-action="navigation"] > ul'
2020
},
2121

22-
/** @inheritdoc */
23-
_init: function () {
24-
var menu;
25-
26-
// render breadcrumbs after navigation menu is loaded.
27-
menu = $(this.options.menuContainer).data('mageMenu');
28-
29-
if (typeof menu === 'undefined') {
30-
this._on($(this.options.menuContainer), {
31-
'menucreate': this._super
32-
});
33-
} else {
34-
this._super();
35-
}
36-
},
37-
3822
/** @inheritdoc */
3923
_render: function () {
4024
this._appendCatalogCrumbs();
@@ -87,18 +71,10 @@ define([
8771
* @private
8872
*/
8973
_getCategoryCrumb: function (menuItem) {
90-
var categoryId,
91-
categoryName,
92-
categoryUrl;
93-
94-
categoryId = /(\d+)/i.exec(menuItem.attr('id'))[0];
95-
categoryName = menuItem.text();
96-
categoryUrl = menuItem.attr('href');
97-
9874
return {
99-
'name': 'category' + categoryId,
100-
'label': categoryName,
101-
'link': categoryUrl,
75+
'name': 'category',
76+
'label': menuItem.text(),
77+
'link': menuItem.attr('href'),
10278
'title': ''
10379
};
10480
},

app/code/Magento/Email/Model/AbstractTemplate.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -534,10 +534,9 @@ protected function cancelDesignConfig()
534534
*/
535535
public function setForcedArea($templateId)
536536
{
537-
if ($this->area) {
538-
throw new \LogicException(__('Area is already set'));
537+
if (!isset($this->area)) {
538+
$this->area = $this->emailConfig->getTemplateArea($templateId);
539539
}
540-
$this->area = $this->emailConfig->getTemplateArea($templateId);
541540
return $this;
542541
}
543542

app/code/Magento/ImportExport/Model/Import/AbstractEntity.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ public function validateData()
831831
if (!$this->isAttributeParticular($columnName)) {
832832
if (trim($columnName) == '') {
833833
$emptyHeaderColumns[] = $columnNumber;
834-
} elseif (!preg_match('/^[a-z][a-z0-9_]*$/', $columnName)) {
834+
} elseif (!preg_match('/^[a-z][\w]*$/u', $columnName)) {
835835
$invalidColumns[] = $columnName;
836836
} elseif ($this->needColumnCheck && !in_array($columnName, $this->getValidColumnNames())) {
837837
$invalidAttributes[] = $columnName;

app/code/Magento/ImportExport/Model/Import/Entity/AbstractEntity.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ public function validateData()
803803
if (!$this->isAttributeParticular($columnName)) {
804804
if (trim($columnName) == '') {
805805
$emptyHeaderColumns[] = $columnNumber;
806-
} elseif (!preg_match('/^[a-z][a-z0-9_]*$/', $columnName)) {
806+
} elseif (!preg_match('/^[a-z][\w]*$/u', $columnName)) {
807807
$invalidColumns[] = $columnName;
808808
} elseif ($this->needColumnCheck && !in_array($columnName, $this->getValidColumnNames())) {
809809
$invalidAttributes[] = $columnName;

app/code/Magento/Sales/Model/Order/ItemRepository.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ public function get($id)
114114
}
115115

116116
$this->addProductOption($orderItem);
117+
$this->addParentItem($orderItem);
117118
$this->registry[$id] = $orderItem;
118119
}
119120
return $this->registry[$id];
@@ -213,6 +214,20 @@ protected function addProductOption(OrderItemInterface $orderItem)
213214
return $this;
214215
}
215216

217+
/**
218+
* Set parent item.
219+
*
220+
* @param OrderItemInterface $orderItem
221+
* @throws InputException
222+
* @throws NoSuchEntityException
223+
*/
224+
private function addParentItem(OrderItemInterface $orderItem)
225+
{
226+
if ($parentId = $orderItem->getParentItemId()) {
227+
$orderItem->setParentItem($this->get($parentId));
228+
}
229+
}
230+
216231
/**
217232
* Set product options data
218233
*

app/code/Magento/Tax/Model/Sales/Total/Quote/Tax.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,23 @@ protected function clearValues(Address\Total $total)
152152
$total->setBaseTotalAmount('subtotal', 0);
153153
$total->setTotalAmount('tax', 0);
154154
$total->setBaseTotalAmount('tax', 0);
155+
$total->setTotalAmount('shipping', 0);
156+
$total->setBaseTotalAmount('shipping', 0);
155157
$total->setTotalAmount('discount_tax_compensation', 0);
156158
$total->setBaseTotalAmount('discount_tax_compensation', 0);
157159
$total->setTotalAmount('shipping_discount_tax_compensation', 0);
158160
$total->setBaseTotalAmount('shipping_discount_tax_compensation', 0);
159161
$total->setSubtotalInclTax(0);
160162
$total->setBaseSubtotalInclTax(0);
163+
$total->setShippingInclTax(0);
164+
$total->setBaseShippingInclTax(0);
165+
$total->setShippingTaxAmount(0);
166+
$total->setBaseShippingTaxAmount(0);
167+
$total->setShippingAmountForDiscount(0);
168+
$total->setBaseShippingAmountForDiscount(0);
169+
$total->setBaseShippingAmountForDiscount(0);
170+
$total->setTotalAmount('extra_tax', 0);
171+
$total->setBaseTotalAmount('extra_tax', 0);
161172
}
162173

163174
/**

app/design/frontend/Magento/blank/web/css/source/components/_modals_extend.less

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@
6464
}
6565

6666
.modal-popup {
67+
pointer-events: none;
68+
6769
.modal-title {
6870
.lib-css(border-bottom, @modal-title__border);
6971
.lib-css(font-weight, @font-weight__light);

app/design/frontend/Magento/luma/web/css/source/components/_modals_extend.less

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@
6464
}
6565

6666
.modal-popup {
67+
pointer-events: none;
68+
6769
.modal-title {
6870
.lib-css(border-bottom, @modal-title__border);
6971
.lib-css(font-weight, @font-weight__light);
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Sales\Model\Order;
9+
10+
class ItemRepositoryTest extends \PHPUnit\Framework\TestCase
11+
{
12+
/** @var \Magento\Sales\Model\Order */
13+
private $order;
14+
15+
/** @var \Magento\Sales\Api\OrderItemRepositoryInterface */
16+
private $orderItemRepository;
17+
18+
/** @var \Magento\Framework\Api\SearchCriteriaBuilder */
19+
private $searchCriteriaBuilder;
20+
21+
protected function setUp()
22+
{
23+
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
24+
25+
$this->order = $objectManager->create(\Magento\Sales\Model\Order::class);
26+
$this->orderItemRepository = $objectManager->create(\Magento\Sales\Api\OrderItemRepositoryInterface::class);
27+
$this->searchCriteriaBuilder = $objectManager->create(\Magento\Framework\Api\SearchCriteriaBuilder::class);
28+
}
29+
30+
/**
31+
* @magentoDataFixture Magento/Sales/_files/order_configurable_product.php
32+
*/
33+
public function testAddOrderItemParent()
34+
{
35+
$this->order->load('100000001', 'increment_id');
36+
37+
foreach ($this->order->getItems() as $item) {
38+
if ($item->getProductType() === \Magento\Catalog\Model\Product\Type::TYPE_SIMPLE) {
39+
$orderItem = $this->orderItemRepository->get($item->getItemId());
40+
$this->assertInstanceOf(\Magento\Sales\Api\Data\OrderItemInterface::class, $orderItem->getParentItem());
41+
}
42+
}
43+
44+
$itemList = $this->orderItemRepository->getList(
45+
$this->searchCriteriaBuilder->addFilter('order_id', $this->order->getId())->create()
46+
);
47+
48+
foreach ($itemList->getItems() as $item) {
49+
if ($item->getProductType() === \Magento\Catalog\Model\Product\Type::TYPE_SIMPLE) {
50+
$this->assertInstanceOf(\Magento\Sales\Api\Data\OrderItemInterface::class, $item->getParentItem());
51+
}
52+
}
53+
}
54+
}

dev/tests/js/jasmine/tests/app/code/Magento/Catalog/frontend/js/product/breadcrumbs.test.js

Lines changed: 9 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@ define([
1313

1414
var injector = new Squire(),
1515
widget,
16-
parentWidget,
1716
menuContainer,
1817
mocks = {
1918
'Magento_Theme/js/model/breadcrumb-list': jasmine.createSpyObj(['push'])
2019
},
2120
defaultContext = require.s.contexts._,
2221
menuSelector = '[data-action="navigation"] > ul',
23-
menuItem = $('<li class="level0"><a href="http://localhost.com/cat1.html" id="ui-id-3">Cat1</a></li>')[0],
22+
menuItem = $('<li class="level0"><a href="http://localhost.com/cat1.html">Cat1</a></li>')[0],
2423

2524
/**
2625
* Create context object.
@@ -44,7 +43,6 @@ define([
4443
'Magento_Theme/js/view/breadcrumbs'
4544
], function (mixin, breadcrumb) {
4645
widget = mixin(breadcrumb);
47-
parentWidget = breadcrumb;
4846
done();
4947
}
5048
);
@@ -107,14 +105,14 @@ define([
107105
});
108106

109107
it('Check _getCategoryCrumb call', function () {
110-
var item = $('<a href="http://localhost.com/cat1.html" id="ui-id-3">Cat1</a>');
108+
var item = $('<a href="http://localhost.com/cat1.html">Cat1</a>');
111109

112110
expect(widget).toBeDefined();
113111
expect(widget).toEqual(jasmine.any(Function));
114112
expect(widget.prototype._getCategoryCrumb).toBeDefined();
115113
expect(widget.prototype._getCategoryCrumb(item)).toEqual(jasmine.objectContaining(
116114
{
117-
'name': 'category3',
115+
'name': 'category',
118116
'label': 'Cat1',
119117
'link': 'http://localhost.com/cat1.html'
120118
}
@@ -223,7 +221,7 @@ define([
223221
expect(result.length).toBe(1);
224222
expect(result[0]).toEqual(jasmine.objectContaining(
225223
{
226-
'name': 'category3',
224+
'name': 'category',
227225
'label': 'Cat1',
228226
'link': 'http://localhost.com/cat1.html'
229227
}
@@ -234,10 +232,10 @@ define([
234232
var result,
235233
menuItems = $(
236234
'<li class="level0 nav-1">' +
237-
'<a href="http://localhost.com/cat1.html" id="ui-id-3">cat1</a>' +
235+
'<a href="http://localhost.com/cat1.html">cat1</a>' +
238236
'<ul>' +
239237
'<li class="level1 nav-1-1">' +
240-
'<a href="http://localhost.com/cat1/cat21.html" id="ui-id-9">cat21</a>' +
238+
'<a href="http://localhost.com/cat1/cat21.html">cat21</a>' +
241239
'</li>' +
242240
'</ul>' +
243241
'</li>'
@@ -253,59 +251,17 @@ define([
253251

254252
context = createContext(widget.prototype);
255253
getParentMenuHandler = widget.prototype._getParentMenuItem.bind(context);
256-
result = getParentMenuHandler($('#ui-id-9'));
254+
result = getParentMenuHandler($('[href="http://localhost.com/cat1/cat21.html"]'));
257255

258256
expect(result).toBeDefined();
259257
expect(result.length).toBe(1);
260258
expect(result[0].tagName.toLowerCase()).toEqual('a');
261-
expect(result.attr('id')).toEqual('ui-id-3');
259+
expect(result.attr('href')).toEqual('http://localhost.com/cat1.html');
262260

263-
result = getParentMenuHandler($('#ui-id-3'));
261+
result = getParentMenuHandler($('[href="http://localhost.com/cat1.html"]'));
264262

265263
expect(result).toBeNull();
266264
});
267-
268-
it('Check _init event binding', function () {
269-
var context,
270-
initMethod;
271-
272-
expect(parentWidget).toBeDefined();
273-
expect(parentWidget).toEqual(jasmine.any(Function));
274-
275-
context = createContext(widget.prototype);
276-
initMethod = widget.prototype._init.bind(context);
277-
278-
spyOn(parentWidget.prototype, '_init');
279-
spyOn(widget.prototype, '_on').and.returnValue(widget);
280-
281-
initMethod();
282-
283-
expect(parentWidget.prototype._init).not.toHaveBeenCalled();
284-
expect(widget.prototype._on).toHaveBeenCalledWith(
285-
jasmine.objectContaining({
286-
selector: menuSelector
287-
}),
288-
{
289-
'menucreate': jasmine.any(Function)
290-
}
291-
);
292-
});
293-
294-
it('Check parent _init call', function () {
295-
var context,
296-
initMethod;
297-
298-
expect(parentWidget).toBeDefined();
299-
expect(parentWidget).toEqual(jasmine.any(Function));
300-
301-
context = createContext(widget.prototype);
302-
initMethod = widget.prototype._init.bind(context);
303-
spyOn(parentWidget.prototype, '_init');
304-
305-
jQuery(menuSelector).attr('data-mage-menu', '<li></li>');
306-
initMethod();
307-
expect(parentWidget.prototype._init).toHaveBeenCalled();
308-
});
309265
});
310266
});
311267
});

lib/internal/Magento/Framework/App/Request/Http.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public function setPathInfo($pathInfo = null)
149149
return $this;
150150
}
151151

152-
$requestUri = $this->removeRepitedSlashes($requestUri);
152+
$requestUri = $this->removeRepeatedSlashes($requestUri);
153153
$parsedRequestUri = explode('?', $requestUri, 2);
154154
$queryString = !isset($parsedRequestUri[1]) ? '' : '?' . $parsedRequestUri[1];
155155
$baseUrl = $this->getBaseUrl();
@@ -172,7 +172,7 @@ public function setPathInfo($pathInfo = null)
172172
* @param string $pathInfo
173173
* @return string
174174
*/
175-
private function removeRepitedSlashes($pathInfo)
175+
private function removeRepeatedSlashes($pathInfo)
176176
{
177177
$firstChar = (string)substr($pathInfo, 0, 1);
178178
if ($firstChar == '/') {

0 commit comments

Comments
 (0)