You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by le...@apache.org on 2007/12/29 01:03:26 UTC

svn commit: r607359 - /ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java

Author: lektran
Date: Fri Dec 28 16:03:25 2007
New Revision: 607359

URL: http://svn.apache.org/viewvc?rev=607359&view=rev
Log:
Applied (modified) patch from Jérémy Wickersheimer, OFBIZ-1548: rateProductTaxCalc expecting a value for orderShippingAmount but marked optional in servicedef
I changed it use BigDecimal's compare rather than doubleValue and did the same for any other BigDecimal comparisons in the file

Modified:
    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java

Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java?rev=607359&r1=607358&r2=607359&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java Fri Dec 28 16:03:25 2007
@@ -57,9 +57,9 @@
     public static final BigDecimal ZERO_BASE = BigDecimal.ZERO; 
     public static final BigDecimal ONE_BASE = BigDecimal.ONE; 
     public static final BigDecimal PERCENT_SCALE = new BigDecimal("100.000"); 
-    public static int salestaxFinalDecimals=UtilNumber.getBigDecimalScale("salestax.final.decimals");
-    public static int salestaxCalcDecimals=UtilNumber.getBigDecimalScale("salestax.calc.decimals");
-    public static int salestaxRounding=UtilNumber.getBigDecimalRoundingMode("salestax.rounding");
+    public static int salestaxFinalDecimals = UtilNumber.getBigDecimalScale("salestax.final.decimals");
+    public static int salestaxCalcDecimals = UtilNumber.getBigDecimalScale("salestax.calc.decimals");
+    public static int salestaxRounding = UtilNumber.getBigDecimalRoundingMode("salestax.rounding");
 
     public static Map rateProductTaxCalcForDisplay(DispatchContext dctx, Map context) {
         GenericDelegator delegator = dctx.getDelegator();
@@ -184,11 +184,11 @@
             // this is an add and not an addAll because we want a List of Lists of GenericValues, one List of Adjustments per item
             itemAdjustments.add(taxList);
         }
-        if (orderShippingAmount.doubleValue() > 0) {
+        if (orderShippingAmount != null && orderShippingAmount.compareTo(BigDecimal.ZERO) > 0) {
             List taxList = getTaxAdjustments(delegator, null, productStore, payToPartyId, billToPartyId, taxAuthoritySet, ZERO_BASE, ZERO_BASE, orderShippingAmount, ZERO_BASE);
             orderAdjustments.addAll(taxList);
         }
-        if(orderPromotionsAmount!=null && orderPromotionsAmount.doubleValue() != 0){
+        if (orderPromotionsAmount != null && orderPromotionsAmount.compareTo(BigDecimal.ZERO) != 0){
             List taxList = getTaxAdjustments(delegator, null, productStore, payToPartyId, billToPartyId, taxAuthoritySet, ZERO_BASE, ZERO_BASE, ZERO_BASE, orderPromotionsAmount);
             orderAdjustments.addAll(taxList);
         }
@@ -332,7 +332,7 @@
                     taxable = taxable.add(orderPromotionsAmount);
                 }
                 
-                if (taxable.doubleValue() == 0) {
+                if (taxable.compareTo(BigDecimal.ZERO) == 0) {
                     // this should make it less confusing if the taxable flag on the product is not Y/true, and there is no shipping and such
                     continue;
                 }