Bug 24598

Summary: Hold not reset properly if checked out to another patron
Product: Koha Reporter: Christopher Brannon <cbrannon>
Component: Hold requestsAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: major    
Priority: P5 - low CC: amitddng135, daniel.gaghan, fridolin.somers, gmcharlt, jonathan.druart, katrin.fischer, lucas, m.de.rooy, sally.healey
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.11.00
Attachments: Bug 24598: Add tests
Bug 24598: Complete transfer for hold if checked out
Bug 24598: Add tests
Bug 24598: Complete transfer for hold if checked out
Bug 24598: Add tests
Bug 24598: Complete transfer for hold if checked out
Bug 24598: Remove warning from test

Description Christopher Brannon 2020-02-05 20:01:30 UTC
When an item that has triggered a hold is in transit to a library, if the item is accidently shelved instead of scanned at the pickup library, and then checked out to another patron, the holds shows the item still in transit in the status, but says that it is waiting at the library, and the since date has vanished!

To replicate:
1) Place an item on hold at Library A for Patron 1 at Library B.
2) Check in the item at Library A to trigger the hold transfer.
3) At Library B, check out the item to Patron 2 (click Yes).

* Note that the hold still show in transit in the status.
* Note that the Pickup library shows the item is waiting.
* Note that the since date in the Pickup library is blank.

What needs to happen:
If an item is intercepted and checked out to a patron while in transit:
* The transfer needs to be cancelled.
* The hold needs to revert back to the top of the queue.
Comment 1 Katrin Fischer 2020-03-15 16:42:14 UTC
This reads a bit similar to bug 11722, could these be duplicates?
Comment 2 Christopher Brannon 2020-03-17 04:16:10 UTC
(In reply to Katrin Fischer from comment #1)
> This reads a bit similar to bug 11722, could these be duplicates?

Not sure.  That was 6 years ago.  This gives a better explanation, if it is.
Comment 3 Jonathan Druart 2020-08-10 13:54:38 UTC
Created attachment 108002 [details] [review]
Bug 24598: Add tests
Comment 4 Jonathan Druart 2020-08-10 13:54:41 UTC
Created attachment 108003 [details] [review]
Bug 24598: Complete transfer for hold if checked out

When an item that has triggered a hold is in transit to a library,
if the item is accidently shelved instead of scanned at the pickup library,
and then checked out to another patron, the holds shows the item still in transit
in the status, but says that it is waiting at the library, and the since date has vanished!

Test plan:
1) Place an item on hold at Library A for Patron 1 at Library B
2) Check in the item at Library A to trigger the hold transfer
3) At Library B, check out the item to Patron 2 (click Yes)
=> The hold is not marked as in transit and is back to priority 1
Comment 5 Fridolin Somers 2020-09-29 08:17:17 UTC
Created attachment 110889 [details] [review]
Bug 24598: Add tests

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Comment 6 Fridolin Somers 2020-09-29 08:17:34 UTC
Created attachment 110890 [details] [review]
Bug 24598: Complete transfer for hold if checked out

When an item that has triggered a hold is in transit to a library,
if the item is accidently shelved instead of scanned at the pickup library,
and then checked out to another patron, the holds shows the item still in transit
in the status, but says that it is waiting at the library, and the since date has vanished!

Test plan:
1) Place an item at Library A on hold for Patron 1 of Library B with pickup library at Library B
2) Check in the item at Library A to trigger the hold transfer
3) At Library B, check out the item to Patron 2 (click Yes)
=> The hold is not marked as in transit and is back to priority 1

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Comment 7 Fridolin Somers 2020-09-29 08:19:51 UTC
Nice work.
Test plan and unit test are OK.

I add to rebase a bit unit test patch.

Also changed a bit the test plan :
- 1) Place an item on hold at Library A for Patron 1 at Library B
+ 1) Place an item at Library A on hold for Patron 1 of Library B with pickup library at Library B

Because I forgot twice to change pickup library ;)
Comment 8 Marcel de Rooy 2020-10-02 06:35:30 UTC
QAing
Comment 9 Marcel de Rooy 2020-10-02 07:25:22 UTC
Created attachment 111060 [details] [review]
Bug 24598: Add tests

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] 49 to 50 tests.
Comment 10 Marcel de Rooy 2020-10-02 07:25:28 UTC
Created attachment 111061 [details] [review]
Bug 24598: Complete transfer for hold if checked out

When an item that has triggered a hold is in transit to a library,
if the item is accidently shelved instead of scanned at the pickup library,
and then checked out to another patron, the holds shows the item still in transit
in the status, but says that it is waiting at the library, and the since date has vanished!

Test plan:
1) Place an item at Library A on hold for Patron 1 of Library B with pickup library at Library B
2) Check in the item at Library A to trigger the hold transfer
3) At Library B, check out the item to Patron 2 (click Yes)
=> The hold is not marked as in transit and is back to priority 1

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 11 Jonathan Druart 2020-10-08 09:37:42 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 12 Jonathan Druart 2020-10-08 10:04:19 UTC
Created attachment 111371 [details] [review]
Bug 24598: Remove warning from test

t/db_dependent/Koha/Items.t .. 6/12 Use of uninitialized value in string eq at /kohadevbox/koha/C4/Circulation.pm line 1460.
Comment 13 Jonathan Druart 2020-10-08 14:20:07 UTC
(In reply to Jonathan Druart from comment #12)
> Created attachment 111371 [details] [review] [review]
> Bug 24598: Remove warning from test
> 
> t/db_dependent/Koha/Items.t .. 6/12 Use of uninitialized value in string eq
> at /kohadevbox/koha/C4/Circulation.pm line 1460.

Patch pushed to master.
Comment 14 Lucas Gass 2020-10-20 19:44:19 UTC
does not apply cleanly to 20.05.x, no backport 

please rebase if needed