[jira] [Commented] (OFBIZ-9910) Getting console error on creating sales order, while using UPS live ship rates

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

[jira] [Commented] (OFBIZ-9910) Getting console error on creating sales order, while using UPS live ship rates

Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-9910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16665989#comment-16665989 ]

Aditi Patidar commented on OFBIZ-9910:
--------------------------------------

Previously I was getting null pointer exception which is handled now but we will always get zero as it's set by key "weight" in the itemInfo map but while fetching the key used is "productWeight". 

 
{code:java}
public Map<String, Object> getItemProductInfo() {
    Map<String, Object> itemInfo = new HashMap<>();
    itemInfo.put("productId", this.getProductId());
    itemInfo.put("weight", this.getWeight());
{code}
 

 
{code:java}
public static BigDecimal calcPackageWeight(DispatchContext dctx, Map<String, BigDecimal> packageMap, List<Map<String, Object>> shippableItemInfo, BigDecimal additionalWeight) {
    LocalDispatcher dispatcher = dctx.getDispatcher();
    Delegator delegator = dctx.getDelegator();
    BigDecimal totalWeight = BigDecimal.ZERO;
    String defaultWeightUomId = EntityUtilProperties.getPropertyValue("shipment", "shipment.default.weight.uom", delegator);

    for (Map.Entry<String, BigDecimal> entry: packageMap.entrySet()) {
        String productId = entry.getKey();
        Map<String, Object> productInfo = getProductItemInfo(shippableItemInfo, productId);
        BigDecimal productWeight = (BigDecimal) productInfo.get("productWeight");
        if (productWeight == null) productWeight = BigDecimal.ZERO;
...
}

{code}
Providing the patch for the same.

 

> Getting console error on creating sales order, while using UPS live ship rates
> ------------------------------------------------------------------------------
>
>                 Key: OFBIZ-9910
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-9910
>             Project: OFBiz
>          Issue Type: Bug
>          Components: order
>    Affects Versions: Trunk
>            Reporter: Aditi Patidar
>            Assignee: Aditi Patidar
>            Priority: Major
>         Attachments: current.png
>
>
> please view attached screenshot for the error.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)