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

Leon commented on OFBIZ-4470:
-----------------------------

Hi Jacques, sorry for late response.

The problem is occured after I applied our internal patch as OFBIZ-4485 
described (see the third change: make order item sequence id more compact and 
truely "sequential"). sorry again for not mention this earlier.

And if we allowe the empty order (the order without any valid item or all order 
items are cancelled), then this problem will also occur if all the order items 
have been cancelled and the new order item is appeneded after that.

In the code level, if the nextItemSeq is set to the sequence id of last order 
item but not the true "next" one, then in ShoppingCart.makeOrderItems method, 
the problem will occur if the cart does not contain any exist order items (all 
cart items's orderItemSeqId are null):
{code:java} 
            for (ShoppingCartItem item : cartLines) {
                if (UtilValidate.isEmpty(item.getOrderItemSeqId())) {
                    String orderItemSeqId = 
UtilFormatOut.formatPaddedNumber(nextItemSeq, 5);
                    item.setOrderItemSeqId(orderItemSeqId);
                } else {
                    try {
                        int thisSeqId = 
Integer.parseInt(item.getOrderItemSeqId());
                        if (thisSeqId > nextItemSeq) {
                            nextItemSeq = thisSeqId;
                        }
                    } catch (NumberFormatException e) {
                        Debug.logError(e, module);
                    }
                }
                nextItemSeq++;
{code}
                
> Append order item overrides the exist one if the last order item is "canceled"
> ------------------------------------------------------------------------------
>
>                 Key: OFBIZ-4470
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-4470
>             Project: OFBiz
>          Issue Type: Bug
>          Components: order
>    Affects Versions: SVN trunk
>            Reporter: Leon
>            Priority: Minor
>             Fix For: SVN trunk
>
>         Attachments: OFBIZ-4470.patch
>
>
> An order was created and its last order item (with max itemSeqId) was 
> canceled. If appened a new order item to this order, the new one will 
> override the last one.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to