From 4ca5b8207c16911038f66dda2391bac34ef012d3 Mon Sep 17 00:00:00 2001 From: Arthur Suzuki Date: Mon, 29 Apr 2019 18:55:16 +0200 Subject: [PATCH] Bug 22806 : CanBookBeReserved and CanItemBeReserved must check AllowHoldsOnPatronsPossessions Test plan : 1 - set AllowHoldsOnPatronsPossessions to "Don't Allow" 2 - Checkout an item to a borrower 3 - Try to reserve an item using ILS-DI WebService -> Will work without complaining. 4 - Cancel the hold and apply patch 5 - Repeat 3 -> Should not place hold and reply "itemAlreadyOnLoan" Veuillez saisir le message de validation pour vos modifications. Les lignes --- C4/Reserves.pm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index e8f00d625b..bcf0378057 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -283,6 +283,12 @@ sub CanBookBeReserved{ } } + # Check that patron have not checked out this biblio (if AllowHoldsOnPatronsPossessions set) + if ( !C4::Context->preference('AllowHoldsOnPatronsPossessions') + && C4::Circulation::CheckIfIssuedToPatron( $patron->borrowernumber, $biblionumber ) ) { + return { status =>'itemAlreadyOnLoan' }; + } + # Check if borrower has reached the maximum number of holds allowed my $maxreserves = C4::Context->preference('maxreserves'); if ($maxreserves && $holds->count >= $maxreserves) { @@ -368,6 +374,12 @@ sub CanItemBeReserved { } } + # Check that patron have not checked out this biblio (if AllowHoldsOnPatronsPossessions set) + if ( !C4::Context->preference('AllowHoldsOnPatronsPossessions') + && C4::Circulation::CheckIfIssuedToPatron( $patron->borrowernumber, $biblio->biblionumber ) ) { + return { status =>'itemAlreadyOnLoan' }; + } + # Check if borrower has reached the maximum number of holds allowed my $maxreserves = C4::Context->preference('maxreserves'); if ($maxreserves && $holds->count >= $maxreserves) { -- 2.11.0