Bugzilla – Attachment 113762 Details for
Bug 27015
Add filtering options to the pickup_locations routes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27015: Make pickup locations searchable
Bug-27015-Make-pickup-locations-searchable.patch (text/plain), 2.92 KB, created by
David Nind
on 2020-11-17 20:11:08 UTC
(
hide
)
Description:
Bug 27015: Make pickup locations searchable
Filename:
MIME Type:
Creator:
David Nind
Created:
2020-11-17 20:11:08 UTC
Size:
2.92 KB
patch
obsolete
>From 14ce95ccb1f1f7843c278a97c67ae4c6f755c6a1 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 13 Nov 2020 19:09:52 -0300 >Subject: [PATCH] Bug 27015: Make pickup locations searchable > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> > >Signed-off-by: David Nind <david@davidnind.com> >--- > Koha/REST/V1/Holds.pm | 18 ++++++++++++------ > api/v1/swagger/paths/holds.json | 27 +++++++++++++++++++++++++-- > 2 files changed, 37 insertions(+), 8 deletions(-) > >diff --git a/Koha/REST/V1/Holds.pm b/Koha/REST/V1/Holds.pm >index 30579caa40..2eb85db95c 100644 >--- a/Koha/REST/V1/Holds.pm >+++ b/Koha/REST/V1/Holds.pm >@@ -406,6 +406,8 @@ sub pickup_locations { > my $c = shift->openapi->valid_input or return; > > my $hold_id = $c->validation->param('hold_id'); >+ # FIXME: We should really skip the path params in $c->objects->search >+ delete $c->validation->output->{hold_id}; > my $hold = Koha::Holds->find( $hold_id, { prefetch => [ 'patron' ] } ); > > unless ($hold) { >@@ -416,16 +418,20 @@ sub pickup_locations { > } > > return try { >- my @pickup_locations = >- $hold->itemnumber >- ? @{ $hold->item->pickup_locations( { patron => $hold->patron } )->as_list() } >- : @{ $hold->biblio->pickup_locations( { patron => $hold->patron } )->as_list() }; >+ my $ps_set; > >- @pickup_locations = map { $_->to_api } @pickup_locations; >+ if ( $hold->itemnumber ) { >+ $ps_set = $hold->item->pickup_locations( { patron => $hold->patron } ); >+ } >+ else { >+ $ps_set = $hold->biblio->pickup_locations( { patron => $hold->patron } ); >+ } >+ >+ my $pickup_locations = $c->objects->search( $ps_set ); > > return $c->render( > status => 200, >- openapi => \@pickup_locations >+ openapi => $pickup_locations > ); > } > catch { >diff --git a/api/v1/swagger/paths/holds.json b/api/v1/swagger/paths/holds.json >index 3792985c8c..6bdcccc028 100644 >--- a/api/v1/swagger/paths/holds.json >+++ b/api/v1/swagger/paths/holds.json >@@ -619,9 +619,32 @@ > "x-mojo-to": "Holds#pickup_locations", > "operationId": "getHoldPickupLocations", > "tags": ["holds"], >- "parameters": [{ >+ "parameters": [ >+ { > "$ref": "../parameters.json#/hold_id_pp" >- }], >+ }, >+ { >+ "$ref": "../parameters.json#/match" >+ }, >+ { >+ "$ref": "../parameters.json#/order_by" >+ }, >+ { >+ "$ref": "../parameters.json#/page" >+ }, >+ { >+ "$ref": "../parameters.json#/per_page" >+ }, >+ { >+ "$ref": "../parameters.json#/q_param" >+ }, >+ { >+ "$ref": "../parameters.json#/q_body" >+ }, >+ { >+ "$ref": "../parameters.json#/q_header" >+ } >+ ], > "produces": ["application/json"], > "responses": { > "200": { >-- >2.11.0
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 27015
:
113657
|
113732
|
113733
|
113761
|
113762
|
113789
|
113790