Skip to content

Commit a25ab55

Browse files
author
Yu Tang
committed
Merge branch 'develop' into MAGETWO-32364-pricing-performance
2 parents b1ceba9 + c164648 commit a25ab55

File tree

264 files changed

+28852
-113
lines changed

Some content is hidden

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

264 files changed

+28852
-113
lines changed

CONTRIBUTING.md

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,31 @@
1-
# Contribution Guide
1+
# Contributing to Magento 2 code
22

3-
The Magento 2 development team will review all issues and contributions submitted by the community of developers. Contributions can take the form of new components/features, changes to existing features, tests, documentation (such as developer guides, user guides, examples, or specifications), bug fixes, optimizations or just good suggestions. To assist in the expediency of the review process, we strongly encourage you to follow all the proper requirements stated below in Definition of Done, before submitting any code for consideration.
3+
Contributions to the Magento 2 codebase are done using the fork & pull model.
4+
This contribution model has contributors maintaining their own copy of the forked codebase (which can easily be synced with the main copy). The forked repository is then used to submit a request to the base repository to “pull” a set of changes (hence the phrase “pull request”).
45

5-
## Contribution Process
6+
Contributions can take the form of new components/features, changes to existing features, tests, documentation (such as developer guides, user guides, examples, or specifications), bug fixes, optimizations or just good suggestions.
67

7-
If you are a new GitHub user, we recommend that you create your own [free github account](https://github.com/signup/free). By doing that, you will be able to collaborate with the Magento 2 development team, “fork” the Magento 2 project and be able to easily send “pull requests”.
8-
9-
1. Search current [listed issues](https://github.com/magento/magento2/issues) (open or closed) for similar proposals of intended contribution before starting work on a new contribution.
10-
2. Review the [Contributor License Agreement](https://github.com/magento/magento2/blob/master/CONTRIBUTOR_LICENSE_AGREEMENT.html) if this is your first time contributing.
11-
3. Create and test your work.
12-
4. Fork the Magento 2 repository according to [github's Fork A Repo instructions](https://help.github.com/articles/fork-a-repo) and when you are ready to send us a Pull Request – follow [github's Using Pull Requests instructions](https://help.github.com/articles/using-pull-requests).
13-
5. Once your contribution is received, Magento 2 development team will review the contribution and collaborate with you as needed to improve the quality of the contribution.
8+
The Magento 2 development team will review all issues and contributions submitted by the community of developers in the first in, first out order. During the review we might require clarifications from the contributor. If there is no response from the contributor for two weeks, the issue is closed.
149

15-
### Contribution Acceptance Criteria
1610

17-
1. Code changes must be covered with automated tests and supplied along with the patch (or fork). Author chooses the best approach for testing as deemed necessary. See [Magento Automated Testing Standard](https://github.com/magento/magento2/wiki/Magento-Automated-Testing-Standard) for additional guidance.
18-
2. New features or proposals must be supplied with documentation -- functional (how a feature works) or technical (how it is implemented/designed), or both.
11+
## Contribution requirements
1912

20-
## Frequently Asked Questions
13+
1. Contributions must adhere to [Magento coding standards](http://devdocs.magento.com/guides/v1.0/coding-standards/bk-coding-standards.html).
14+
2. Pull requests (PRs) must be accompanied by a meaningful description of their purpose. Comprehensive descriptions increase the chances of a pull request to be merged quickly and without additional clarification requests.
15+
3. Commits must be accompanied by meaningful commit messages.
16+
4. PRs which include bug fixing, must be accompanied with step-by-step description of how to reproduce the bug.
17+
3. PRs which include new logic or new features must be submitted along with:
18+
* Unit/integration test coverage (we will be releasing more information on writing test coverage in the near future).
19+
* Proposed [documentation](http://devdocs.magento.com) update. Documentation contributions can be submitted [here](https://github.com/magento/devdocs).
20+
4. For large features or changes, please [open an issue](https://github.com/magento/magento2/issues) and discuss first. This may prevent duplicate or unnecessary effort, and it may gain you some additional contributors.
21+
5. All automated tests are passed successfully (all builds on [Travis CI](https://travis-ci.org/magento/magento2) must be green).
2122

22-
**Do I need to follow all requirements of the contribution process?**
23+
## Contribution process
2324

24-
Yes. We strongly encourage that you follow the requirements as stated, before submitting your code or patch for Magento 2 development team's review. Properly submitted contributions will help the Magento 2 development team to quickly assess your contribution and incorporate it into the Magento 2 project if deemed beneficial.
25-
26-
**Do you accept all contributions?**
25+
If you are a new GitHub user, we recommend that you create your own [free github account](https://github.com/signup/free). By doing that, you will be able to collaborate with the Magento 2 development team, “fork” the Magento 2 project and be able to easily send “pull requests”.
2726

28-
Not all contributions will be used or incorporated into the code for the project. The decision to incorporate the code or not is at the discretion of the Magento 2 development team.
27+
1. Search current [listed issues](https://github.com/magento/magento2/issues) (open or closed) for similar proposals of intended contribution before starting work on a new contribution.
28+
2. Review the [Contributor License Agreement](https://github.com/magento/magento2/blob/master/CONTRIBUTOR_LICENSE_AGREEMENT.html) if this is your first time contributing.
29+
3. Create and test your work.
30+
4. Fork the Magento 2 repository according to [Fork a repository instructions](http://devdocs.magento.com/guides/v1.0/contributor-guide/CONTRIBUTING.html#fork) and when you are ready to send us a pull request – follow [Create a pull request instructions](http://devdocs.magento.com/guides/v1.0/contributor-guide/CONTRIBUTING.html#pull_request).
31+
5. Once your contribution is received, Magento 2 development team will review the contribution and collaborate with you as needed to improve the quality of the contribution.

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

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

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

app/code/Magento/Catalog/i18n/de_DE.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Qty,Qty
1414
Action,Aktion
1515
Reset,Zurücksetzen
1616
Edit,Bearbeiten
17-
"Add to Cart","Zum Warenkobrn hinzufügen"
17+
"Add to Cart","Zum Warenkorb hinzufügen"
1818
"Images (.gif, .jpg, .png)","Images (.gif, .jpg, .png)"
1919
"First Name",Vorname
2020
"Last Name","Letzter Name"

app/code/Magento/Reports/i18n/de_DE.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Subtotal,Zwischensumme
1111
Discount,Discount
1212
Action,Aktion
1313
Total,Gesamtbetrag
14-
"Add to Cart","Zum Warenkobrn hinzufügen"
14+
"Add to Cart","Zum Warenkorb hinzufügen"
1515
Orders,Aufträge
1616
Bestsellers,Bestseller
1717
Customer,Kundenname

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

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

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

6942
if ($invoice->isLast()) {
7043
$subtotal = $allowedSubtotal;
7144
$baseSubtotal = $baseAllowedSubtotal;
72-
$subtotalInclTax = $allowedSubtotalInclTax;
73-
$baseSubtotalInclTax = $baseAllowedSubtotalInclTax;
7445
} else {
7546
$subtotal = min($allowedSubtotal, $subtotal);
7647
$baseSubtotal = min($baseAllowedSubtotal, $baseSubtotal);
77-
$subtotalInclTax = min($allowedSubtotalInclTax, $subtotalInclTax);
78-
$baseSubtotalInclTax = min($baseAllowedSubtotalInclTax, $baseSubtotalInclTax);
7948
}
8049

8150
$invoice->setSubtotal($subtotal);

app/code/Magento/Sales/i18n/de_DE.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Total,Gesamt
3333
"Move to Wishlist","Auf Wunschzettel schreiben"
3434
Edit,Bearbeiten
3535
Item,Objekt
36-
"Add to Cart","Zum Warenkobrn hinzufügen"
36+
"Add to Cart","Zum Warenkorb hinzufügen"
3737
Sku,SKU
3838
"Order saving error: %1","Order saving error: %1"
3939
"You created the order.","You created the order."

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

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

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

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

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

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

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

271271
/**
272-
* Get defined tax calculation agorithm
272+
* Get defined tax calculation algorithm
273273
*
274274
* @param null|string|bool|int|Store $store
275275
* @return string

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

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

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

app/code/Magento/Wishlist/i18n/de_DE.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Action,Action
77
"Are you sure that you want to remove this item?","Are you sure that you want to remove this item?"
88
Edit,Bearbeiten
99
"Remove item","Artikel löschen"
10-
"Add to Cart","Zum Warenkobrn hinzufügen"
10+
"Add to Cart","Zum Warenkorb hinzufügen"
1111
Delete,Delete
1212
Enabled,Enabled
1313
"We cannot add this item to your shopping cart.","We cannot add this item to your shopping cart."

0 commit comments

Comments
 (0)