svn commit: r577173 - /ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/order/OrderServices.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r577173 - /ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/order/OrderServices.java

jleroux@apache.org
Author: jleroux
Date: Wed Sep 19 00:01:58 2007
New Revision: 577173

URL: http://svn.apache.org/viewvc?rev=577173&view=rev
Log:
Applied fix from trunk for revision: 566719

Modified:
    ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/order/OrderServices.java

Modified: ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/order/OrderServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=577173&r1=577172&r2=577173&view=diff
==============================================================================
--- ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/order/OrderServices.java (original)
+++ ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/order/OrderServices.java Wed Sep 19 00:01:58 2007
@@ -1298,6 +1298,16 @@
                     }
 
                     GenericValue shippingAddress = orh.getShippingAddress(shipGroupSeqId);
+                    // no shipping address, try the billing address
+                    if (shippingAddress == null) {
+                        List billingAddressList = orh.getBillingLocations();
+                        if (billingAddressList.size() > 0) {
+                            shippingAddress = (GenericValue) billingAddressList.get(0);
+                        }
+                    }
+                    
+                    // TODO and NOTE DEJ20070816: this is NOT a good way to determine if this is a face-to-face or immediatelyFulfilled order
+                    //this should be made consistent with the CheckOutHelper.makeTaxContext(int shipGroup, GenericValue shipAddress) method
                     if (shippingAddress == null) {
                         // face-to-face order; use the facility address
                         String facilityId = orderHeader.getString("originFacilityId");
@@ -1322,6 +1332,11 @@
                         }
                     }
 
+                    // if shippingAddress is still null then don't calculate tax; it may be an situation where no tax is applicable, or the data is bad and we don't have a way to find an address to check tax for
+                    if (shippingAddress == null) {
+                        continue;
+                    }
+                    
                     // prepare the service context
                     // pass in BigDecimal values instead of Double
                     Map serviceContext = UtilMisc.toMap("productStoreId", orh.getProductStoreId(), "itemProductList", products, "itemAmountList", amounts,