From 6049836023be61771c25fe038f02378ede96fff5 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 6 Jun 2018 14:25:19 -0300 Subject: [PATCH] Bug 20889: Prevent not for loan items to be checked out 1. Item type defined at item level (item-level_itypes=1) 2. Mark an item type not for loan (itemtypes.notforloan=1) 3. Checkout an item using this item type (items.itype="BK" for instance) => Checkout is not blocked! I suspect commit 3953fdb921d7f280ffbaca813956357aa67d42ca Bug 19943: Remove itemtype vs itype confusion in CanBookBeIssued to be the root of this issue. One occurrence of $item->{itemtype} has not been replaced. In this case it refers to the biblioitem->{itemtype} value whereas we want to use $item->{itype}. So this issue does not happen if items.itype==biblioitem.itemtype (just in case you are not reproducing the problem). Test plan: Make sure not for loan items cannot be checked out Signed-off-by: Martin Renvoize Signed-off-by: Marcel de Rooy Signed-off-by: Nick Clemens --- C4/Circulation.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 7bd789c442..6aada15eba 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -917,7 +917,7 @@ sub CanBookBeIssued { 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'}); + $sth->execute($effective_itemtype); my $notforloan=$sth->fetchrow_hashref(); if ($notforloan->{'notforloan'}) { if (!C4::Context->preference("AllowNotForLoanOverride")) { -- 2.39.5