Bug 37413

Summary: Updating an item level hold on an item with no barcode to a next available hold also modifies the other holds on the record
Product: Koha Reporter: Laura Escamilla <Laura.escamilla>
Component: CirculationAssignee: Pedro Amorim <pedro.amorim>
Status: Pushed to oldstable --- QA Contact: Kyle M Hall (khall) <kyle>
Severity: normal    
Priority: P3 CC: acampbell, david, fridolin.somers, gmcharlt, kyle.m.hall, kyle, lari.taskula, lucas, pedro.amorim, phil, samalau, wainuiwitikapark
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This fixes updating existing item level holds for an item without a barcode. When updating an existing item level hold from "Only item No barcode" (Holds for a record > Existing holds > Details column) to "Next available", it would incorrectly change any other item level holds to "Next available".
Version(s) released in:
24.11.00,24.05.04,23.11.10
Circulation function:
Bug Depends on: 35483    
Bug Blocks:    
Attachments: Bug 37413: Prevent altering multiple item-level holds when setting one with no barcode to next available
Bug 37413: Prevent altering multiple item-level holds when setting one with no barcode to next available
Bug 37413: [Alternative] Ensure itemnumber is sent
Bug 37413: [Alternative] Ensure itemnumber is sent
Bug 37413: [Alternative] Ensure itemnumber is sent

Description Laura Escamilla 2024-07-19 20:08:48 UTC
To recreate:
* Place an item level hold on the item with no barcode
* Place an item level hold on any other item
* From the Holds tab, change the dropdown of the first one from "no barcode" to "next available"
* Update holds
* Both item level holds are now next available holds.
Comment 1 Sam Lau 2024-07-30 18:03:25 UTC
Created attachment 169872 [details] [review]
Bug 37413: Prevent altering multiple item-level holds when setting one with no barcode to next available

To test:
1) Place an item level hold on the item with no barcode
2) Place an item level hold on any other item
3) From the Holds tab, change the dropdown of the first one from "no barcode" to "next available"
4) Update holds
5) Both item level holds are now next available holds.
6) Cancel these holds and repeats steps 1-4 again
7) This time, only the hold we switched to "next available" is changed
Comment 2 David Nind 2024-07-30 20:22:13 UTC
Created attachment 169877 [details] [review]
Bug 37413: Prevent altering multiple item-level holds when setting one with no barcode to next available

To test:
1) Place an item level hold on the item with no barcode
2) Place an item level hold on any other item
3) From the Holds tab, change the dropdown of the first one from "no barcode" to "next available"
4) Update holds
5) Both item level holds are now next available holds.
6) Cancel these holds and repeats steps 1-4 again
7) This time, only the hold we switched to "next available" is changed

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 Pedro Amorim 2024-08-01 12:03:00 UTC
Created attachment 169942 [details] [review]
Bug 37413: [Alternative] Ensure itemnumber is sent

Fix condition to ensure the itemnumber is sent
Comment 4 Pedro Amorim 2024-08-01 12:07:14 UTC
Hi guys.
To me it seems the problem is caused by the fact that the itemnumber is not sent to the server if the item of the hold does not contain a barcode.
The provided patch is working around the problem, not fixing it. 

I don't know if this behavior is intended (not send an itemnumber if barcode missing) or copy paste oversight, but this is how it was submitted originally by Lari Taskula:
https://github.com/Koha-Community/Koha/commit/c20f456

I've added Lari to this bug to provide a chance to intervene if required.

Sorry if I'm completely off base here. Happy to discuss further.
Comment 5 Lari Taskula 2024-08-01 12:39:46 UTC
(In reply to Pedro Amorim from comment #4)
> I don't know if this behavior is intended

I can't recall nor think of a reason for making it intended. As you said it was probably a copypaste oversight. Without testing (out of office at the moment), your new patch does make sense. Thanks!
Comment 6 Sam Lau 2024-08-01 12:54:52 UTC
Created attachment 169947 [details] [review]
Bug 37413: [Alternative] Ensure itemnumber is sent

Fix condition to ensure the itemnumber is sent

Signed-off-by: Sam Lau <samalau@gmail.com>
Comment 7 Kyle M Hall (khall) 2024-08-23 14:50:40 UTC
Created attachment 170637 [details] [review]
Bug 37413: [Alternative] Ensure itemnumber is sent

Fix condition to ensure the itemnumber is sent

Signed-off-by: Sam Lau <samalau@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 8 Katrin Fischer 2024-08-23 16:22:31 UTC
Pushed for 24.11!

Well done everyone, thank you!
Comment 9 Lucas Gass (lukeg) 2024-09-12 22:36:03 UTC
Backported to 24.05.x for upcoming 24.05.04
Comment 10 Fridolin Somers 2024-10-21 12:41:04 UTC
Pushed to 23.11.x for 23.11.10
Comment 11 Wainui Witika-Park 2024-11-04 00:01:39 UTC
Not backporting to 23.05.x unless requested