Bug 15036

Summary: Closing and reopening a basket should not alter status of completed orders
Product: Koha Reporter: Colin Campbell <colin.campbell>
Component: AcquisitionsAssignee: Colin Campbell <colin.campbell>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: f.demians, katrin.fischer, koha, liz, marjorie.barry-vila, nengard, tomascohen
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:
Bug Depends on:    
Bug Blocks: 19024    
Attachments: Proposed patch
[PASSED QA] Bug 15036: Do not overwrite complete status in basket ops

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
eek!
Comment 2 Colin Campbell 2015-10-21 10:26:32 UTC Comment hidden (obsolete)
Comment 3 Koha Team University 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 University 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.