Bugzilla – Attachment 120339 Details for
Bug 28254
Make it possible to override rules in PUT /holds/:hold_id/pickup_location
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28254: Make PUT /holds/:hold_id/pickup_location honour x-koha-override
Bug-28254-Make-PUT-holdsholdidpickuplocation-honou.patch (text/plain), 2.21 KB, created by
Martin Renvoize (ashimema)
on 2021-04-30 13:36:45 UTC
(
hide
)
Description:
Bug 28254: Make PUT /holds/:hold_id/pickup_location honour x-koha-override
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-04-30 13:36:45 UTC
Size:
2.21 KB
patch
obsolete
>From 4a46745dbaf4b6dd2984f81402521b99f37fbaf9 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 28 Apr 2021 14:56:33 -0300 >Subject: [PATCH] Bug 28254: Make PUT /holds/:hold_id/pickup_location honour > x-koha-override > >This patch adds a new parameter (x-koha-override header) to the route, >and makes the controller pass this information (override requested) when >the AllowHoldPolicyOverride syspref is set, to >Koha::Hold->set_pickup_location. > >This way, under certain conditions, we can be sure the update wont' >fail. > >To test: >1. Apply this patchset >2. Run: > $ kshell > k$ prove t/db_dependent/api/v1/holds.t >=> SUCCESS: Tests pass! >3. Sign off :-D > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/REST/V1/Holds.pm | 10 +++++++++- > api/v1/swagger/paths/holds.json | 7 +++++++ > 2 files changed, 16 insertions(+), 1 deletion(-) > >diff --git a/Koha/REST/V1/Holds.pm b/Koha/REST/V1/Holds.pm >index 384f0cbbc1..bea108f5d0 100644 >--- a/Koha/REST/V1/Holds.pm >+++ b/Koha/REST/V1/Holds.pm >@@ -533,7 +533,15 @@ sub update_pickup_location { > > return try { > >- $hold->set_pickup_location({ library_id => $pickup_library_id }); >+ my $overrides = $c->stash('koha.overrides'); >+ my $can_override = $overrides->{any} && C4::Context->preference('AllowHoldPolicyOverride'); >+ >+ $hold->set_pickup_location( >+ { >+ library_id => $pickup_library_id, >+ override => $can_override >+ } >+ ); > > return $c->render( > status => 200, >diff --git a/api/v1/swagger/paths/holds.json b/api/v1/swagger/paths/holds.json >index eb130a02db..366cf35838 100644 >--- a/api/v1/swagger/paths/holds.json >+++ b/api/v1/swagger/paths/holds.json >@@ -628,6 +628,13 @@ > "operationId": "getHoldPickupLocations", > "tags": ["holds"], > "parameters": [ >+ { >+ "name": "x-koha-override", >+ "description": "Comma-separated list of overrides (valid values: any)", >+ "in": "header", >+ "type": "string", >+ "required": false >+ }, > { > "$ref": "../parameters.json#/hold_id_pp" > }, >-- >2.20.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 28254
:
120281
|
120282
|
120283
|
120305
|
120306
|
120307
|
120337
|
120338
| 120339 |
120340
|
120457
|
120458