Bug 15036 - Closing and reopening a basket should not alter status of completed orders
Summary: Closing and reopening a basket should not alter status of completed orders
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Colin Campbell
QA Contact: Testopia
: 13467 (view as bug list)
Depends on:
Blocks: 19024
  Show dependency treegraph
Reported: 2015-10-20 11:59 UTC by Colin Campbell
Modified: 2017-08-09 19:10 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:

Proposed patch (2.67 KB, patch)
2015-10-21 10:26 UTC, Colin Campbell
Details | Diff | Splinter Review
[PASSED QA] Bug 15036: Do not overwrite complete status in basket ops (2.75 KB, patch)
2015-11-06 12:45 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Colin Campbell 2015-10-20 11:59:18 UTC
When a basket is closed all orders are set to status 'ordered', if reopened they are all set to 'new', however if some orderlines are receipted and the basket subsequently reopened and again closed (e.g. to cancel some orders) although the order has copies received set, a datereceived and a link to an invoice it status reverts to new 9after reopen) or on order (after close) which does not reflect its true state. These operations should not include completed lines in their status updates
Comment 1 Katrin Fischer 2015-10-20 21:25:53 UTC
Comment 2 Colin Campbell 2015-10-21 10:26:32 UTC Comment hidden (obsolete)
Comment 3 Koha Team Lyon 3 2015-11-04 15:07:08 UTC
Without the patch : 
I have added a new baskest with 2 orders, closed this basket, received one of the order. Orders status for this basket are "complete" and "ordered". I have re-opened the basket : ordered status are both "new".

With the patch : 
I redone exactly the same stages, but afer reopening the basket, ordered status are  "complete" and "ordered".
Comment 4 Katrin Fischer 2015-11-04 15:14:37 UTC
Koha Team Lyon3 - is this a 'sign off'? :)
Comment 5 Koha Team Lyon 3 2015-11-04 15:20:35 UTC
Yes, this is signed off but I tried to sign it with a sandbox 15 mn ago and nothing happens so far...
Comment 6 Katrin Fischer 2015-11-04 15:31:19 UTC
I will switch the status - we can add the line in QA if it doesn't appear.
Comment 7 Kyle M Hall 2015-11-06 12:45:44 UTC
Created attachment 44551 [details] [review]
[PASSED QA] Bug 15036: Do not overwrite complete status in basket ops

Reopening or closing a basket should preserve the completed
status for receipted orders.

This patch excludes orderlines with the completed status
from having their status rewritten as a result of the
change in basket status

Made the subroutines involved more efficient by removing an
unnecessary loop and by not fetching a large amount of
superfluous data

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 8 Tomás Cohen Arazi 2015-11-09 18:59:03 UTC
Patch pushed to master.

Thanks Colin!
Comment 9 Katrin Fischer 2015-11-22 22:00:23 UTC
*** Bug 13467 has been marked as a duplicate of this bug. ***
Comment 10 Frédéric Demians 2015-11-29 20:44:54 UTC
This patch has been pushed to 3.20.x, will be in 3.20.6.
Comment 11 Liz Rea 2016-01-06 21:07:51 UTC
Pushed to 3.18.13, and released.
Comment 12 Katrin Fischer 2016-02-03 15:19:11 UTC
A note for later: Should we also include a database update to recalculate the status affected correctly? The initial SQL when the feature was introduced could give some ideas.