Bug 27931 - Add GET /items/:item_id/pickup_locations
Summary: Add GET /items/:item_id/pickup_locations
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: REST API (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Tomás Cohen Arazi
QA Contact: Martin Renvoize
URL: https://wiki.koha-community.org/wiki/...
Keywords:
Depends on: 27894
Blocks: 28338 28842
  Show dependency treegraph
 
Reported: 2021-03-11 14:30 UTC by Tomás Cohen Arazi
Modified: 2022-12-12 21:23 UTC (History)
5 users (show)

See Also:
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


Attachments
Bug 27931: Unit tests (4.99 KB, patch)
2021-03-11 19:32 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 27931: Add GET /items/:item_id/pickup_locations (6.35 KB, patch)
2021-03-11 19:33 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 27931: Unit tests (5.05 KB, patch)
2021-04-16 12:10 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 27931: Add GET /items/:item_id/pickup_locations (6.41 KB, patch)
2021-04-16 12:10 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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