svn commit: r612332 - /ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java

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

svn commit: r612332 - /ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java

sichen
Author: sichen
Date: Tue Jan 15 17:42:22 2008
New Revision: 612332

URL: http://svn.apache.org/viewvc?rev=612332&view=rev
Log:
If only one package is being sent via USPS, use the shippableWeight input rather than the package input, because the weight specified should take precedence over the weight calculated.

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?rev=612332&r1=612331&r2=612332&view=diff
==============================================================================
--- 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 Tue Jan 15 17:42:22 2008
@@ -144,11 +144,12 @@
 
         List shippableItemInfo = (List) context.get("shippableItemInfo");
         List packages = getPackageSplit(dctx, shippableItemInfo, maxWeight);
+        boolean isOnePackage = packages.size() == 1; // use shippableWeight if there's only one package
         // TODO: Up to 25 packages can be included per request - handle more than 25
         for (ListIterator li = packages.listIterator(); li.hasNext();) {
             Map packageMap = (Map) li.next();
 
-            double packageWeight = calcPackageWeight(dctx, packageMap, shippableItemInfo, 0);
+            double packageWeight = isOnePackage ? shippableWeight.doubleValue() : calcPackageWeight(dctx, packageMap, shippableItemInfo, 0);
             if (packageWeight == 0) {
                 continue;
             }