You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by as...@apache.org on 2010/09/25 12:11:45 UTC

svn commit: r1001185 - /ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java

Author: ashish
Date: Sat Sep 25 10:11:45 2010
New Revision: 1001185

URL: http://svn.apache.org/viewvc?rev=1001185&view=rev
Log:
Bug fix.
While fetching shipping estimate it should compare countryGeoId instead shippingCountryCode. Now shipping rules along with quantity break will work without any issue. 
Thanks Amit for the contribution. 

Modified:
    ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java?rev=1001185&r1=1001184&r2=1001185&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java Sat Sep 25 10:11:45 2010
@@ -288,8 +288,18 @@ public class ShipmentServices {
                 return ServiceUtil.returnError("Cannot get shipping address entity");
             }
         } else if (shippingPostalCode != null) {
+            String countryGeoId = null;
+            try {
+                EntityCondition cond =EntityCondition.makeCondition(UtilMisc.toMap("geoTypeId", "COUNTRY", "geoCode", shippingCountryCode));
+                GenericValue countryGeo = EntityUtil.getFirst(delegator.findList("Geo", cond, null, null, null, true));
+                if (countryGeo != null) {
+                    countryGeoId = countryGeo.getString("geoId");
+                }
+            } catch (GenericEntityException e) {
+                Debug.logError(e, module);
+            }
             shipAddress = delegator.makeValue("PostalAddress");
-            shipAddress.set("countryGeoId", shippingCountryCode);
+            shipAddress.set("countryGeoId", countryGeoId);
             shipAddress.set("postalCodeGeoId", shippingPostalCode);
         }
         // Get the possible estimates.