From 293c420617acff4e9d3ef915c06b2b265272ab33 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 28 May 2018 11:24:43 -0300 Subject: [PATCH] Bug 20825: (bug 19943 follow-up) call notforloan on itemtype instead of biblioitem On bug 19943: - elsif ($biblioitem->{'notforloan'} == 1){ + elsif ($biblioitem->notforloan == 1){ The biblioitems table does not contain a notforloan column, this comes from the item type. This bug only appears when item type is defined at biblio level (item-level_itypes=0) Test plan: Set item-level_itypes = biblio Check an item out Without this patch it explodes with "The method notforloan is not covered by tests!" --- C4/Circulation.pm | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 2deb3678a1..7bd789c442 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -929,13 +929,16 @@ sub CanBookBeIssued { } } } - elsif ($biblioitem->notforloan == 1){ - if (!C4::Context->preference("AllowNotForLoanOverride")) { - $issuingimpossible{NOT_FOR_LOAN} = 1; - $issuingimpossible{itemtype_notforloan} = $effective_itemtype; - } else { - $needsconfirmation{NOT_FOR_LOAN_FORCING} = 1; - $needsconfirmation{itemtype_notforloan} = $effective_itemtype; + else { + my $itemtype = Koha::ItemTypes->find($biblioitem->itemtype); + if ( $itemtype and $itemtype->notforloan == 1){ + if (!C4::Context->preference("AllowNotForLoanOverride")) { + $issuingimpossible{NOT_FOR_LOAN} = 1; + $issuingimpossible{itemtype_notforloan} = $effective_itemtype; + } else { + $needsconfirmation{NOT_FOR_LOAN_FORCING} = 1; + $needsconfirmation{itemtype_notforloan} = $effective_itemtype; + } } } } -- 2.11.0