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

Darrell Donati commented on OFBIZ-5570:
---------------------------------------

Hi Pierre,

It's possible that my interpretation of the use of the itemAttributesMap field 
is incorrect, but given its usage in the updateOrderItems service is how I came 
to the conclusion that it should be used for OrderItemAttribute's. Note that in 
updateOrderItems, the usage appears slightly different in that the service is 
updating multiple items in a single order, so the map takes in a combined key 
(orderItemSeqId, and orderItemAttrKey delimited by colon) in order to allow a 
single map to be used for many items.

What I'm thinking should go in the "itemAttributesMap" is a Map<String,String> 
of entries which will ultimately end up in the OrderItemAttribute entity. 

The service currently gets a handle to a cart representing the order, adds in 
the new product, and then calls saveUpdatedCartToOrder(). This method calls 
cart.makeAllOrderItemAttributes(), which would get the GenericValues 
representing the "OrderItemAttribute" entity for all items in the cart. 
However, since these OrderItemAttributes aren't being set on the item as it's 
added into the cart in the 'addItemToApprovedOrder' service, the 
makeAllOrderItemAttributes() call is empty.

For example, given a SALES Order with orderId 10000, I run the 
"addItemToApprovedOrder" service, passing in the requisite fields, and 
itemAttributesMap with value ["FOO":"BAR"]. If you query the OrderItemAttribute 
entity, I would expect to see: [orderId: 10000, attrName: FOO, attrValue: BAR].

Thanks,
Darrell

> appendOrderItem Service Not Applying Order Item Attributes
> ----------------------------------------------------------
>
>                 Key: OFBIZ-5570
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5570
>             Project: OFBiz
>          Issue Type: Bug
>          Components: order
>    Affects Versions: SVN trunk
>            Reporter: Darrell Donati
>
> Please see the user mailing list discussion: 
> http://ofbiz.135035.n4.nabble.com/Possible-Issue-appendOrderItem-Service-td4648984.html
> Copied issue for archival purposes:
> Hi Folks, 
> I'm running 12.04.02, 
> I'm using the "appendOrderItem" service in the order application. The service 
> definition allows for an optional Map of order item attributes called 
> "itemAttributesMap". However, the addItemToApprovedOrder method in 
> OrderServices isn't using that map from the service context, thus the order 
> item attributes aren't being added to the item when it's added to the order. 
> I've checked the addItemToApprovedOrder method in the trunk OrderServices, 
> and the itemAttributesMap is not being utilized there either. I can fix and 
> submit a patch (see implementation in updateOrderItems service), but wanted 
> to ensure this wasn't a design choice. 
> Thanks, 
> Darrell



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to