Bug 27931

Summary: Add GET /items/:item_id/pickup_locations
Product: Koha Reporter: Tomás Cohen Arazi <tomascohen>
Component: REST APIAssignee: Tomás Cohen Arazi <tomascohen>
Status: CLOSED FIXED QA Contact: Martin Renvoize <martin.renvoize>
Severity: enhancement    
Priority: P5 - low CC: fridolin.somers, jonathan.druart, kyle, martin.renvoize, tomascohen
Version: Main   
Hardware: All   
OS: All   
URL: https://wiki.koha-community.org/wiki/Items_pickup_locations_endpoint_RFC
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28284
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28312
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This development adds routes for fetching an item's valid pickup location list.
Version(s) released in:
21.11.00,21.05.01
Bug Depends on: 27894    
Bug Blocks: 28338, 28842    
Attachments: Bug 27931: Unit tests
Bug 27931: Add GET /items/:item_id/pickup_locations
Bug 27931: Unit tests
Bug 27931: Add GET /items/:item_id/pickup_locations

Description Tomás Cohen Arazi 2021-03-11 14:30:00 UTC
It should be implemented as GET /holds/:hold_id/pickup_locations on bug 27894.
It is needed to render the dropdown on placing item-level holds
Comment 1 Tomás Cohen Arazi 2021-03-11 19:32:55 UTC
Created attachment 118170 [details] [review]
Bug 27931: Unit tests
Comment 2 Tomás Cohen Arazi 2021-03-11 19:33:00 UTC
Created attachment 118171 [details] [review]
Bug 27931: Add GET /items/:item_id/pickup_locations

This patch adds the mentioned route. It does so by:
- Adding the new path in paths.json
- Adding the full route spec in items.json
- Adds a controller method that takes care of the task

To test:
1. Apply this patches
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/items.t
=> SUCCESS: Tests pass!
3. Play with your favourite REST tool. Pay special care to
   the AllowHoldPolicyOverride syspref and the expected behaviors.
=> SUCCESS: All works as expected
4. Sign off :-D
Comment 3 Martin Renvoize 2021-04-16 12:10:06 UTC
Created attachment 119719 [details] [review]
Bug 27931: Unit tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 4 Martin Renvoize 2021-04-16 12:10:09 UTC
Created attachment 119720 [details] [review]
Bug 27931: Add GET /items/:item_id/pickup_locations

This patch adds the mentioned route. It does so by:
- Adding the new path in paths.json
- Adding the full route spec in items.json
- Adds a controller method that takes care of the task

To test:
1. Apply this patches
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/items.t
=> SUCCESS: Tests pass!
3. Play with your favourite REST tool. Pay special care to
   the AllowHoldPolicyOverride syspref and the expected behaviors.
=> SUCCESS: All works as expected
4. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 5 Martin Renvoize 2021-04-16 12:10:51 UTC
As with bug 27932; This all works well, the code reads nicely and it's well tested.

QA Scripts are happy too.. I think we can go straight for PQA
Comment 6 Jonathan Druart 2021-04-27 13:46:49 UTC
This isn't actually needed for bug 27864. Am I missing something?
Comment 7 Tomás Cohen Arazi 2021-04-28 10:42:01 UTC
(In reply to Jonathan Druart from comment #6)
> This isn't actually needed for bug 27864. Am I missing something?

Agreed. This was intended to be used for item-level holds and some ideas I had for revamping the UI structure. And I couldn't keep up with that, as my focus shifted to this tree:

https://bugs.koha-community.org/bugzilla3/showdependencygraph.cgi?id=27865

TL;DR, this route makes sense and will certainly be used in a short term.
Comment 8 Jonathan Druart 2021-06-14 15:34:08 UTC
Pushed to master for 21.11, thanks to everybody involved!
Comment 9 Kyle M Hall 2021-06-18 12:50:06 UTC
Additional REST API with no breaking changes

Pushed to 20.05.x for 20.05.01
Comment 10 Tomás Cohen Arazi 2021-06-18 12:53:33 UTC
(In reply to Kyle M Hall from comment #9)
> Additional REST API with no breaking changes
> 
> Pushed to 20.05.x for 20.05.01

\o/
Comment 11 Fridolin Somers 2021-06-21 12:48:20 UTC
Enhancement not pushed to 20.11.x, and depends on Bug 27894 not in 20.11.x