From cb32a7981bfc49024062492fd8980d004d237916 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 --- 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 bdbe6952ebc..3d28612d326 100644 --- a/Koha/REST/V1/Holds.pm +++ b/Koha/REST/V1/Holds.pm @@ -455,11 +455,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); @@ -480,6 +481,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.3 (Apple Git-146)