Bugzilla – Attachment 117940 Details for
Bug 27898
Make PUT /holds/:hold_id handle x-koha-override for pickup locations
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27898: Make PUT /holds/:hold_id accept overrides
Bug-27898-Make-PUT-holdsholdid-accept-overrides.patch (text/plain), 1.91 KB, created by
Andrew Fuerste-Henry
on 2021-03-08 17:37:03 UTC
(
hide
)
Description:
Bug 27898: Make PUT /holds/:hold_id accept overrides
Filename:
MIME Type:
Creator:
Andrew Fuerste-Henry
Created:
2021-03-08 17:37:03 UTC
Size:
1.91 KB
patch
obsolete
>From cb5730b7156f6f24f5fc789a84901c777c3d8a8e Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 8 Mar 2021 13:05:34 -0300 >Subject: [PATCH] Bug 27898: Make PUT /holds/:hold_id accept overrides > >This patch makes the route handle overriding pickup locations by passing >the 'x-koha-override' header (set to 'any'). > >To test: >1. Apply the unit tests patch >2. Run: > $ kshell > k$ prove t/db_dependent/api/v1/holds.t >=> FAIL: Tests fail, because things cannot be overridden ATM. >3. Apply this patch >4. Repeat 2 >=> SUCCESS: Tests pass! >5. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> > >Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> >--- > Koha/REST/V1/Holds.pm | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) > >diff --git a/Koha/REST/V1/Holds.pm b/Koha/REST/V1/Holds.pm >index 26fb90aaef..ffe42d123f 100644 >--- a/Koha/REST/V1/Holds.pm >+++ b/Koha/REST/V1/Holds.pm >@@ -252,17 +252,22 @@ sub edit { > my $hold = Koha::Holds->find( $hold_id ); > > unless ($hold) { >- return $c->render( status => 404, >- openapi => {error => "Hold not found"} ); >+ return $c->render( >+ status => 404, >+ openapi => { error => "Hold not found" } >+ ); > } > >- my $body = $c->req->json; >+ my $overrides = $c->stash('koha.overrides'); >+ my $can_override = $overrides->{any} && C4::Context->preference('AllowHoldPolicyOverride'); >+ >+ my $body = $c->validation->output->{body}; > > my $pickup_library_id = $body->{pickup_library_id}; > > if ( > defined $pickup_library_id >- and not $hold->is_pickup_location_valid({ library_id => $pickup_library_id }) >+ && ( !$hold->is_pickup_location_valid({ library_id => $pickup_library_id }) && !$can_override ) > ) > { > return $c->render( >-- >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 27898
:
117935
|
117936
|
117939
|
117940
|
120268
|
120269