Bugzilla – Attachment 92987 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.91 KB, created by
Liz Rea
on 2019-09-19 19:29:29 UTC
(
hide
)
Description:
Bug 23517: Add the controller method for holds priorities handling
Filename:
MIME Type:
Creator:
Liz Rea
Created:
2019-09-19 19:29:29 UTC
Size:
1.91 KB
patch
obsolete
>From c50c268244533cdb42fa9f73d651a321fe4b37c8 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> > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> > >Signed-off-by: Liz Rea <wizzyrea@gmail.com> >--- > 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..5ccc1fde35 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.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 23517
:
92588
|
92589
|
92590
|
92710
|
92711
|
92712
|
92836
|
92927
|
92928
|
92929
|
92930
|
92986
| 92987 |
92988
|
92989
|
93143