Re: svn commit: r981026 - /ofbiz/branches/release10.04/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java

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

Re: svn commit: r981026 - /ofbiz/branches/release10.04/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java

Vivek Mishra-2
Thanks Ashish.

Regards,
-- Vivek Mishra

On Saturday 31 July 2010 03:21 PM, [hidden email] wrote:

> Author: ashish
> Date: Sat Jul 31 09:51:16 2010
> New Revision: 981026
>
> URL: http://svn.apache.org/viewvc?rev=981026&view=rev
> Log:
> Applied fix from trunk for revision: 981025
> 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!)
>
> Modified:
>      ofbiz/branches/release10.04/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java
>
> Modified: ofbiz/branches/release10.04/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java
> URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java?rev=981026&r1=981025&r2=981026&view=diff
> ==============================================================================
> --- ofbiz/branches/release10.04/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java (original)
> +++ ofbiz/branches/release10.04/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java Sat Jul 31 09:51:16 2010
> @@ -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);
>
>
>