Author: sichen
Date: Mon Feb 12 16:25:09 2007
New Revision: 506763

URL: http://svn.apache.org/viewvc?view=rev&rev=506763
Log:
Changed USPS rate estimate service to use the default.weight.uom.id set in 
shipment.properties rather than always WT_oz

Modified:
    
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java

Modified: 
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java?view=diff&rev=506763&r1=506762&r2=506763
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java
 (original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java
 Mon Feb 12 16:25:09 2007
@@ -268,6 +268,12 @@
 
         LocalDispatcher dispatcher = dctx.getDispatcher();
         double totalWeight = 0.00;
+        String defaultWeightUomId = 
UtilProperties.getPropertyValue("shipment.properties", 
"shipment.default.weight.uom");
+        if (UtilValidate.isEmpty(defaultWeightUomId)) {
+            Debug.logWarning("No shipment.default.weight.uom set in 
shipment.properties, setting it to WT_oz for USPS", module);
+            defaultWeightUomId = "WT_oz";
+        }
+        
         Iterator i = packageMap.keySet().iterator();
         while (i.hasNext()) {
             String productId = (String) i.next();
@@ -278,10 +284,10 @@
             // DLK - I'm not sure if this line is working. shipment_package 
seems to leave this value null so???
             String weightUomId = (String) productInfo.get("weight_uom_id");
 
-            Debug.logInfo("Product Id : " + productId.toString() + " Product 
Weight : " + String.valueOf(productWeight) + " Product UomId : " + weightUomId 
+ " assuming WT_oz if null. Quantity : " + String.valueOf(quantity), module);
+            Debug.logInfo("Product Id : " + productId.toString() + " Product 
Weight : " + String.valueOf(productWeight) + " Product UomId : " + weightUomId 
+ " assuming " + defaultWeightUomId + " if null. Quantity : " + 
String.valueOf(quantity), module);
 
             if (UtilValidate.isEmpty(weightUomId)) {
-                weightUomId = "WT_oz"; // assume weight is in pounds
+                weightUomId = defaultWeightUomId; 
                 //  Most shipping modules assume pounds while 
ProductEvents.java assumes WT_oz. - Line 720 for example.
             }
             if (!"WT_lb".equals(weightUomId)) {


Reply via email to