We have an endpoint to fetch a patron's current holds ( /api/va/patrons/$id/holds ) but some external services need to get previous holds to see if they were completed/canceled/etc.
Created attachment 159055 [details] [review] Bug 35353: Add api endpoint to fetch patron's previous holds We have an endpoint to fetch a patron's current holds ( /api/va/patrons/$id/holds ) but some external services need to get previous holds to see if they were completed/canceled/etc. Test Plan: 1) Create some holds for a patron 2) Complete or cancel those holds 3) Browse to /api/va/patrons/$id/holds/previous where $id is the borrowernumber 4) You should get a list of previous holds!
Created attachment 159067 [details] [review] Bug 35353: Add api endpoint to fetch patron's previous holds We have an endpoint to fetch a patron's current holds ( /api/va/patrons/$id/holds ) but some external services need to get previous holds to see if they were completed/canceled/etc. Test Plan: 1) Create some holds for a patron 2) Complete or cancel those holds 3) Browse to /api/va/patrons/$id/holds/previous where $id is the borrowernumber 4) You should get a list of previous holds! Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
> 3) Browse to /api/va/patrons/$id/holds/previous where $id is the > borrowernumber Note this should be "/api/v1/patrons..."
On the original implementation for bug 20936, we implemented this on the API... it is sad how it become a rabbit hole and we dropped that dev entirely! (we were requested to 'first solve how Koha handles timezones in dates on the API'!). Anyway, in that context I remembered the discussion... As opposed to what happens with biblios, items and patrons, which when deleted are really just put in a vault until a maintenance tool decides to clear them for good, checkouts, holds, etc are transactions which change their statuses, and that status can just be 'finished' or 'completed'. As 'reserves' and 'old_reserves' are not yet merged (maybe this cycle?) we don't have a clean way to implement it. But on bug 20936 we overcome this by adding an 'old=1' query parameter on the current */holds endpoint. The advantage is that, if the tables are merged, we can just translate old=1 into $rs->filter_by_complete or similar, keeping the behavior. TL;DR 1. The ideal would be to implement this on top of bug 25260, with 'completed' being just another (set of?) status value which we can filter on. Adding a special query parameter to make it return completed holds seems fairly straight-forward. 2. Implementing this in the spirit of bug 20936 (see [1]) could work without needing bug 25260, and keeping forward compatibility, behavior and query parameters wise. I feel that's the way to go. My 2 cents. [1] https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=100473
I have started this as well (on bug 35560), and just copied what we are doing for checkouts: we are passing a checked_in flag to /checkouts Why not doing the same for holds?
I agree with the two above comments.. lets use &old=1 as per checkouts and it leaves the door open to the table merging bug. I'm going to go ahead and mark this one as a duplicate. *** This bug has been marked as a duplicate of bug 35560 ***
Created attachment 163828 [details] [review] Bug 35353: DBIC specific
Created attachment 163829 [details] [review] Bug 35353: Add REST API endpoint to retrieve old holds Same as checkout but for holds, we need to provide a way to retrieve old holds for a patron. Test plan: Create some holds for a patron, cancel and fulfill some, then use the REST API endpoint with the new 'old' flag set to 1 /api/v1/patrons/42/holds?old=1
Created attachment 163833 [details] [review] Bug 35353: DBIC specific Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Created attachment 163834 [details] [review] Bug 35353: Add REST API endpoint to retrieve old holds Same as checkout but for holds, we need to provide a way to retrieve old holds for a patron. Test plan: Create some holds for a patron, cancel and fulfill some, then use the REST API endpoint with the new 'old' flag set to 1 /api/v1/patrons/42/holds?old=1 Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Created attachment 164298 [details] [review] Bug 35353: DBIC specific Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 164299 [details] [review] Bug 35353: Add REST API endpoint to retrieve old holds Same as checkout but for holds, we need to provide a way to retrieve old holds for a patron. Test plan: Create some holds for a patron, cancel and fulfill some, then use the REST API endpoint with the new 'old' flag set to 1 /api/v1/patrons/42/holds?old=1 Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Pushed for 24.05! Well done everyone, thank you!
Can be very useful for portals, I backport. Pushed to 23.11.x for 23.11.06
Enhancement will not be backported to 23.05.x
*** Bug 35247 has been marked as a duplicate of this bug. ***