From 90193cf4e72946bed076e4b0fe12572cef059058 Mon Sep 17 00:00:00 2001 From: Arthur Suzuki Date: Thu, 21 Mar 2019 21:52:06 +0100 Subject: [PATCH] Bug 20985 : Add OnShelfHoldsAllowed checks to CanItemBeReserved Test plan : 1 / Check that default circulation have OnShelfHoldsAllowed to Yes 2 / Place a hold on a book with a single item, item being available for loan, verify that hold can be placed. 3 / Set OnShelfHoldsAllowed to any other value, verify that hold cannot be placed for reason "onShelfHoldsNotAllowed" (shown in the item table). --- C4/Reserves.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 974168f8a3..5748b0dbc0 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -298,6 +298,7 @@ sub CanBookBeReserved{ if ($canReserve->{status} eq 'OK') { #We can reserve this Item! } @RETURNS { status => OK }, if the Item can be reserved. + { status => onShelfHoldsNotAllowed }, if onShelfHoldsAllowed parameter and item availability combination doesn't allow holds. { status => ageRestricted }, if the Item is age restricted for this borrower. { status => damaged }, if the Item is damaged. { status => cannotReserveFromOtherBranches }, if syspref 'canreservefromotherbranches' is OK. @@ -330,6 +331,10 @@ sub CanItemBeReserved { if ( $item->{damaged} && !C4::Context->preference('AllowHoldsOnDamagedItems') ); + # Check for item on shelves and OnShelfHoldsAllowed + return { status => 'onShelfHoldsNotAllowed' } + unless ( IsAvailableForItemLevelRequest($item,$borrower) ); + # Check for the age restriction my ( $ageRestriction, $daysToAgeRestriction ) = C4::Circulation::GetAgeRestriction( $biblio->biblioitem->agerestriction, $borrower ); -- 2.11.0