Bugzilla – Attachment 130892 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: Simplify code
Bug-30133-Simplify-code.patch (text/plain), 2.35 KB, created by
Andrew Fuerste-Henry
on 2022-02-18 19:20:58 UTC
(
hide
)
Description:
Bug 30133: Simplify code
Filename:
MIME Type:
Creator:
Andrew Fuerste-Henry
Created:
2022-02-18 19:20:58 UTC
Size:
2.35 KB
patch
obsolete
>From ff8aaa3edb62d27a3becb1eb5704c317c617c986 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 18 Feb 2022 15:22:36 -0300 >Subject: [PATCH] Bug 30133: Simplify code > >This patch simplifies the code, and also fixes a problem with branchcode >comparisson failing, highlighted when running the tests > >To test: >1. Apply the regression tests >2. Run: > $ kshell > k$ prove t/db_dependent/api/v1/items.t >=> FAIL: Tests fail. Notably: >- Link header pagination is wrong >- X-*Total-Count headers have two values (dupicated) >3. Apply this patch >4. Repeat 2 >=> SUCCESS: Tests pass! >5. Sign off :-D > >Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> > >https://bugs.koha-community.org/show_bug.cgi?id=30113 >--- > Koha/REST/V1/Items.pm | 18 +++++++----------- > 1 file changed, 7 insertions(+), 11 deletions(-) > >diff --git a/Koha/REST/V1/Items.pm b/Koha/REST/V1/Items.pm >index df0103700c..d3c5d7e177 100644 >--- a/Koha/REST/V1/Items.pm >+++ b/Koha/REST/V1/Items.pm >@@ -113,7 +113,7 @@ sub pickup_locations { > > return try { > >- my $ps_set = $item->pickup_locations( { patron => $patron } ); >+ my $pl_set = $item->pickup_locations( { patron => $patron } ); > > my @response = (); > if ( C4::Context->preference('AllowHoldPolicyOverride') ) { >@@ -124,23 +124,19 @@ sub pickup_locations { > @response = map { > my $library = $_; > $library->{needs_override} = ( >- any { $_->{library_id} eq $library->{library_id} } >- @{$ps_set->as_list} >+ any { $_->branchcode eq $library->{library_id} } >+ @{ $pl_set->as_list } > ) > ? Mojo::JSON->false > : Mojo::JSON->true; > $library; > } @{$libraries}; >- >- return $c->render( >- status => 200, >- openapi => \@response >- ); > } >+ else { > >- my $pickup_locations = $c->objects->search( $ps_set ); >- >- @response = map { $_->{needs_override} = Mojo::JSON->false; $_; } @{$pickup_locations}; >+ my $pickup_locations = $c->objects->search($pl_set); >+ @response = map { $_->{needs_override} = Mojo::JSON->false; $_; } @{$pickup_locations}; >+ } > > return $c->render( > status => 200, >-- >2.30.2
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