Bugzilla – Attachment 118122 Details for
Bug 27894
Add visual feedback on overridden pickup locations
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27894: Adapt /holds/:hold_id/pickup_locations
Bug-27894-Adapt-holdsholdidpickuplocations.patch (text/plain), 2.80 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-03-11 13:55:21 UTC
(
hide
)
Description:
Bug 27894: Adapt /holds/:hold_id/pickup_locations
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-03-11 13:55:21 UTC
Size:
2.80 KB
patch
obsolete
>From 4ffd6f379191b06577b0e6ab33060160a47a7d5d Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 11 Mar 2021 09:34:05 -0300 >Subject: [PATCH] Bug 27894: Adapt /holds/:hold_id/pickup_locations > >This patch makes the controller for the route, return all valid pickup >locations (i.e. pickup_location => 1) when AllowHoldPolicyOverride is >set to 'Allow', but also adds a calculated attribute: 'needs_override' >so the consumer knows the specific pickup location needs an override >(and thus be able to provide visual feedback on a single run). > >To test: >1. Apply the regression tests >2. Run: > $ kshell > k$ prove t/db_dependent/api/v1/holds.t >=> FAILURE: Tests fail, the change is not implemented >3. Apply this patch >4. Repeat 2 >=> SUCCESS: Tests pass! >5. Sign off :-D >--- > Koha/REST/V1/Holds.pm | 27 ++++++++++++++++++++++++- > api/v1/swagger/definitions/library.json | 4 ++++ > 2 files changed, 30 insertions(+), 1 deletion(-) > >diff --git a/Koha/REST/V1/Holds.pm b/Koha/REST/V1/Holds.pm >index ffe42d123f0..1afe054e4de 100644 >--- a/Koha/REST/V1/Holds.pm >+++ b/Koha/REST/V1/Holds.pm >@@ -473,10 +473,35 @@ sub pickup_locations { > } > > my $pickup_locations = $c->objects->search( $ps_set ); >+ my @response = (); >+ >+ if ( C4::Context->preference('AllowHoldPolicyOverride') ) { >+ >+ my $libraries_rs = Koha::Libraries->search( { pickup_location => 1 } ); >+ my $libraries = $c->objects->search($libraries_rs); >+ >+ @response = map { >+ my $library = $_; >+ $library->{needs_override} = ( >+ any { $_->{library_id} eq $library->{library_id} } >+ @{$pickup_locations} >+ ) >+ ? Mojo::JSON->false >+ : Mojo::JSON->true; >+ $library; >+ } @{$libraries}; >+ >+ return $c->render( >+ status => 200, >+ openapi => \@response >+ ); >+ } >+ >+ @response = map { $_->{needs_override} = Mojo::JSON->false; $_; } @{$pickup_locations}; > > return $c->render( > status => 200, >- openapi => $pickup_locations >+ openapi => \@response > ); > } > catch { >diff --git a/api/v1/swagger/definitions/library.json b/api/v1/swagger/definitions/library.json >index 14b0b4c97dd..def00d3c4f6 100644 >--- a/api/v1/swagger/definitions/library.json >+++ b/api/v1/swagger/definitions/library.json >@@ -91,6 +91,10 @@ > "smtp_server": { > "type": ["object", "null"], > "description": "The library effective SMTP server" >+ }, >+ "needs_override": { >+ "type": "boolean", >+ "description": "If the library needs an override to act as pickup location for a hold" > } > }, > "additionalProperties": false, >-- >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 27894
:
118121
|
118122
|
118123
|
118583
|
118584
|
118585
|
119167
|
119168
|
119169