Bugzilla – Attachment 117936 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.85 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-03-08 16:09:37 UTC
(
hide
)
Description:
Bug 27898: Make PUT /holds/:hold_id accept overrides
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-03-08 16:09:37 UTC
Size:
1.85 KB
patch
obsolete
>From eb73e836b58ed6fec767e7660cde02cc5fb8d400 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> >--- > 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 26fb90aaefb..ffe42d123f0 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.30.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 27898
:
117935
|
117936
|
117939
|
117940
|
120268
|
120269