Bug 26190 - Cannot close baskets when all lines have been cancelled
Summary: Cannot close baskets when all lines have been cancelled
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Katrin Fischer
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-11 09:19 UTC by Ray Delahunty
Modified: 2020-11-17 13:21 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Text to go in the release notes:
Version(s) released in:
20.11.00, 20.05.06, 19.11.12


Attachments
Bug 26190: Allow to close a basket with only cancelled order lines (1.74 KB, patch)
2020-10-18 14:53 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 26190: Allow to close a basket with only cancelled order lines (1.88 KB, patch)
2020-10-19 13:32 UTC, Séverine Queune
Details | Diff | Splinter Review
Bug 26190: Allow to close a basket with only cancelled order lines (1.95 KB, patch)
2020-10-21 15:24 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Ray Delahunty 2020-08-11 09:19:35 UTC
Current functionality:
Using Koha 18.11 we are unable to close baskets once all order lines in the basket have been cancelled. We are having to leave baskets open, as if they’re still being worked on.
Desired functionality:
Allow baskets with all lines cancelled to be closed, and kept for reporting purposes.

In the past, if the basket only contained one item ordered and cancelled, we have occasionally deleted the basket at fiscal year end (losing the acquisitions trail), but one of our main vendors has recently gone out of business and we have had to cancel a lot of orders, with all order lines in many baskets cancelled.  This will mean we will have to delete the baskets too, maybe at next fiscal year close. Our policy has been to keep all acquisitions trails for a maximum of six years, in keeping with business finance guidance, and we want to keep cancellation information for the same number of years too if possible. (OK, there are no actual financial implications since the orders are cancelled but retention would be useful, allowing librarians to see what they had wanted but couldn’t get, in their book order reports).
Comment 1 Katrin Fischer 2020-10-18 14:53:34 UTC
Created attachment 111946 [details] [review]
Bug 26190: Allow to close a basket with only cancelled order lines

At the moment there are several cases, when closing a basket is not
possible:
- when there are no order lines in it
- when there are order lines with uncertain prices
- when the basket is marked as a standing order

The first case wasn't checked correctly as only pending/received
orders would be counted, but not cancelled orders.

To test:
- Create a basket
- Create an order line
- Verify the "close this basket" button shows
- Cancel the order line - the button disappears
- Apply the patch
- Verify the button appears and works now
- Create another basket - make sure you cannot close it
  without order lines
- Create an order line with uncertain price checked
  - you cannot close it
- Resolve the uncertain price - you can now close the basket.
Comment 2 Séverine Queune 2020-10-19 13:32:55 UTC
Created attachment 111990 [details] [review]
Bug 26190: Allow to close a basket with only cancelled order lines

At the moment there are several cases, when closing a basket is not
possible:
- when there are no order lines in it
- when there are order lines with uncertain prices
- when the basket is marked as a standing order

The first case wasn't checked correctly as only pending/received
orders would be counted, but not cancelled orders.

To test:
- Create a basket
- Create an order line
- Verify the "close this basket" button shows
- Cancel the order line - the button disappears
- Apply the patch
- Verify the button appears and works now
- Create another basket - make sure you cannot close it
  without order lines
- Create an order line with uncertain price checked
  - you cannot close it
- Resolve the uncertain price - you can now close the basket.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 3 Katrin Fischer 2020-10-19 13:33:50 UTC
Thx, Severine!
Comment 4 Martin Renvoize 2020-10-21 15:24:54 UTC
Created attachment 112107 [details] [review]
Bug 26190: Allow to close a basket with only cancelled order lines

At the moment there are several cases, when closing a basket is not
possible:
- when there are no order lines in it
- when there are order lines with uncertain prices
- when the basket is marked as a standing order

The first case wasn't checked correctly as only pending/received
orders would be counted, but not cancelled orders.

To test:
- Create a basket
- Create an order line
- Verify the "close this basket" button shows
- Cancel the order line - the button disappears
- Apply the patch
- Verify the button appears and works now
- Create another basket - make sure you cannot close it
  without order lines
- Create an order line with uncertain price checked
  - you cannot close it
- Resolve the uncertain price - you can now close the basket.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 5 Martin Renvoize 2020-10-21 15:25:29 UTC
Another nice little improvement here, works well.. Thanks for picking it up Katrin

Passing QA
Comment 6 Jonathan Druart 2020-11-04 09:22:31 UTC
Parenthesis would have helped the readability, but it works as it.
Comment 7 Jonathan Druart 2020-11-04 12:03:38 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 8 Lucas Gass 2020-11-16 21:19:23 UTC
backported to 20.05.x for 20.05.06
Comment 9 Aleisha Amohia 2020-11-17 05:30:40 UTC
backported to 19.11.x for 19.11.12
Comment 10 Victor Grousset/tuxayo 2020-11-17 13:21:50 UTC
Not backported to oldoldstable (19.05.x). Feel free to ask if it's needed.