Bug 37021

Summary: REST API: Holds endpoint handles item_id as string in GET call
Product: Koha Reporter: Emmi Takkinen <emmi.takkinen>
Component: REST APIAssignee: Emmi Takkinen <emmi.takkinen>
Status: Pushed to oldstable --- QA Contact: Matt Blenkinsop <matt.blenkinsop>
Severity: normal    
Priority: P5 - low CC: david, fridolin.somers, lucas, tomascohen, wainuiwitikapark
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
This fixes the REST API holds endpoint so that the item_id is handled as an integer, not a string.
Version(s) released in:
24.11.00,24.05.02,23.11.07
Circulation function:
Attachments: Bug 37021: Change item_id type as integer in holds endpoint
Bug 37021: Change item_id type as integer in holds endpoint
Bug 37021: Change item_id type as integer in holds endpoint

Description Emmi Takkinen 2024-06-04 09:36:28 UTC
When one makes a GET call to holds endpoint and hold has item attached to it, item_id is handled as string not integer as it should.

To reproduce:
1. Make sure you have hold waiting in your database.
1. Call endpoint api/v1/holds/?q=[{"me.status":"W"}].
2. Note that holds item_id is displayed as item_id: "12345".
Comment 1 Emmi Takkinen 2024-06-04 10:10:24 UTC
Created attachment 167370 [details] [review]
Bug 37021: Change item_id type as integer in holds endpoint

When one makes a GET call to holds endpoint and hold has
item attached to it, item_id is handled as string not integer
as it should.

To reproduce:
1. Make sure you have hold waiting in your database.
2. Call endpoint api/v1/holds/?q=[{"me.status":"W"}].
=> Note that holds item_id is displayed as item_id: "12345".
3. Apply this patch.
4. Call endpoint again.
=> item_id should now be displayed as 12345.

Also prove t/db_dependent/api/v1/holds.t.
Comment 2 Jan Kissig 2024-06-05 09:00:20 UTC
Created attachment 167430 [details] [review]
Bug 37021: Change item_id type as integer in holds endpoint

When one makes a GET call to holds endpoint and hold has
item attached to it, item_id is handled as string not integer
as it should.

To reproduce:
1. Make sure you have hold waiting in your database.
2. Call endpoint api/v1/holds/?q=[{"me.status":"W"}].
=> Note that holds item_id is displayed as item_id: "12345".
3. Apply this patch.
4. Call endpoint again.
=> item_id should now be displayed as 12345.

Also prove t/db_dependent/api/v1/holds.t.

Signed-off-by: Jan Kissig <jkissig@th-wildau.de>
Comment 3 Matt Blenkinsop 2024-06-05 15:19:37 UTC
Created attachment 167453 [details] [review]
Bug 37021: Change item_id type as integer in holds endpoint

When one makes a GET call to holds endpoint and hold has
item attached to it, item_id is handled as string not integer
as it should.

To reproduce:
1. Make sure you have hold waiting in your database.
2. Call endpoint api/v1/holds/?q=[{"me.status":"W"}].
=> Note that holds item_id is displayed as item_id: "12345".
3. Apply this patch.
4. Call endpoint again.
=> item_id should now be displayed as 12345.

Also prove t/db_dependent/api/v1/holds.t.

Signed-off-by: Jan Kissig <jkissig@th-wildau.de>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 4 Martin Renvoize (ashimema) 2024-06-11 10:56:25 UTC
Thanks for all the hard work!

Pushed to main for the next 24.11.00 release as RM Assistant
Comment 5 Lucas Gass (lukeg) 2024-07-10 16:55:35 UTC
Backported to 24.05.x for upcoming 24.05.02
Comment 6 Fridolin Somers 2024-07-17 14:04:43 UTC
Pushed to 23.11.x for 23.11.07
Comment 7 Fridolin Somers 2024-07-17 14:07:31 UTC
Looks like same issue with api/v1/swagger/definitions/club_hold.yaml :

https://git.koha-community.org/Koha-community/Koha/src/commit/33175fddec69ad38d8cb8a9dc590f2f7998149b0/api/v1/swagger/definitions/club_hold.yaml#L13
Comment 8 Wainui Witika-Park 2024-07-19 03:38:43 UTC
not backporting to 23.05.x unless requested