Bugzilla – Attachment 120283 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.10 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-04-28 18:01:56 UTC
(
hide
)
Description:
Bug 28254: Make PUT /holds/:hold_id/pickup_location honour x-koha-override
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-04-28 18:01:56 UTC
Size:
2.10 KB
patch
obsolete
>From 0f9cb646f505df964703e1b2c051dad79a3df493 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 >--- > 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 384f0cbbc19..bea108f5d08 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 eb130a02dbc..366cf358380 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.31.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