From 6733015247bb1f7520d47a8db31d15864fdc1274 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Wed, 17 Jun 2009 08:00:57 -0500 Subject: [PATCH] bug 2893: extend conditions handled by AllowNotForLoanOverride Prior to this patch, turning AllowNotForLoanOverride on allowed the circ operator to permit the loan of an item who's individual not-for-loan flag was set, but did not allow the loan of an item whose item type's not-for-loan flag was set. This patch extends the definition of the system preference so that both cases are covered. Signed-off-by: Galen Charlton --- C4/Circulation.pm | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 9ad4ff614c..f7e3776739 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -749,27 +749,35 @@ sub CanBookBeIssued { && $item->{'notforloan'} > 0 ) { if(C4::Context->preference("AllowNotForLoanOverride")){ - $issuingimpossible{NOT_FOR_LOAN_CAN_FORCE} = 1; + $needsconfirmation{NOT_FOR_LOAN_FORCING} = 1; }else{ $issuingimpossible{NOT_FOR_LOAN} = 1; } } - elsif ( !$item->{'notforloan'} ){ - # we have to check itemtypes.notforloan also - if (C4::Context->preference('item-level_itypes')){ - # this should probably be a subroutine - my $sth = $dbh->prepare("SELECT notforloan FROM itemtypes WHERE itemtype = ?"); - $sth->execute($item->{'itemtype'}); - my $notforloan=$sth->fetchrow_hashref(); - $sth->finish(); - if ($notforloan->{'notforloan'} == 1){ - $issuingimpossible{NOT_FOR_LOAN} = 1; - } - } - elsif ($biblioitem->{'notforloan'} == 1){ - $issuingimpossible{NOT_FOR_LOAN} = 1; - } - } + elsif ( !$item->{'notforloan'} ){ + # we have to check itemtypes.notforloan also + if (C4::Context->preference('item-level_itypes')){ + # this should probably be a subroutine + my $sth = $dbh->prepare("SELECT notforloan FROM itemtypes WHERE itemtype = ?"); + $sth->execute($item->{'itemtype'}); + my $notforloan=$sth->fetchrow_hashref(); + $sth->finish(); + if ($notforloan->{'notforloan'}) { + if (!C4::Context->preference("AllowNotForLoanOverride")) { + $issuingimpossible{NOT_FOR_LOAN} = 1; + } else { + $needsconfirmation{NOT_FOR_LOAN_FORCING} = 1; + } + } + } + elsif ($biblioitem->{'notforloan'} == 1){ + if (!C4::Context->preference("AllowNotForLoanOverride")) { + $issuingimpossible{NOT_FOR_LOAN} = 1; + } else { + $needsconfirmation{NOT_FOR_LOAN_FORCING} = 1; + } + } + } if ( $item->{'wthdrawn'} && $item->{'wthdrawn'} == 1 ) { $issuingimpossible{WTHDRAWN} = 1; -- 2.20.1