Bugzilla – Attachment 106213 Details for
Bug 25662
Create hold route does not check maxreserves syspref
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[19.11.x] Bug 25662: Make the route for holds restpect maxreserves
1911x-Bug-25662-Make-the-route-for-holds-restpect-.patch (text/plain), 1.69 KB, created by
Tomás Cohen Arazi (tcohen)
on 2020-06-23 17:41:42 UTC
(
hide
)
Description:
[19.11.x] Bug 25662: Make the route for holds restpect maxreserves
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2020-06-23 17:41:42 UTC
Size:
1.69 KB
patch
obsolete
>From 382361dddebd590cfce1d7bedf998236f9bae182 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 23 Jun 2020 10:33:14 -0300 >Subject: [PATCH] [19.11.x] Bug 25662: Make the route for holds restpect > maxreserves > >This patch fixes the behaviour for the POST /holds route. It assumed >maxreserves was checked in CanItemBeReserved which is not the case. > >Tests are added to check for this behaviour. > >To test: >1. Apply the regression tests >2. Run: > $ kshell > k$ prove t/db_dependent/api/v1/holds.t >=> FAIL: Tests fail! >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 | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > >diff --git a/Koha/REST/V1/Holds.pm b/Koha/REST/V1/Holds.pm >index 41e93fc3084..f112749e3c7 100644 >--- a/Koha/REST/V1/Holds.pm >+++ b/Koha/REST/V1/Holds.pm >@@ -138,11 +138,23 @@ sub add { > ); > } > >+ my $patron = Koha::Patrons->find( $patron_id ); >+ unless ($patron) { >+ return $c->render( >+ status => 400, >+ openapi => { error => 'patron_id not found' } >+ ); >+ } >+ > my $can_place_hold > = $item_id > ? C4::Reserves::CanItemBeReserved( $patron_id, $item_id ) > : C4::Reserves::CanBookBeReserved( $patron_id, $biblio_id ); > >+ if ( $patron->holds->count + 1 > C4::Context->preference('maxreserves') ) { >+ $can_place_hold->{status} = 'tooManyReserves'; >+ } >+ > my $can_override = C4::Context->preference('AllowHoldPolicyOverride'); > > unless ($can_override || $can_place_hold->{status} eq 'OK' ) { >-- >2.27.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 25662
:
106204
|
106205
|
106206
|
106212
| 106213 |
106214
|
106297
|
106298
|
106299
|
108940
|
108941
|
108942