Bug 17172

Summary: Cancelling an order before basket is closed leaves aqorders.status set to 'ordered'
Product: Koha Reporter: Barton Chittenden <barton>
Component: AcquisitionsAssignee: Bugs List <koha-bugs>
Status: RESOLVED DUPLICATE QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: fiona.borthwick, katrin.fischer, marjorie.barry-vila, patrick.robitaille, severine.queune
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:

Description Barton Chittenden 2016-08-23 17:45:41 UTC
Deleting an order before a basket is closed sets aqorders.datecancellationprinted, but does *not* change aqorders.orderstatus, which stays at 'new'.

When the basket is closed, aqorders.orderstatus is set to 'ordered'

I can't tell if this is an oversight, or an attempt to distinguish between orders cancelled before the basket is sent to the vendor (i.e. orders abandoned by the library) and orders cancelled after the basket is closed (cancelled by the vendor) -- See Bug 10918.

To replicate:

Prerequisites: Existing vendor, Budget, Fund, set up an open basket.

1/ Place an order
2/ Cancel the order

Run the following query:

SELECT
    ordernumber,
    biblionumber, 
    orderstatus, 
    datecancellationprinted
FROM
    aqorders
WHERE
    orderstatus IN ('ordered', 'new')
    AND datecancellationprinted IS NOT NULL

You will see orders with orderstatus set to 'new', and datecancellationprinted with today's date.

3/ Close the basket

Run the query again, orderstatus for the new orders will now be 'ordered'.
Comment 1 Katrin Fischer 2016-08-23 20:59:11 UTC
Hm, it looks like a bug to me as we have a specific cancelled status.
Comment 2 Katrin Fischer 2016-10-16 13:48:26 UTC
I just retested this on current master and it worked alright:

- create basket
- create order line (status: new)
- cancel order line (status: cancelled)

Which version did you report this against?
Comment 3 Katrin Fischer 2016-10-16 14:21:37 UTC
(In reply to Katrin Fischer from comment #2)
> I just retested this on current master and it worked alright:
> 
> - create basket
> - create order line (status: new)
> - cancel order line (status: cancelled)
> 
> Which version did you report this against?

Huh. You are right, it's all good until you close the basket. Then the cancelled order is turned into 'ordered'
Comment 4 Fiona Borthwick 2017-02-09 12:35:43 UTC
One of our customers has also reported this but added the following detail...

If you reopen the basket then the ordered status changes to New... this is despite the order having been cancelled.
Comment 5 Katrin Fischer 2017-09-20 21:19:25 UTC
Hi Fiona, I think the last bit is covered by the new patch on bug 19120.

*** This bug has been marked as a duplicate of bug 19120 ***