From c81c59e2335785a8ff364c846e7d0d8f099363ce Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 11 Dec 2012 11:09:49 -0500 Subject: [PATCH] Bug 6918 - can't place holds on 'on order' items with AllowOnShelfHolds off Koha documenation suggests that NOT_LOAN values less than 0 should be hold-able. This patch enables that. From the manual: Negative number values will still allow holds (use for on order statuses for example) where as positive numbers will not allow holds or checkouts Signed-off-by: Mirko Tietgen Works as expected --- C4/Reserves.pm | 2 +- opac/opac-detail.pl | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index a380bf0..62df806 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -1441,7 +1441,7 @@ sub IsAvailableForItemLevelRequest { if (C4::Context->preference('AllowOnShelfHolds')) { return $available_per_item; } else { - return ($available_per_item and ($item->{onloan} or GetReserveStatus($itemnumber) eq "W")); + return ($available_per_item and ($item->{onloan} or $item->{notforloan} < 0 or GetReserveStatus($itemnumber) eq "W" )); } } diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 22c922b..fbb6497 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -387,12 +387,8 @@ if ($session->param('busc')) { } } - - $template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') ); -$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) ); - - +my $count_items_issued = CountItemsIssued( $biblionumber ); # If AllowOnShelfHolds is disabled, at least one item must be either issued or have a negative not for loan status $template->param('OPACShowCheckoutName' => C4::Context->preference("OPACShowCheckoutName") ); $template->param('OPACShowBarcode' => C4::Context->preference("OPACShowBarcode") ); @@ -529,6 +525,8 @@ for my $itm (@items) { && (not $itemtypes->{$itm->{'itype'}}->{notforloan} ) && ($itm->{'itemnumber'} ) ); + $count_items_issued++ if ( $itm->{'itemnotforloan'} < 0 ); ## Not for loan items with negative values should count as issued items for the purpose of holdability + if ( defined $itm->{'publictype'} ) { # I can't actually find any case in which this is defined. --amoore 2008-12-09 $itm->{ $itm->{'publictype'} } = 1; @@ -589,6 +587,8 @@ if (scalar(@itemloop) >= 50 && !$viewallitems) { $template->param('lotsofitems' => 1); } +$template->param( 'ItemsIssued' => $count_items_issued ); + ## get notes and subjects from MARC record my $dbh = C4::Context->dbh; my $marcnotesarray = GetMarcNotes ($record,$marcflavour); -- 1.7.2.5