Skip to content

Commit 8c9bcbe

Browse files
committed
Merge remote-tracking branch 'origin/2.2-develop' into MAGETWO-94114
2 parents b47cde5 + b3abf20 commit 8c9bcbe

File tree

6 files changed

+33
-6
lines changed

6 files changed

+33
-6
lines changed

app/code/Magento/CatalogInventory/Observer/CancelOrderItemObserver.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,21 @@
66

77
namespace Magento\CatalogInventory\Observer;
88

9-
use Magento\Framework\Event\ObserverInterface;
109
use Magento\CatalogInventory\Api\StockManagementInterface;
10+
use Magento\CatalogInventory\Model\Configuration;
1111
use Magento\Framework\Event\Observer as EventObserver;
12+
use Magento\Framework\Event\ObserverInterface;
1213

1314
/**
1415
* Catalog inventory module observer
1516
*/
1617
class CancelOrderItemObserver implements ObserverInterface
1718
{
19+
/**
20+
* @var \Magento\CatalogInventory\Model\Configuration
21+
*/
22+
protected $configuration;
23+
1824
/**
1925
* @var StockManagementInterface
2026
*/
@@ -26,13 +32,16 @@ class CancelOrderItemObserver implements ObserverInterface
2632
protected $priceIndexer;
2733

2834
/**
35+
* @param Configuration $configuration
2936
* @param StockManagementInterface $stockManagement
3037
* @param \Magento\Catalog\Model\Indexer\Product\Price\Processor $priceIndexer
3138
*/
3239
public function __construct(
40+
Configuration $configuration,
3341
StockManagementInterface $stockManagement,
3442
\Magento\Catalog\Model\Indexer\Product\Price\Processor $priceIndexer
3543
) {
44+
$this->configuration = $configuration;
3645
$this->stockManagement = $stockManagement;
3746
$this->priceIndexer = $priceIndexer;
3847
}
@@ -49,7 +58,8 @@ public function execute(EventObserver $observer)
4958
$item = $observer->getEvent()->getItem();
5059
$children = $item->getChildrenItems();
5160
$qty = $item->getQtyOrdered() - max($item->getQtyShipped(), $item->getQtyInvoiced()) - $item->getQtyCanceled();
52-
if ($item->getId() && $item->getProductId() && empty($children) && $qty) {
61+
if ($item->getId() && $item->getProductId() && empty($children) && $qty && $this->configuration
62+
->getCanBackInStock()) {
5363
$this->stockManagement->backItemQty($item->getProductId(), $qty, $item->getStore()->getWebsiteId());
5464
}
5565
$this->priceIndexer->reindexRow($item->getProductId());

app/code/Magento/Quote/Model/Quote/Address/Total.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
namespace Magento\Quote\Model\Quote\Address;
77

88
/**
9+
* Class Total
10+
*
911
* @method string getCode()
1012
*
1113
* @api
@@ -54,6 +56,8 @@ public function __construct(
5456
*/
5557
public function setTotalAmount($code, $amount)
5658
{
59+
$amount = is_float($amount) ? round($amount, 4) : $amount;
60+
5761
$this->totalAmounts[$code] = $amount;
5862
if ($code != 'subtotal') {
5963
$code = $code . '_amount';
@@ -72,6 +76,8 @@ public function setTotalAmount($code, $amount)
7276
*/
7377
public function setBaseTotalAmount($code, $amount)
7478
{
79+
$amount = is_float($amount) ? round($amount, 4) : $amount;
80+
7581
$this->baseTotalAmounts[$code] = $amount;
7682
if ($code != 'subtotal') {
7783
$code = $code . '_amount';
@@ -167,6 +173,7 @@ public function getAllBaseTotalAmounts()
167173

168174
/**
169175
* Set the full info, which is used to capture tax related information.
176+
*
170177
* If a string is used, it is assumed to be serialized.
171178
*
172179
* @param array|string $info

app/code/Magento/Reports/Model/ResourceModel/Order/Collection.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
76
namespace Magento\Reports\Model\ResourceModel\Order;
87

98
use Magento\Framework\DB\Select;
@@ -81,7 +80,7 @@ class Collection extends \Magento\Sales\Model\ResourceModel\Order\Collection
8180
* @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate
8281
* @param \Magento\Sales\Model\Order\Config $orderConfig
8382
* @param \Magento\Sales\Model\ResourceModel\Report\OrderFactory $reportOrderFactory
84-
* @param null $connection
83+
* @param \Magento\Framework\DB\Adapter\AdapterInterface $connection
8584
* @param \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource
8685
*
8786
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
@@ -825,7 +824,7 @@ protected function getTotalsExpression(
825824
) {
826825
$template = ($storeId != 0)
827826
? '(main_table.base_subtotal - %2$s - %1$s - ABS(main_table.base_discount_amount) - %3$s)'
828-
: '((main_table.base_subtotal - %1$s - %2$s - ABS(main_table.base_discount_amount) - %3$s) '
827+
: '((main_table.base_subtotal - %1$s - %2$s - ABS(main_table.base_discount_amount) + %3$s) '
829828
. ' * main_table.base_to_global_rate)';
830829
return sprintf($template, $baseSubtotalRefunded, $baseSubtotalCanceled, $baseDiscountCanceled);
831830
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ protected function initData($creditmemo, $data)
200200
{
201201
if (isset($data['shipping_amount'])) {
202202
$creditmemo->setBaseShippingAmount((double)$data['shipping_amount']);
203+
$creditmemo->setBaseShippingInclTax((double)$data['shipping_amount']);
203204
}
204205
if (isset($data['adjustment_positive'])) {
205206
$creditmemo->setAdjustmentPositive($data['adjustment_positive']);
@@ -210,6 +211,8 @@ protected function initData($creditmemo, $data)
210211
}
211212

212213
/**
214+
* Calculate product options.
215+
*
213216
* @param Item $orderItem
214217
* @param int $parentQty
215218
* @return int

app/code/Magento/Ui/i18n/en_US.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,3 +202,4 @@ CSV,CSV
202202
"Please enter at least {0} characters.","Please enter at least {0} characters."
203203
"Please enter a value between {0} and {1} characters long.","Please enter a value between {0} and {1} characters long."
204204
"Please enter a value between {0} and {1}.","Please enter a value between {0} and {1}."
205+
"The file upload field is disabled.","The file upload field is disabled."

app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ define([
1313
'Magento_Ui/js/modal/alert',
1414
'Magento_Ui/js/lib/validation/validator',
1515
'Magento_Ui/js/form/element/abstract',
16+
'mage/translate',
1617
'jquery/file-uploader'
17-
], function ($, _, utils, uiAlert, validator, Element) {
18+
], function ($, _, utils, uiAlert, validator, Element, $t) {
1819
'use strict';
1920

2021
return Element.extend({
@@ -328,6 +329,12 @@ define([
328329
allowed = this.isFileAllowed(file),
329330
target = $(e.target);
330331

332+
if (this.disabled()) {
333+
this.notifyError($t('The file upload field is disabled.'));
334+
335+
return;
336+
}
337+
331338
if (allowed.passed) {
332339
target.on('fileuploadsend', function (event, postData) {
333340
postData.data.append('param_name', this.paramName);

0 commit comments

Comments
 (0)