ofbiz-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aditya Sharma (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OFBIZ-9339) adding product to purchase order auto assigned PRODUCT_ORDER_ITEM
Date Sun, 21 May 2017 06:00:11 GMT

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

Aditya Sharma commented on OFBIZ-9339:

I traced the flow and it is in the code:
The ShoppingCartItem constructor ensures if no itemType provided for purchase order "PRODUCT_ORDER_ITEM"
is set to default value.

The flow:
1. "addItem" requests invokes event "addToCart" from "ShoppingCartEvents".
2. In addToCart event, it calls addToCart() method of ShoppingCartHelper (line 639).
3. In addToCart() method, it calls addOrIncreaseItem() of ShoppingCart (line 242).
4. In addOrIncreaseItem(), it calls ShoppingCartItem.makePurchaseOrderItem() (line 575).
5. In makePurchaseOrderItem(), a new ShoppingCartItem object is created (line 198) and added
to cart.
6. The public ShoppingCartItem contructor that initialises the object calls another protected
constructor which contains following check (on line 731)

if (UtilValidate.isEmpty(itemType)) {
            if (UtilValidate.isNotEmpty(_product.getString("productTypeId"))) {
                if ("ASSET_USAGE".equals(_product.getString("productTypeId"))) {
                    this.itemType = "RENTAL_ORDER_ITEM";  // will create additional workeffort/asset
usage records
                } else if ("ASSET_USAGE_OUT_IN".equals(_product.getString("productTypeId")))
                    this.itemType = "RENTAL_ORDER_ITEM";
                } else {
                    this.itemType = "PRODUCT_ORDER_ITEM";
            } else {
                // NOTE DEJ20100111: it seems safe to assume here that because a product is
passed in that even if the product has no type this type of item still applies; thanks to
whoever wrote the previous code, that's a couple of hours tracking this down that I wouldn't
have minded doing something else with... :)
                this.itemType = "PRODUCT_ORDER_ITEM";
        } else {
            this.itemType = itemType;

> adding product to purchase order auto assigned PRODUCT_ORDER_ITEM
> -----------------------------------------------------------------
>                 Key: OFBIZ-9339
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-9339
>             Project: OFBiz
>          Issue Type: Bug
>          Components: order
>    Affects Versions: Trunk
>            Reporter: Wai
> When creating a purchase order. Adding an product without specifying the "Item Type"
is automatically given value of PRODUCT_ORDER_ITEM. The permitted values should be: ASSET_ORDER_ITEM,

This message was sent by Atlassian JIRA

View raw message