Bugzilla – Attachment 92589 Details for
Bug 23517
Add API route to update a holds priority
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23517: Add the controller method for holds priorities handling
Bug-23517-Add-the-controller-method-for-holds-prio.patch (text/plain), 1.72 KB, created by
Tomás Cohen Arazi (tcohen)
on 2019-09-04 17:10:09 UTC
(
hide
)
Description:
Bug 23517: Add the controller method for holds priorities handling
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2019-09-04 17:10:09 UTC
Size:
1.72 KB
patch
obsolete
>From 69e958522c7b6bec5f3c8f405d44ccdbfc96f7ac Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 3 Sep 2019 16:39:40 -0300 >Subject: [PATCH] Bug 23517: Add the controller method for holds priorities > handling > >This patch implements the PUT /holds/:hold_id/priority endpoint >To test: >- Apply this patches >- Run: > $ kshell > k$ prove t/db_dependent/api/v1/holds.t >=> SUCCESS: Tests pass! >- Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/REST/V1/Holds.pm | 40 ++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 40 insertions(+) > >diff --git a/Koha/REST/V1/Holds.pm b/Koha/REST/V1/Holds.pm >index a74307ff72..4f56f6491c 100644 >--- a/Koha/REST/V1/Holds.pm >+++ b/Koha/REST/V1/Holds.pm >@@ -349,6 +349,46 @@ sub resume { > }; > } > >+=head3 update_priority >+ >+Method that handles modifying a Koha::Hold object >+ >+=cut >+ >+sub update_priority { >+ my $c = shift->openapi->valid_input or return; >+ >+ my $hold_id = $c->validation->param('hold_id'); >+ my $hold = Koha::Holds->find($hold_id); >+ >+ unless ($hold) { >+ return $c->render( >+ status => 404, >+ openapi => { error => "Hold not found" } >+ ); >+ } >+ >+ return try { >+ my $priority = $c->req->json; >+ C4::Reserves::_FixPriority( >+ { >+ reserve_id => $hold_id, >+ rank => $priority >+ } >+ ); >+ >+ return $c->render( status => 200, openapi => $priority ); >+ } >+ catch { >+ return $c->render( >+ status => 500, >+ openapi => { error => "Something went wrong. check the logs." } >+ ); >+ }; >+} >+ >+=head2 Internal methods >+ > =head3 _to_api > > Helper function that maps unblessed Koha::Hold objects into REST api >-- >2.23.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 23517
:
92588
|
92589
|
92590
|
92710
|
92711
|
92712
|
92836
|
92927
|
92928
|
92929
|
92930
|
92986
|
92987
|
92988
|
92989
|
93143