OFBiz
  1. OFBiz
  2. OFBIZ-386

Adding additional items in order entry messes up values for quantity/remaining/outstanding on cancelled line items

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: SVN trunk
    • Fix Version/s: None
    • Component/s: order
    • Labels:
      None
    • Environment:

      N/A : Clean SVN Derby Sun JDK 1.4.11 Win2k

      Description

      Create an order with two items, for example GZ-1000 and GZ-1001 – itemstatus1.png

      Edit the order and cancel one of the line items – itemstatus2.png shows 1 item ordered, 1 cancelled, 0 remaining, outstanding and shortfalled.

      Now edit the order again and add a new product such as GZ-1004 – itemstatus3.png this shows affect of the change to the order. The cancelled line items values have been decremented, you can repeat adding items and it keeps decrementing the cancelled line items values!

      This makes a mess of the ordered quantity so you can't rely on knowing what was previously ordered.

      1. order.patch
        2 kB
        Scott Gray
      2. itemstatus1.png
        11 kB
        Ray Barlow
      3. itemstatus2.png
        9 kB
        Ray Barlow
      4. itemstatus3.png
        21 kB
        Ray Barlow

        Activity

        Gavin made changes -
        Workflow jira [ 12387349 ] OFbiz Workflow [ 12504546 ]
        Jacopo Cappellato made changes -
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Closed [ 6 ]
        Hide
        Jacopo Cappellato added a comment -

        Scott,

        thanks your patch is in rev. 484961

        Show
        Jacopo Cappellato added a comment - Scott, thanks your patch is in rev. 484961
        Hide
        Jacopo Cappellato added a comment -

        I'm now testing the patch; if everything will look good to me I'll commit it soon.

        Show
        Jacopo Cappellato added a comment - I'm now testing the patch; if everything will look good to me I'll commit it soon.
        Hide
        Ray Barlow added a comment -

        The patch looks good and resolves the problem, thanks.

        Show
        Ray Barlow added a comment - The patch looks good and resolves the problem, thanks.
        Jacopo Cappellato made changes -
        Assignee Jacopo Cappellato [ jacopoc ]
        Hide
        Jacopo Cappellato added a comment -

        Scott,

        I have not tested it, but your patch seems very promising.
        I'd love to get Ray's feedback about it: Ray can you test it and let us know the results?

        Scott, in the meantime, thanks for your excellent work: it's really nice to see critical bugs in complex areas of OFBiz like this one, resolved by simple/clear patches like this (however I perfectly know that the amount of time needed to track the problem down is really big even if the patch to fix it is so simple).

        Show
        Jacopo Cappellato added a comment - Scott, I have not tested it, but your patch seems very promising. I'd love to get Ray's feedback about it: Ray can you test it and let us know the results? Scott, in the meantime, thanks for your excellent work: it's really nice to see critical bugs in complex areas of OFBiz like this one, resolved by simple/clear patches like this (however I perfectly know that the amount of time needed to track the problem down is really big even if the patch to fix it is so simple).
        Scott Gray made changes -
        Attachment order.patch [ 12344816 ]
        Hide
        Scott Gray added a comment -

        This patch fixes the problem Ray has described, I've also removed the redundant code that Ray mentioned in OrderReadHelper.getOrderItemQuantityBd(orderItem)

        Regards
        Scott

        Show
        Scott Gray added a comment - This patch fixes the problem Ray has described, I've also removed the redundant code that Ray mentioned in OrderReadHelper.getOrderItemQuantityBd(orderItem) Regards Scott
        Hide
        Ray Barlow added a comment -

        David,

        I've done a little digging and have a question around: OrderReadHelper.getOrderItemQuantityBd()

        Firstly going back a while now this log:
        http://svn.ofbiz.org/viewcvs/trunk/components/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=4367&r1=4281&r2=4367
        shows a change to the strings that seems to make the first if statement redundant?! I presume either that statement can now be removed or the original intention of the statement needs reimplementing?

        Secondly reading this code I can see why this bug is happening, after completing stage 2 above when adding the new item the code does "ordered - cancelled = quantity" which equates to "1 - 1 = 0". Keep repeating this and the problem just gets worse.

        Show
        Ray Barlow added a comment - David, I've done a little digging and have a question around: OrderReadHelper.getOrderItemQuantityBd() Firstly going back a while now this log: http://svn.ofbiz.org/viewcvs/trunk/components/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=4367&r1=4281&r2=4367 shows a change to the strings that seems to make the first if statement redundant?! I presume either that statement can now be removed or the original intention of the statement needs reimplementing? Secondly reading this code I can see why this bug is happening, after completing stage 2 above when adding the new item the code does "ordered - cancelled = quantity" which equates to "1 - 1 = 0". Keep repeating this and the problem just gets worse.
        Jacques Le Roux made changes -
        Priority Major [ 3 ] Critical [ 2 ]
        Hide
        Jacques Le Roux added a comment -

        I Agree Ray. It's now critical.

        Show
        Jacques Le Roux added a comment - I Agree Ray. It's now critical.
        Hide
        Ray Barlow added a comment -

        On reflection I should have raised this bug as critcal rather than major and would suggest to those that can that it's priority gets raised.

        Following on from the comments I made originally if two new items are added to the order after the initial item is cancelled then the quantity for the first cancelled item will become -1, as I suggested. The order manager generally handles this OK and prices are left as 0 in the subtotals column, which is why I thought just "major" priority, unfortunately other areas especially customer facing don't handle it!

        For example look at the order in the ecommerce order history page and the quantity ordered shows -1, then follow along to the subtotal and it shows (2xUnitPrice) i.e. a discount! Needless to say looking down the order the grand total is just way out now.

        Show
        Ray Barlow added a comment - On reflection I should have raised this bug as critcal rather than major and would suggest to those that can that it's priority gets raised. Following on from the comments I made originally if two new items are added to the order after the initial item is cancelled then the quantity for the first cancelled item will become -1, as I suggested. The order manager generally handles this OK and prices are left as 0 in the subtotals column, which is why I thought just "major" priority, unfortunately other areas especially customer facing don't handle it! For example look at the order in the ecommerce order history page and the quantity ordered shows -1, then follow along to the subtotal and it shows (2xUnitPrice) i.e. a discount! Needless to say looking down the order the grand total is just way out now.
        Ray Barlow made changes -
        Field Original Value New Value
        Attachment itemstatus2.png [ 12343240 ]
        Attachment itemstatus3.png [ 12343241 ]
        Attachment itemstatus1.png [ 12343239 ]
        Ray Barlow created issue -

          People

          • Assignee:
            Jacopo Cappellato
            Reporter:
            Ray Barlow
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development