From cf89bc01974631eecc60a7724f48d68d8ec6e87e Mon Sep 17 00:00:00 2001 From: Ashish Vijaywargiya Date: Sat, 31 Jul 2010 09:44:07 +0000 Subject: [PATCH] When we pass fractional package weight to UPS like (0.5) then it gives error. This is because in UpsServices.java file, package weight has been changed to boxWeight.intValue() so it converts 0.5 to 0. Now if we pass only boxWeight big decimal number, code runs perfectly fine on confirming shipment. Searched out in ups shipping document and found that we should pass this fractional weight to ups to its next full weight. For example 0.5 will be sent as 1.0 and 1.2 will be sent as 2.0 etc. Here is the link: http://www.ups.com/content/us/en/resources/prepare/oversize.html search for this text "Determine the Actual Weight" in this link. Having come to know this fact I converted boxWeight.intValue() code into boxWeight.setScale(0, boxWeight.ROUND_CEILING) which solves this purpose which is given in above mentioned link. Patch from Vivek Mishra(Thanks!) git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@981025 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java b/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java index 42142374a7..ec00178881 100644 --- a/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java +++ b/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java @@ -521,7 +521,7 @@ public class UpsServices { return ServiceUtil.returnError("Weight value not found for ShipmentRouteSegment with shipmentId " + shipmentId + ", shipmentRouteSegmentId " + shipmentRouteSegmentId + ", and shipmentPackageSeqId " + shipmentPackage.getString("shipmentPackageSeqId")); } BigDecimal boxWeight = shipmentPackage.getBigDecimal("weight"); - UtilXml.addChildElementValue(packageWeightElement, "Weight", UtilValidate.isNotEmpty(boxWeight) ? ""+boxWeight.intValue() : "", shipmentConfirmRequestDoc); + UtilXml.addChildElementValue(packageWeightElement, "Weight", UtilValidate.isNotEmpty(boxWeight) ? ""+ boxWeight.setScale(0, boxWeight.ROUND_CEILING) : "", shipmentConfirmRequestDoc); // Adding only when order is not an international order if (!internationalServiceCodes.contains(carrierServiceCode)) { Element referenceNumberElement = UtilXml.addChildElement(packageElement, "ReferenceNumber", shipmentConfirmRequestDoc);