From 7ffa102b2d89ea897841b3c46c3292ce0c4fbdcb Mon Sep 17 00:00:00 2001 From: Jacques Le Roux Date: Tue, 15 Feb 2011 10:40:17 +0000 Subject: [PATCH] A patch from Paul Foxworthy "Tax not added for order shipping or promotion" (https://issues.apache.org/jira/browse/OFBIZ-4160) - OFBIZ-4160 When shipping is calculated for the entire order or a promotion adjustment is made, the relevant tax rows from the TaxAuthorityRateProduct table are not being found. This bug was discovered independently by Sergei Biletnikov, see http://ofbiz.135035.n4.nabble.com/VAT-is-not-applied-for-the-shipping-td3234699.html. I committed Paul's (slightly modified: formatting) patch with an explanation on screen. I will later add an enforcing js script This is not a definitive answer but a workaround, see http://markmail.org/message/ewvaljuqg3voiy2s for more git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1070830 13f79535-47bb-0310-9956-ffa450edef68 --- .../accounting/config/AccountingUiLabels.xml | 9 +++++-- .../accounting/tax/TaxAuthorityServices.java | 27 +++++++++++++++++++ .../accounting/widget/TaxAuthorityScreens.xml | 2 ++ 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/applications/accounting/config/AccountingUiLabels.xml b/applications/accounting/config/AccountingUiLabels.xml index 5813872efb..bd50524dca 100644 --- a/applications/accounting/config/AccountingUiLabels.xml +++ b/applications/accounting/config/AccountingUiLabels.xml @@ -10953,6 +10953,10 @@ 税务机关 稅務機關 + + Beware: don't use more than one line with "Tax Shipping" and/or "Tax Promotions" value = "Y" + Attention: n'utilisez pas plus d'une ligne avec "Taxes sur livraison" et/ou "Taxes sur promotions" = "Y" + Tax Authority Geo Zone géographique de l'administration fiscale @@ -15365,6 +15369,7 @@ Tax Promotions + Taxes sur promotions टैक्स संवर्धन Tassa promozioni Imposto sobre promoções @@ -17274,10 +17279,10 @@ Payment receive via iDEAL भुगतान iDEAL के माध्यम से प्राप्त Pagamento ricevuto da iDEAL - Betalingsontvangst via iDEAL + Betalingsontvangst via iDEAL The transaction has been successfull. - De betaling is met succes ontvangen. + De betaling is met succes ontvangen. diff --git a/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java b/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java index a3b33c2d52..449e65c351 100644 --- a/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java +++ b/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java @@ -350,6 +350,33 @@ public class TaxAuthorityServices { productCategoryCond = EntityCondition.makeCondition("productCategoryId", EntityOperator.EQUALS, null); } + // FIXME handles shipping and promo tax. Simple solution, see https://issues.apache.org/jira/browse/OFBIZ-4160 for a better one + if (product == null && shippingAmount != null) { + EntityCondition taxShippingCond = EntityCondition.makeCondition( + EntityCondition.makeCondition("taxShipping", EntityOperator.EQUALS, null), + EntityOperator.OR, + EntityCondition.makeCondition("taxShipping", EntityOperator.EQUALS, "Y")); + + if (productCategoryCond != null) { + productCategoryCond = EntityCondition.makeCondition(productCategoryCond, + EntityOperator.OR, + taxShippingCond); + } + } + + if (product == null && orderPromotionsAmount != null) { + EntityCondition taxOrderPromotionsCond = EntityCondition.makeCondition( + EntityCondition.makeCondition("taxPromotions", EntityOperator.EQUALS, null), + EntityOperator.OR, + EntityCondition.makeCondition("taxPromotions", EntityOperator.EQUALS, "Y")); + + if (productCategoryCond != null) { + productCategoryCond = EntityCondition.makeCondition(productCategoryCond, + EntityOperator.OR, + taxOrderPromotionsCond); + } + } + // build the main condition clause List mainExprs = UtilMisc.toList(storeCond, taxAuthoritiesCond, productCategoryCond); mainExprs.add(EntityCondition.makeCondition(EntityCondition.makeCondition("minItemPrice", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("minItemPrice", EntityOperator.LESS_THAN_EQUAL_TO, itemPrice))); diff --git a/applications/accounting/widget/TaxAuthorityScreens.xml b/applications/accounting/widget/TaxAuthorityScreens.xml index 51f07819fe..8921a2af88 100644 --- a/applications/accounting/widget/TaxAuthorityScreens.xml +++ b/applications/accounting/widget/TaxAuthorityScreens.xml @@ -193,8 +193,10 @@ under the License. + +