From 482785006a6a719f3ed4541a8102b46ac563db31 Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Thu, 26 Sep 2024 12:39:58 +0000 Subject: [PATCH] Bug 34068: Fix pagination for hold pickup locations This patch addresses an issue where pagination filters are set incorrectly for the pickup locations endpoint. Only the final page is returned rather than the expected full list of results Test plan: 1) In KTD, set the syspref RESTdefaultPageSize to 5 2) Set AllowHoldPolicyOverride to Allow 3) Create a hold on an item for a patron 4) Navigate to the patron's page and click on the holds tab 5) Click the dropdown in pickup locations 6) There will be two results, repeated three times 7) Apply patch and restart_all 8) Repeat step 5, there should now be a full list of 12 libraries Co-authored-by: Pedro Amorim Signed-off-by: Laura_Escamilla Signed-off-by: David Nind --- Koha/REST/V1/Holds.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Koha/REST/V1/Holds.pm b/Koha/REST/V1/Holds.pm index 13f24b86f8..c703aba0b5 100644 --- a/Koha/REST/V1/Holds.pm +++ b/Koha/REST/V1/Holds.pm @@ -462,11 +462,12 @@ sub pickup_locations { $ps_set = $hold->biblio->pickup_locations( { patron => $hold->patron } ); } - my $pickup_locations = $c->objects->search( $ps_set ); + my $pickup_locations; my @response = (); if ( C4::Context->preference('AllowHoldPolicyOverride') ) { + $pickup_locations = $ps_set->as_list; my $libraries_rs = Koha::Libraries->search( { pickup_location => 1 } ); my $libraries = $c->objects->search($libraries_rs); @@ -487,6 +488,7 @@ sub pickup_locations { ); } + $pickup_locations = $c->objects->search( $ps_set ); @response = map { $_->{needs_override} = Mojo::JSON->false; $_; } @{$pickup_locations}; return $c->render( -- 2.39.5