Bugzilla – Attachment 130954 Details for
Bug 30133
Pagination broken on pickup_locations routes when AllowHoldPolicyOverride=1
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30133: Avoid calling c->objects->search twice
Bug-30133-Avoid-calling-c-objects-search-twice.patch (text/plain), 1.93 KB, created by
Jonathan Druart
on 2022-02-21 11:51:47 UTC
(
hide
)
Description:
Bug 30133: Avoid calling c->objects->search twice
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-02-21 11:51:47 UTC
Size:
1.93 KB
patch
obsolete
>From 99e9022c0b0dad943cd804c7223e76cea28180b2 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 18 Feb 2022 14:25:41 +0000 >Subject: [PATCH] Bug 30133: Avoid calling c->objects->search twice > >Calling this twice sets double pagination headers, which messes up the page for the requests and >retrieves on ly the end of the list > >This patch simply avoids a doulbe call > >TO DO: must implement same for Biblio->pickup_locations and cover with tests >this also returns all as needing override > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> > >Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > Koha/REST/V1/Items.pm | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > >diff --git a/Koha/REST/V1/Items.pm b/Koha/REST/V1/Items.pm >index 1887bce5145..df0103700c1 100644 >--- a/Koha/REST/V1/Items.pm >+++ b/Koha/REST/V1/Items.pm >@@ -115,9 +115,7 @@ sub pickup_locations { > > my $ps_set = $item->pickup_locations( { patron => $patron } ); > >- my $pickup_locations = $c->objects->search( $ps_set ); > my @response = (); >- > if ( C4::Context->preference('AllowHoldPolicyOverride') ) { > > my $libraries_rs = Koha::Libraries->search( { pickup_location => 1 } ); >@@ -127,7 +125,7 @@ sub pickup_locations { > my $library = $_; > $library->{needs_override} = ( > any { $_->{library_id} eq $library->{library_id} } >- @{$pickup_locations} >+ @{$ps_set->as_list} > ) > ? Mojo::JSON->false > : Mojo::JSON->true; >@@ -140,6 +138,8 @@ sub pickup_locations { > ); > } > >+ my $pickup_locations = $c->objects->search( $ps_set ); >+ > @response = map { $_->{needs_override} = Mojo::JSON->false; $_; } @{$pickup_locations}; > > return $c->render( >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 30133
:
130853
|
130854
|
130855
|
130883
|
130884
|
130885
|
130886
|
130887
|
130888
|
130889
|
130890
|
130891
|
130892
|
130893
|
130953
| 130954 |
130955
|
130956
|
130957