Skip to content

Commit 47a1704

Browse files
author
Olexandr Lysenko
committed
Merge branch 'develop' into bugfixes
2 parents 679197b + ae383b5 commit 47a1704

File tree

350 files changed

+4000
-1338
lines changed

Some content is hidden

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

350 files changed

+4000
-1338
lines changed

app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ protected function calculateDynamicBundleAmount($basePriceValue, $bundleProduct,
314314

315315
/** @var Store $store */
316316
$store = $bundleProduct->getStore();
317-
$roundingMethod = $this->taxHelper->getCalculationAgorithm($store);
317+
$roundingMethod = $this->taxHelper->getCalculationAlgorithm($store);
318318
foreach ($amountList as $amountInfo) {
319319
/** @var \Magento\Framework\Pricing\Amount\AmountInterface $itemAmount */
320320
$itemAmount = $amountInfo['amount'];

app/code/Magento/Catalog/Model/Product.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -777,8 +777,10 @@ public function afterSave()
777777
*/
778778
public function setQty($qty)
779779
{
780-
$this->setData('qty', $qty);
781-
$this->reloadPriceInfo();
780+
if ($this->getData('qty') != $qty) {
781+
$this->setData('qty', $qty);
782+
$this->reloadPriceInfo();
783+
}
782784
return $this;
783785
}
784786

app/code/Magento/Directory/Model/PriceCurrency.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,12 @@ public function convert($amount, $scope = null, $currency = null)
5858
}
5959

6060
/**
61-
* Convert and round price value for specified store or passed currency
62-
*
63-
* @param float $amount
64-
* @param null|string|bool|int|\Magento\Store\Model\Store $store
65-
* @param Currency|string|null $currency
66-
* @param int $precision
67-
* @return float
61+
* {@inheritdoc}
6862
*/
69-
public function convertAndRound($amount, $store = null, $currency = null, $precision = self::DEFAULT_PRECISION)
63+
public function convertAndRound($amount, $scope = null, $currency = null, $precision = self::DEFAULT_PRECISION)
7064
{
71-
$currentCurrency = $this->getCurrency($store, $currency);
72-
$convertedValue = $this->getStore($store)->getBaseCurrency()->convert($amount, $currentCurrency);
65+
$currentCurrency = $this->getCurrency($scope, $currency);
66+
$convertedValue = $this->getStore($scope)->getBaseCurrency()->convert($amount, $currentCurrency);
7367
return round($convertedValue, $precision);
7468
}
7569

app/code/Magento/Sales/Model/Order/Invoice/Total/Subtotal.php

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -37,46 +37,15 @@ public function collect(\Magento\Sales\Model\Order\Invoice $invoice)
3737

3838
$allowedSubtotal = $order->getSubtotal() - $order->getSubtotalInvoiced();
3939
$baseAllowedSubtotal = $order->getBaseSubtotal() - $order->getBaseSubtotalInvoiced();
40-
$allowedSubtotalInclTax = $allowedSubtotal +
41-
$order->getHiddenTaxAmount() +
42-
$order->getTaxAmount() -
43-
$order->getTaxInvoiced() -
44-
$order->getHiddenTaxInvoiced();
45-
$baseAllowedSubtotalInclTax = $baseAllowedSubtotal +
46-
$order->getBaseHiddenTaxAmount() +
47-
$order->getBaseTaxAmount() -
48-
$order->getBaseTaxInvoiced() -
49-
$order->getBaseHiddenTaxInvoiced();
50-
51-
/**
52-
* Check if shipping tax calculation is included to current invoice.
53-
*/
54-
$includeShippingTax = true;
55-
foreach ($invoice->getOrder()->getInvoiceCollection() as $previousInvoice) {
56-
if ($previousInvoice->getShippingAmount() && !$previousInvoice->isCanceled()) {
57-
$includeShippingTax = false;
58-
break;
59-
}
60-
}
61-
62-
if ($includeShippingTax) {
63-
$allowedSubtotalInclTax -= $order->getShippingTaxAmount();
64-
$baseAllowedSubtotalInclTax -= $order->getBaseShippingTaxAmount();
65-
} else {
66-
$allowedSubtotalInclTax += $order->getShippingHiddenTaxAmount();
67-
$baseAllowedSubtotalInclTax += $order->getBaseShippingHiddenTaxAmount();
68-
}
40+
//Note: The $subtotalInclTax and $baseSubtotalInclTax are not adjusted from those provide by the line items
41+
//because the "InclTax" is displayed before any tax adjustments based on discounts, shipping, etc.
6942

7043
if ($invoice->isLast()) {
7144
$subtotal = $allowedSubtotal;
7245
$baseSubtotal = $baseAllowedSubtotal;
73-
$subtotalInclTax = $allowedSubtotalInclTax;
74-
$baseSubtotalInclTax = $baseAllowedSubtotalInclTax;
7546
} else {
7647
$subtotal = min($allowedSubtotal, $subtotal);
7748
$baseSubtotal = min($baseAllowedSubtotal, $baseSubtotal);
78-
$subtotalInclTax = min($allowedSubtotalInclTax, $subtotalInclTax);
79-
$baseSubtotalInclTax = min($baseAllowedSubtotalInclTax, $baseSubtotalInclTax);
8049
}
8150

8251
$invoice->setSubtotal($subtotal);

app/code/Magento/Tax/Helper/Data.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ public function getCalculationSequence($store = null)
629629
* @param null|string|bool|int|Store $store
630630
* @return string
631631
*/
632-
public function getCalculationAgorithm($store = null)
632+
public function getCalculationAlgorithm($store = null)
633633
{
634634
return $this->_config->getAlgorithm($store);
635635
}
@@ -797,23 +797,6 @@ protected function calculateTaxForItems(EntityInterface $order, EntityInterface
797797

798798
$orderTaxDetails = $this->orderTaxManagement->getOrderTaxDetails($order->getId());
799799

800-
// Apply any taxes for shipping
801-
$shippingTaxAmount = $salesItem->getShippingTaxAmount();
802-
$originalShippingTaxAmount = $order->getShippingTaxAmount();
803-
if ($shippingTaxAmount && $originalShippingTaxAmount &&
804-
$shippingTaxAmount != 0 && floatval($originalShippingTaxAmount)
805-
) {
806-
//An invoice or credit memo can have a different qty than its order
807-
$shippingRatio = $shippingTaxAmount / $originalShippingTaxAmount;
808-
$itemTaxDetails = $orderTaxDetails->getItems();
809-
foreach ($itemTaxDetails as $itemTaxDetail) {
810-
//Aggregate taxable items associated with shipping
811-
if ($itemTaxDetail->getType() == \Magento\Quote\Model\Quote\Address::TYPE_SHIPPING) {
812-
$taxClassAmount = $this->_aggregateTaxes($taxClassAmount, $itemTaxDetail, $shippingRatio);
813-
}
814-
}
815-
}
816-
817800
// Apply any taxes for the items
818801
/** @var $item \Magento\Sales\Model\Order\Invoice\Item|\Magento\Sales\Model\Order\Creditmemo\Item */
819802
foreach ($salesItem->getItems() as $item) {
@@ -845,6 +828,23 @@ protected function calculateTaxForItems(EntityInterface $order, EntityInterface
845828
}
846829
}
847830

831+
// Apply any taxes for shipping
832+
$shippingTaxAmount = $salesItem->getShippingTaxAmount();
833+
$originalShippingTaxAmount = $order->getShippingTaxAmount();
834+
if ($shippingTaxAmount && $originalShippingTaxAmount &&
835+
$shippingTaxAmount != 0 && floatval($originalShippingTaxAmount)
836+
) {
837+
//An invoice or credit memo can have a different qty than its order
838+
$shippingRatio = $shippingTaxAmount / $originalShippingTaxAmount;
839+
$itemTaxDetails = $orderTaxDetails->getItems();
840+
foreach ($itemTaxDetails as $itemTaxDetail) {
841+
//Aggregate taxable items associated with shipping
842+
if ($itemTaxDetail->getType() == \Magento\Quote\Model\Quote\Address::TYPE_SHIPPING) {
843+
$taxClassAmount = $this->_aggregateTaxes($taxClassAmount, $itemTaxDetail, $shippingRatio);
844+
}
845+
}
846+
}
847+
848848
return $taxClassAmount;
849849
}
850850
}

app/code/Magento/Tax/Model/Config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ public function getNeedUseShippingExcludeTax()
270270
}
271271

272272
/**
273-
* Get defined tax calculation agorithm
273+
* Get defined tax calculation algorithm
274274
*
275275
* @param null|string|bool|int|Store $store
276276
* @return string

app/code/Magento/Tax/Model/Observer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ public function updateProductOptions(\Magento\Framework\Event\Observer $observer
300300
return $this;
301301
}
302302

303-
$algorithm = $this->_taxData->getCalculationAgorithm();
303+
$algorithm = $this->_taxData->getCalculationAlgorithm();
304304
$options['calculationAlgorithm'] = $algorithm;
305305
// prepare correct template for options render
306306
if ($this->_taxData->displayBothPrices()) {

dev/tests/functional/composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
{
22
"require": {
3-
"magento/mtf": "1.0.0-rc12",
3+
"magento/mtf": "1.0.0-rc13",
44
"php": ">=5.4.0",
55
"phpunit/phpunit": "4.1.0",
66
"phpunit/phpunit-selenium": ">=1.2",
77
"netwing/selenium-server-standalone": ">=2.35"
88
},
9+
"suggest": {
10+
"facebook/webdriver": "dev-master"
11+
},
912
"autoload": {
1013
"psr-4": {
1114
"Mtf\\": ["lib/Mtf/", "generated/Mtf/", "testsuites/Mtf/"],

dev/tests/functional/lib/Mtf/Client/Driver/Selenium/Element/OptgroupselectElement.php

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)