Permalink
Browse files

2.0.0.0-dev83

* Created the Service API for the Magento_Catalog Module:
   * Product Attribute Media API
   * Product Group Price API
* Tax calculation updates:
  * Fixed tax calculation rounding issues which appeared when a discount was applied
  * Fixed extra penny issue which appeared when exact tax amount ended with 0.5 cent
  * Fixed tax calculation issues which appeared when a customer tax rate was different from the store tax rate
  * Fixed price inconsistencies between catalog and shopping cart
  * Added support for maintaining consistent prices including tax for customers with different tax rates
  * Added support for applying tax rules with different priorities to be applied to subtotal only
  * Added support for tax rounding at individual tax rate
* Porting Tax Features from Magento 1.x:
  * Price consistency UX and algorithm
  * Canadian provincial sales taxes
  * Fixed issues with bundle product price inconsistency across the system
  * Added warnings if invalid tax configuration is created in the Admin panel
  * Fixed issues with regards to hidden tax
* Fixed bugs:
  * Fixed an issue where grouped price was not applied for grouped products
  * Fixed an issue where a fatal error occurred when opening a grouped product page without assigned products on the frontend
  * Fixed an issue where it was possible to apply an inactive discount coupon
  * Fixed an issue where the linked products information was lost when exporting products
  * Fixed non-informative error messages for "Attribute Group Service"
  * Fixed the invalid default value of the "apply_after_discount" tax setting
  * Fixed an issue where the integration tests coverage whitelist was broken
  * Fixed Admin panel UI issues: grids, headers and footers
* Added the following functional tests:
  * Create Product Url Rewrite
  * Delete Catalog Price Rule
  * Delete Category Url Rewrite
  * Delete CMS Page Rewrite
  * Delete Product Rating
  * Delete Sales Rule
  * Delete Tax Rate
  * Update Catalog Price Rule
  * Update Shopping Cart
  • Loading branch information...
1 parent 658b76f commit ea1a2b7f2fc7fdb81ea1d73cbb62b5c43d9845db @magento-team magento-team committed Jun 20, 2014
Showing with 9,604 additions and 693 deletions.
  1. +1 −1 .travis.yml
  2. +39 −0 CHANGELOG.md
  3. +1 −1 app/code/Magento/AdminNotification/view/adminhtml/layout/default.xml
  4. +31 −0 app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php
  5. +29 −4 app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php
  6. +1 −0 app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle.phtml
  7. +17 −1 app/code/Magento/Bundle/view/frontend/web/bundle.js
  8. +1 −1 app/code/Magento/Catalog/Block/Product/View.php
  9. +5 −0 app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractGroupprice.php
  10. +1 −0 app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media.php
  11. +109 −0 app/code/Magento/Catalog/Model/Product/PriceModifier.php
  12. +73 −0 app/code/Magento/Catalog/Model/ProductRepository.php
  13. +5 −10 app/code/Magento/Catalog/Pricing/Price/GroupPrice.php
  14. +53 −0 app/code/Magento/Catalog/Service/V1/Data/Product/GroupPrice.php
  15. +54 −0 app/code/Magento/Catalog/Service/V1/Data/Product/GroupPriceBuilder.php
  16. +54 −0 app/code/Magento/Catalog/Service/V1/Data/Product/TierPrice.php
  17. +54 −0 app/code/Magento/Catalog/Service/V1/Data/Product/TierPriceBuilder.php
  18. +98 −0 app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/GalleryEntry.php
  19. +97 −0 app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/GalleryEntryBuilder.php
  20. +65 −0 app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/GalleryEntryContent.php
  21. +64 −0 app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/GalleryEntryContentBuilder.php
  22. +108 −0 app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/GalleryEntryContentValidator.php
  23. +78 −0 app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/MediaImage.php
  24. +74 −0 app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/MediaImageBuilder.php
  25. +75 −0 app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/GalleryEntryResolver.php
  26. +242 −0 app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/ReadService.php
  27. +54 −0 app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/ReadServiceInterface.php
  28. +225 −0 app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/WriteService.php
  29. +69 −0 app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/WriteServiceInterface.php
  30. +15 −1 app/code/Magento/Catalog/Service/V1/Product/AttributeGroup/ReadService.php
  31. +1 −0 app/code/Magento/Catalog/Service/V1/Product/AttributeGroup/ReadServiceInterface.php
  32. +38 −13 app/code/Magento/Catalog/Service/V1/Product/AttributeGroup/WriteService.php
  33. +6 −2 app/code/Magento/Catalog/Service/V1/Product/AttributeGroup/WriteServiceInterface.php
  34. +175 −0 app/code/Magento/Catalog/Service/V1/Product/GroupPriceService.php
  35. +59 −0 app/code/Magento/Catalog/Service/V1/Product/GroupPriceServiceInterface.php
  36. +192 −0 app/code/Magento/Catalog/Service/V1/Product/TierPriceService.php
  37. +62 −0 app/code/Magento/Catalog/Service/V1/Product/TierPriceServiceInterface.php
  38. +4 −0 app/code/Magento/Catalog/etc/di.xml
  39. +72 −0 app/code/Magento/Catalog/etc/webapi.xml
  40. +10 −10 app/code/Magento/Eav/Model/Resource/Attribute/Collection.php
  41. +11 −8 app/code/Magento/GroupedProduct/view/base/templates/product/price/final_price.phtml
  42. +0 −4 app/code/Magento/GroupedProduct/view/frontend/templates/product/view/type/grouped.phtml
  43. +1 −1 app/code/Magento/Sales/Model/Quote/Item/AbstractItem.php
  44. +2 −1 app/code/Magento/SalesRule/Model/Validator.php
  45. +14 −0 app/code/Magento/Tax/Block/Adminhtml/Rule/Edit/Form.php
  46. +17 −7 app/code/Magento/Tax/Block/Sales/Order/Tax.php
  47. +13 −0 app/code/Magento/Tax/Controller/Adminhtml/Rule.php
  48. +20 −0 app/code/Magento/Tax/Controller/Adminhtml/Tax.php
  49. +37 −0 app/code/Magento/Tax/Helper/Data.php
  50. +70 −1 app/code/Magento/Tax/Model/Config.php
  51. +83 −0 app/code/Magento/Tax/Model/Config/Notification.php
  52. +0 −1 app/code/Magento/Tax/Model/Sales/Total/Quote/Tax.php
  53. +337 −0 app/code/Magento/Tax/Model/System/Message/Notifications.php
  54. +2 −2 app/code/Magento/Tax/Pricing/Adjustment.php
  55. +34 −0 app/code/Magento/Tax/etc/adminhtml/di.xml
  56. +16 −0 app/code/Magento/Tax/etc/adminhtml/system.xml
  57. +4 −1 app/code/Magento/Tax/etc/config.xml
  58. +1 −0 app/code/Magento/Tax/etc/module.xml
  59. +7 −0 app/code/Magento/Tax/view/adminhtml/layout/tax_rule_block.xml
  60. +1 −1 app/code/Magento/Weee/Model/Tax.php
  61. +2 −0 app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module.less
  62. +6 −4 app/design/adminhtml/Magento/backend/web/css/admin.less
  63. +17 −3 app/design/adminhtml/Magento/backend/web/css/source/table.less
  64. +10 −4 app/design/adminhtml/Magento/backend/web/js/theme.js
  65. +18 −0 dev/tests/functional/lib/Mtf/Client/Driver/Selenium/Element/MultiselectlistElement.php
  66. +0 −1 dev/tests/functional/tests/app/Magento/Backend/Test/Block/FormPageActions.php
  67. +7 −9 dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Price.php
  68. +1 −1 dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInCart.php
  69. +1 −2 dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInCategory.php
  70. +21 −21 dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple/Price.php
  71. +77 −15 dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart.php
  72. +80 −0 dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart/Sidebar.php
  73. +75 −0 dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertPriceInShoppingCart.php
  74. +75 −0 ...ests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertProductQtyInMiniShoppingCart.php
  75. +75 −0 dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertProductQtyInShoppingCart.php
  76. +76 −0 dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertSubtotalInShoppingCart.php
  77. +39 −0 dev/tests/functional/tests/app/Magento/Checkout/Test/etc/global/constraint.xml
  78. +32 −0 dev/tests/functional/tests/app/Magento/Checkout/Test/etc/global/fixture.xml
  79. +8 −19 ...s/app/Magento/{UrlRewrite/Test/Block/Actions.php → Cms/Test/Handler/CmsPage/CmsPageInterface.php}
  80. +80 −0 dev/tests/functional/tests/app/Magento/Cms/Test/Handler/CmsPage/Curl.php
  81. +14 −0 dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsIndex.php
  82. +6 −0 dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsIndex.xml
  83. +1 −1 ...functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableInCategory.php
  84. +1 −1 ...tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableView.php
  85. +17 −3 dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductRatingInGrid.php
  86. +70 −0 dev/tests/functional/tests/app/Magento/Review/Test/Constraint/AssertProductRatingNotInGrid.php
  87. +71 −0 ...s/functional/tests/app/Magento/Review/Test/Constraint/AssertProductRatingSuccessDeleteMessage.php
  88. +2 −2 dev/tests/functional/tests/app/Magento/Review/Test/Fixture/Rating.php
  89. +96 −0 dev/tests/functional/tests/app/Magento/Review/Test/Handler/Rating/Curl.php
  90. +35 −0 dev/tests/functional/tests/app/Magento/Review/Test/Handler/Rating/RatingInterface.php
  91. +48 −0 dev/tests/functional/tests/app/Magento/Review/Test/Repository/Rating.php
  92. +2 −2 ...nto/Review/Test/TestCase/{CreateBackendProductRatingTest.php → CreateProductRatingEntityTest.php}
  93. 0 ...teBackendProductRating.csv → CreateProductRatingEntityTest/testCreateProductRatingEntityTest.csv}
  94. +105 −0 dev/tests/functional/tests/app/Magento/Review/Test/TestCase/DeleteProductRatingEntityTest.php
  95. +2 −0 .../app/Magento/Review/Test/TestCase/DeleteProductRatingEntityTest/testDeleteProductRatingEntity.csv
  96. +28 −0 dev/tests/functional/tests/app/Magento/Review/Test/etc/curl/di.xml
  97. +6 −0 dev/tests/functional/tests/app/Magento/Review/Test/etc/global/constraint.xml
  98. +7 −0 dev/tests/functional/tests/app/Magento/Tax/Test/Block/Adminhtml/Rate/Edit/FormPageActions.php
  99. +12 −0 dev/tests/functional/tests/app/Magento/Tax/Test/Block/Adminhtml/Rule/Edit/Form.php
  100. +74 −0 dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AssertTaxRateNotInGrid.php
  101. +71 −0 dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AssertTaxRateNotInTaxRule.php
  102. +71 −0 dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AssertTaxRateSuccessDeleteMessage.php
  103. +99 −0 dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/DeleteTaxRateEntityTest.php
  104. +2 −0 ...ests/functional/tests/app/Magento/Tax/Test/TestCase/DeleteTaxRateEntityTest/testDeleteTaxRate.csv
  105. +22 −0 dev/tests/functional/tests/app/Magento/Tax/Test/etc/global/constraint.xml
  106. +7 −4 ...tests/functional/tests/app/Magento/UrlRewrite/Test/Block/{ → Adminhtml}/Catalog/Category/Grid.php
  107. +19 −2 ...tests/functional/tests/app/Magento/UrlRewrite/Test/Block/{ → Adminhtml}/Catalog/Category/Tree.php
  108. +1 −1 dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Block/{ → Adminhtml}/Catalog/Edit/Form.php
  109. 0 dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Block/{ → Adminhtml}/Catalog/Edit/Form.xml
  110. +23 −19 dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Block/{ → Adminhtml}/Catalog/Product/Grid.php
  111. +52 −0 dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Block/Adminhtml/Cms/Page/Grid.php
  112. +1 −1 dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Block/{ → Adminhtml}/Selector.php
  113. +88 −0 ...tests/functional/tests/app/Magento/UrlRewrite/Test/Constraint/AssertUrlRewriteCmsPageRedirect.php
  114. +11 −5 ...e/Test/Constraint/{AssertProductUrlAvailableOnTheFront.php → AssertUrlRewriteProductRedirect.php}
  115. +1 −11 dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Fixture/UrlRewrite.php
  116. +1 −4 dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Fixture/UrlRewrite.xml
  117. +18 −13 ...ests/functional/tests/app/Magento/UrlRewrite/Test/Fixture/UrlRewrite/{ProductId.php → IdPath.php}
  118. +2 −18 dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Handler/UrlRewrite/Curl.php
  119. +1 −1 dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Handler/UrlRewrite/UrlRewriteInterface.php
  120. +23 −23 dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Page/Adminhtml/UrlrewriteEdit.php
  121. +8 −14 dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Page/Adminhtml/UrlrewriteEdit.xml
  122. +2 −2 dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Page/Adminhtml/UrlrewriteIndex.php
  123. +1 −1 dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Page/Adminhtml/UrlrewriteIndex.xml
  124. +106 −0 dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CreateCmsPageRewriteEntityTest.php
  125. +5 −0 .../tests/app/Magento/UrlRewrite/Test/TestCase/CreateCmsPageRewriteEntityTest/testCmsPageRewrite.csv
  126. +104 −0 ...tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CreateProductUrlRewriteEntityTest.php
  127. +4 −0 .../app/Magento/UrlRewrite/Test/TestCase/CreateProductUrlRewriteEntityTest/testProductUrlRewrite.csv
  128. +99 −0 ...ests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/DeleteCategoryUrlRewriteEntityTest.php
  129. +3 −0 ...ento/UrlRewrite/Test/TestCase/DeleteCategoryUrlRewriteEntityTest/testDeleteCategoryUrlRewrite.csv
  130. +5 −20 ...tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/DeleteProductUrlRewriteEntityTest.php
  131. +2 −2 ...agento/UrlRewrite/Test/TestCase/DeleteProductUrlRewriteEntityTest/testDeleteProductUrlRewrite.csv
  132. +1 −1 ...ests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/UpdateCategoryUrlRewriteEntityTest.php
  133. +1 −1 ...tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/UpdateProductUrlRewriteEntityTest.php
  134. +2 −3 ...agento/UrlRewrite/Test/TestCase/UpdateProductUrlRewriteEntityTest/testUpdateProductUrlRewrite.csv
  135. +10 −2 dev/tests/functional/tests/app/Magento/UrlRewrite/Test/etc/global/constraint.xml
  136. +5 −0 dev/tests/functional/tests/app/Magento/UrlRewrite/Test/etc/global/page.xml
  137. +1 −1 dev/tests/integration/phpunit.xml.dist
  138. +2 −3 dev/tests/integration/testsuite/Magento/Catalog/Block/Product/AbstractTest.php
  139. +1 −1 dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/TierpriceTest.php
  140. +1 −1 dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/PriceTest.php
  141. +61 −0 dev/tests/integration/testsuite/Magento/Catalog/_files/attribute_set_with_image_attribute.php
  142. +54 −0 ...ests/integration/testsuite/Magento/Catalog/_files/attribute_set_with_image_attribute_rollback.php
  143. +68 −0 dev/tests/integration/testsuite/Magento/Catalog/_files/product_group_prices.php
  144. +39 −0 dev/tests/integration/testsuite/Magento/Catalog/_files/product_group_prices_rollback.php
  145. +15 −8 dev/tests/integration/testsuite/Magento/Catalog/_files/product_image.php
  146. +6 −0 dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple.php
  147. +14 −27 dev/tests/integration/testsuite/Magento/Catalog/_files/product_with_image.php
  148. +1 −0 dev/tests/integration/testsuite/Magento/Catalog/_files/product_with_image_rollback.php
  149. +28 −0 dev/tests/integration/testsuite/Magento/Store/_files/website.php
  150. +41 −0 dev/tests/integration/testsuite/Magento/Store/_files/website_rollback.php
  151. +17 −8 dev/tests/integration/testsuite/Magento/Tax/Model/Sales/Total/Quote/SetupUtil.php
  152. +2 −1 dev/tests/integration/testsuite/Magento/Tax/Model/Sales/Total/Quote/TaxTest.php
  153. +1 −0 ...ts/integration/testsuite/Magento/Tax/_files/scenarios/excluding_tax_apply_tax_before_discount.php
  154. +107 −0 .../integration/testsuite/Magento/Tax/_files/scenarios/including_tax_cross_border_trade_disabled.php
  155. +107 −0 ...s/integration/testsuite/Magento/Tax/_files/scenarios/including_tax_cross_border_trade_enabled.php
  156. +152 −0 ...integration/testsuite/Magento/Tax/_files/scenarios/multi_tax_rule_total_calculate_subtotal_no.php
  157. +152 −0 ...ntegration/testsuite/Magento/Tax/_files/scenarios/multi_tax_rule_total_calculate_subtotal_yes.php
  158. +152 −0 .../integration/testsuite/Magento/Tax/_files/scenarios/multi_tax_rule_unit_calculate_subtotal_no.php
  159. +152 −0 ...integration/testsuite/Magento/Tax/_files/scenarios/multi_tax_rule_unit_calculate_subtotal_yes.php
  160. +6 −1 dev/tests/integration/testsuite/Magento/Tax/_files/tax_calculation_data_aggregated.php
  161. +0 −10 dev/tests/integration/testsuite/Magento/Widget/Model/Widget/InstanceTest.php
  162. +1 −45 dev/tests/integration/testsuite/Magento/Widget/Model/WidgetTest.php
  163. +0 −38 dev/tests/integration/testsuite/Magento/Widget/_files/themes.php
  164. +57 −0 dev/tests/static/framework/Magento/TestFramework/Utility/ChangedFiles.php
  165. +1 −1 dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteCodeTest.php
  166. +23 −2 dev/tests/unit/testsuite/Magento/Bundle/Pricing/Adjustment/CalculatorTest.php
  167. +16 −1 dev/tests/unit/testsuite/Magento/Bundle/Pricing/Price/BundleOptionPriceTest.php
  168. +153 −63 dev/tests/unit/testsuite/Magento/Bundle/Pricing/Price/GroupPriceTest.php
  169. +161 −0 dev/tests/unit/testsuite/Magento/Catalog/Model/Product/PriceModifierTest.php
  170. +76 −0 dev/tests/unit/testsuite/Magento/Catalog/Model/ProductRepositoryTest.php
  171. +157 −162 dev/tests/unit/testsuite/Magento/Catalog/Pricing/Price/GroupPriceTest.php
  172. +167 −0 ...uite/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/GalleryEntryContentValidatorTest.php
  173. BIN ...s/unit/testsuite/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/_files/magento_image.jpg
  174. +77 −0 ...ts/unit/testsuite/Magento/Catalog/Service/V1/Product/Attribute/Media/GalleryEntryResolverTest.php
  175. +473 −0 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/Attribute/Media/ReadServiceTest.php
  176. +324 −0 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/Attribute/Media/WriteServiceTest.php
  177. +37 −1 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/AttributeGroup/ReadServiceTest.php
  178. +69 −9 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/AttributeGroup/WriteServiceTest.php
  179. +338 −0 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/GroupPriceServiceTest.php
  180. +357 −0 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/TierPriceServiceTest.php
  181. +230 −0 dev/tests/unit/testsuite/Magento/Eav/Model/Resource/Attribute/CollectionTest.php
  182. +44 −2 dev/tests/unit/testsuite/Magento/SalesRule/Model/ValidatorTest.php
  183. +405 −0 dev/tests/unit/testsuite/Magento/Tax/Model/ConfigTest.php
  184. +8 −0 dev/tests/unit/testsuite/Magento/Tax/Pricing/AdjustmentTest.php
  185. +1 −1 lib/internal/Magento/Framework/AppInterface.php
View
@@ -28,7 +28,7 @@ before_script:
# Create DB for Integration tests
- sh -c "if [ '$TEST_SUITE' = 'integration' ] || [ '$TEST_SUITE' = 'integration_integrity' ]; then mysql -e 'create database magento_integration_tests;'; mv dev/tests/integration/etc/local-mysql.travis.xml.dist dev/tests/integration/etc/local-mysql.xml; fi"
# Install tools for static tests
- - sh -c "if [ '$TEST_SUITE' = 'static_phpcs' ] || [ '$TEST_SUITE' = 'static_annotation' ]; then pear install pear/PHP_CodeSniffer-1.4.7; fi"
+ - sh -c "if [ '$TEST_SUITE' = 'static_phpcs' ] || [ '$TEST_SUITE' = 'static_annotation' ]; then pear install pear/PHP_CodeSniffer-1.5.2; fi"
- phpenv rehash;
script:
# Unit tests
View
@@ -1,3 +1,42 @@
+2.0.0.0-dev83
+=============
+* Created the Service API for the Magento_Catalog Module:
+ * Product Attribute Media API
+ * Product Group Price API
+* Tax calculation updates:
+ * Fixed tax calculation rounding issues which appeared when a discount was applied
+ * Fixed extra penny issue which appeared when exact tax amount ended with 0.5 cent
+ * Fixed tax calculation issues which appeared when a customer tax rate was different from the store tax rate
+ * Fixed price inconsistencies between catalog and shopping cart
+ * Added support for maintaining consistent prices including tax for customers with different tax rates
+ * Added support for applying tax rules with different priorities to be applied to subtotal only
+ * Added support for tax rounding at individual tax rate
+* Porting Tax Features from Magento 1.x:
+ * Price consistency UX and algorithm
+ * Canadian provincial sales taxes
+ * Fixed issues with bundle product price inconsistency across the system
+ * Added warnings if invalid tax configuration is created in the Admin panel
+ * Fixed issues with regards to hidden tax
+* Fixed bugs:
+ * Fixed an issue where grouped price was not applied for grouped products
+ * Fixed an issue where a fatal error occurred when opening a grouped product page without assigned products on the frontend
+ * Fixed an issue where it was possible to apply an inactive discount coupon
+ * Fixed an issue where the linked products information was lost when exporting products
+ * Fixed non-informative error messages for "Attribute Group Service"
+ * Fixed the invalid default value of the "apply_after_discount" tax setting
+ * Fixed an issue where the integration tests coverage whitelist was broken
+ * Fixed Admin panel UI issues: grids, headers and footers
+* Added the following functional tests:
+ * Create Product Url Rewrite
+ * Delete Catalog Price Rule
+ * Delete Category Url Rewrite
+ * Delete CMS Page Rewrite
+ * Delete Product Rating
+ * Delete Sales Rule
+ * Delete Tax Rate
+ * Update Catalog Price Rule
+ * Update Shopping Cart
+
2.0.0.0-dev82
=============
* Added support for MTF Reporting Tool
@@ -30,7 +30,7 @@
<block class="Magento\AdminNotification\Block\Window" name="notification_window" as="notification_window" acl="Magento_AdminNotification::show_toolbar" template="notification/window.phtml"/>
</referenceContainer>
<referenceContainer name="header">
- <block class="Magento\AdminNotification\Block\ToolbarEntry" template="toolbar_entry.phtml" />
+ <block class="Magento\AdminNotification\Block\ToolbarEntry" before="user" template="toolbar_entry.phtml" />
</referenceContainer>
<referenceBlock name="head">
<block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminnotification-toolbar-entry-js" after="jquery-jquery-js">
@@ -24,12 +24,31 @@
namespace Magento\Bundle\Block\Catalog\Product\View\Type;
use Magento\Framework\Pricing\PriceCurrencyInterface;
+use Magento\Tax\Model\Calculation;
/**
* Catalog bundle product info block
*/
class Bundle extends \Magento\Catalog\Block\Product\View\AbstractView
{
+ /**
+ * constants for different rounding methods
+ */
+ const UNIT_ROUNDING = 0;
+ const ROW_ROUNDING = 1;
+ const TOTAL_ROUNDING = 2;
+
+ /**
+ * Mapping between constants in \Magento\Tax\Model\Calculation and this class
+ *
+ * @var array
+ */
+ protected $mapping = [
+ Calculation::CALC_UNIT_BASE => self::UNIT_ROUNDING,
+ Calculation::CALC_ROW_BASE => self::ROW_ROUNDING,
+ Calculation::CALC_TOTAL_BASE => self::TOTAL_ROUNDING,
+ ];
+
/**
* @var array
*/
@@ -305,4 +324,16 @@ public function getOptionHtml($option)
}
return $optionBlock->setOption($option)->toHtml();
}
+
+ /**
+ * Return the rounding method based on tax calculation
+ * This is a workaround as the proper way is to always call tax service to get taxed price
+ *
+ * @return int
+ */
+ public function getRoundingMethod()
+ {
+ $algorithm = $this->_taxData->getCalculationAgorithm();
+ return isset($this->mapping[$algorithm]) ? $this->mapping[$algorithm] : self::TOTAL_ROUNDING;
+ }
}
@@ -31,6 +31,9 @@
use Magento\Framework\Pricing\Adjustment\Calculator as CalculatorBase;
use Magento\Bundle\Model\Product\Price;
use Magento\Bundle\Pricing\Price\BundleOptionPrice;
+use Magento\Tax\Model\Calculation as TaxCalculation;
+use Magento\Store\Model\Store;
+use Magento\Tax\Helper\Data as TaxHelper;
/**
* Bundle price calculator
@@ -52,20 +55,29 @@ class Calculator implements BundleCalculatorInterface
*/
protected $selectionFactory;
+ /**
+ * Tax helper, needed to get rounding setting
+ *
+ * @var TaxHelper
+ */
+ protected $taxHelper;
/**
* @param CalculatorBase $calculator
* @param AmountFactory $amountFactory
* @param BundleSelectionFactory $bundleSelectionFactory
+ * @param TaxHelper $taxHelper
* @return Calculator
*/
public function __construct(
CalculatorBase $calculator,
AmountFactory $amountFactory,
- BundleSelectionFactory $bundleSelectionFactory
+ BundleSelectionFactory $bundleSelectionFactory,
+ TaxHelper $taxHelper
) {
$this->calculator = $calculator;
$this->amountFactory = $amountFactory;
$this->selectionFactory = $bundleSelectionFactory;
+ $this->taxHelper = $taxHelper;
}
/**
@@ -254,11 +266,24 @@ protected function calculateDynamicBundleAmount($basePriceValue, $bundleProduct,
foreach ($selectionPriceList as $selectionPrice) {
$amountList[] = $selectionPrice->getAmount();
}
+ /** @var Store $store */
+ $store = $bundleProduct->getStore();
+ $roundingMethod = $this->taxHelper->getCalculationAgorithm($store);
/** @var \Magento\Framework\Pricing\Amount\AmountInterface $itemAmount */
foreach ($amountList as $itemAmount) {
- $fullAmount += $itemAmount->getValue();
- foreach ($itemAmount->getAdjustmentAmounts() as $code => $adjustment) {
- $adjustments[$code] = isset($adjustments[$code]) ? $adjustments[$code] + $adjustment : $adjustment;
+ if ($roundingMethod != TaxCalculation::CALC_TOTAL_BASE) {
+ //We need to round the individual selection first
+ $fullAmount += $store->roundPrice($itemAmount->getValue());
+ foreach ($itemAmount->getAdjustmentAmounts() as $code => $adjustment) {
+ $adjustment = $store->roundPrice($adjustment);
+ $adjustments[$code] = isset($adjustments[$code]) ? $adjustments[$code] + $adjustment : $adjustment;
+ }
+ } else {
+ $fullAmount += $itemAmount->getValue();
+ foreach ($itemAmount->getAdjustmentAmounts() as $code => $adjustment) {
+ $adjustments[$code] = isset($adjustments[$code]) ? $adjustments[$code] + $adjustment : $adjustment;
+ }
+
}
}
if ($exclude && isset($adjustments[$exclude])) {
@@ -32,6 +32,7 @@
$(document).ready(function() {
$('#product_addtocart_form').mage('bundleOption', {
"bundleConfig": <?php echo $this->getJsonConfig() ?>,
+ "roundingMethod" : "<?php echo $this->getRoundingMethod() ?>",
"bundleOptionQtyPrefix": "#bundle-option-",
"bundleOptionQtySuffix": "-qty-input",
"priceSelectors": {
@@ -251,6 +251,10 @@
},
selectionPrice: function(optionId, selectionId) {
+ //Those constants need to be in sync with Magento\Bundle\Block\Catalog\Product\View\Type\Bundle
+ var TOTAL_ROUNDING = 2;
+ var ROW_ROUNDING = 1;
+ var UNIT_ROUNDING = 0;
var qty = null,
config = this.options.bundleConfig,
configOption = config.options[optionId];
@@ -281,7 +285,19 @@
});
}
- return [price * qty, exclTaxPrice * qty, inclTaxPrice * qty];
+ if (this.options.bundleConfig.isFixedPrice || this.options.roundingMethod == TOTAL_ROUNDING) {
+ return [price * qty, exclTaxPrice * qty, inclTaxPrice * qty];
+ } else if (this.options.roundingMethod == UNIT_ROUNDING) {
+ price = Math.round(price * 100) / 100;
+ exclTaxPrice = Math.round(exclTaxPrice * 100) / 100;
+ inclTaxPrice = Math.round(inclTaxPrice * 100) / 100;
+ return [price * qty, exclTaxPrice * qty, inclTaxPrice * qty];
+ } else {
+ var rowTotal = Math.round(price * qty * 100) /100;
+ var rowTotalExclTax = Math.round(exclTaxPrice * qty * 100) /100;
+ var rowTotalInclTax = Math.round(inclTaxPrice * qty * 100) /100;
+ return [rowTotal, rowTotalExclTax, rowTotalInclTax];
+ }
},
populateQty: function(optionId, selectionId) {
@@ -236,7 +236,7 @@ public function getJsonConfig()
return $this->_jsonEncoder->encode($config);
}
- $request = $this->_taxCalculation->getRateRequest(false, false, false);
+ $request = $this->_taxCalculation->getDefaultRateRequest();
/* @var $product \Magento\Catalog\Model\Product */
$product = $this->getProduct();
$request->setProductClassId($product->getTaxClassId());
@@ -169,6 +169,11 @@ public function validate($object)
if (isset($duplicates[$compare])) {
throw new \Magento\Framework\Model\Exception($this->_getDuplicateErrorMessage());
}
+
+ if (!preg_match('/^\d*(\.|,)?\d{0,4}$/i', $priceRow['price']) || $priceRow['price'] < 0) {
+ return __('Group price must be a number greater than 0.');
+ }
+
$duplicates[$compare] = true;
}
@@ -346,6 +346,7 @@ public function afterSave($object)
$this->_getResource()->deleteGallery($recordsToDelete);
$this->removeDeletedImages($filesToDelete);
+ $object->setData($attrCode, $value);
}
/**
@@ -0,0 +1,109 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Catalog\Model\Product;
+
+use Magento\Framework\Exception\NoSuchEntityException;
+use Magento\Framework\Exception\CouldNotSaveException;
+
+class PriceModifier
+{
+ /**
+ * @param \Magento\Catalog\Model\Product $product
+ * @param int $customerGroupId
+ * @param int $websiteId
+ * @throws \Magento\Framework\Exception\NoSuchEntityException
+ * @throws \Magento\Framework\Exception\CouldNotSaveException
+ * @return void
+ */
+ public function removeGroupPrice(\Magento\Catalog\Model\Product $product, $customerGroupId, $websiteId)
+ {
+ $prices = $product->getData('group_price');
+ if (is_null($prices)) {
+ throw new NoSuchEntityException("This product doesn't have group price");
+ }
+ $groupPriceQty = count($prices);
+
+ foreach ($prices as $key => $groupPrice) {
+ if ($groupPrice['cust_group'] == $customerGroupId
+ && intval($groupPrice['website_id']) === intval($websiteId)) {
+ unset ($prices[$key]);
+ }
+ }
+ if ($groupPriceQty == count($prices)) {
+ throw new NoSuchEntityException(
+ "Product hasn't group price with such data: customerGroupId = '$customerGroupId',"
+ . "website = $websiteId."
+ );
+ }
+ $product->setData('group_price', $prices);
+ try {
+ $product->save();
+ } catch (\Exception $exception) {
+ throw new CouldNotSaveException("Invalid data provided for group price");
+ }
+ }
+
+ /**
+ * @param \Magento\Catalog\Model\Product $product
+ * @param int|string $customerGroupId
+ * @param int $qty
+ * @param int $websiteId
+ * @throws \Magento\Framework\Exception\NoSuchEntityException
+ * @throws \Magento\Framework\Exception\CouldNotSaveException
+ * @return void
+ */
+ public function removeTierPrice(\Magento\Catalog\Model\Product $product, $customerGroupId, $qty, $websiteId)
+ {
+ $prices = $product->getData('tier_price');
+ // verify if price exist
+ if (is_null($prices)) {
+ throw new NoSuchEntityException("This product doesn't have tier price");
+ }
+ $tierPricesQty = count($prices);
+
+ foreach ($prices as $key => $tierPrice) {
+ if ($customerGroupId == 'all' && $tierPrice['price_qty'] == $qty
+ && $tierPrice['all_groups'] == 1 && intval($tierPrice['website_id']) === intval($websiteId)) {
+ unset ($prices[$key]);
+ } elseif ($tierPrice['price_qty'] == $qty && $tierPrice['cust_group'] == $customerGroupId
+ && intval($tierPrice['website_id']) === intval($websiteId)) {
+ unset ($prices[$key]);
+ }
+ }
+
+ if ($tierPricesQty == count($prices)) {
+ throw new NoSuchEntityException(
+ "Product hasn't group price with such data: customerGroupId = '$customerGroupId',"
+ . "website = $websiteId, qty = $qty"
+ );
+ }
+ $product->setData('tier_price', $prices);
+ try {
+ $product->save();
+ } catch (\Exception $exception) {
+ throw new CouldNotSaveException("Invalid data provided for tier_price");
+ }
+ }
+}
Oops, something went wrong.

0 comments on commit ea1a2b7

Please sign in to comment.