From 7a6945205d46b1910b5d48726b812dd030b7f197 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 17 Sep 2021 12:05:26 +0000 Subject: [PATCH] Bug 28667: (QA follow-up) Fetch preference once Signed-off-by: Nick Clemens --- opac/opac-ISBDdetail.pl | 3 ++- opac/opac-MARCdetail.pl | 3 ++- opac/opac-detail.pl | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/opac/opac-ISBDdetail.pl b/opac/opac-ISBDdetail.pl index fdbd6648ee..8c7d92ba09 100755 --- a/opac/opac-ISBDdetail.pl +++ b/opac/opac-ISBDdetail.pl @@ -176,12 +176,13 @@ my $res = GetISBDView({ }); my $items = $biblio->items; +my $allow_damaged_holds = C4::Context->preference('AllowHoldsOnDamagedItems'); while ( my $item = $items->next ) { $norequests = 0 if $norequests && !$item->withdrawn && !$item->itemlost - && ( !$item->damaged || C4::Context->preference('AllowHoldsOnDamagedItems') ) + && ( !$item->damaged || $allow_damaged_holds ) && ($item->notforloan < 0 || not $item->notforloan ) && !Koha::ItemTypes->find($item->effective_itemtype)->notforloan && $item->itemnumber; diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl index 2fb3915098..164125f89a 100755 --- a/opac/opac-MARCdetail.pl +++ b/opac/opac-MARCdetail.pl @@ -146,13 +146,14 @@ $template->param( my $norequests = 1; my $allow_onshelf_holds; my $items = $biblio->items; +my $allow_damaged_holds = C4::Context->preference('AllowHoldsOnDamagedItems'); while ( my $item = $items->next ) { $norequests = 0 if $norequests && !$item->withdrawn && !$item->itemlost - && ( !$item->damaged || C4::Context->preference('AllowHoldsOnDamagedItems') ) + && ( !$item->damaged || $allow_damaged_holds ) && ($item->notforloan < 0 || not $item->notforloan ) && !Koha::ItemTypes->find($item->effective_itemtype)->notforloan && $item->itemnumber; diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 5a8036e18c..05b58f1278 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -701,6 +701,7 @@ if ( not $viewallitems and @items > $max_items_to_display ) { items_count => scalar( @items ), ); } else { + my $allow_damaged_holds = C4::Context->preference('AllowHoldsOnDamagedItems'); for my $itm (@items) { my $item = Koha::Items->find( $itm->{itemnumber} ); $itm->{holds_count} = $item_reserves{ $itm->{itemnumber} }; @@ -709,7 +710,7 @@ if ( not $viewallitems and @items > $max_items_to_display ) { if $norequests && !$itm->{'withdrawn'} && !$itm->{'itemlost'} - && ( !$itm->{'damaged'} || C4::Context->preference('AllowHoldsOnDamagedItems') ) + && ( !$itm->{'damaged'} || $allow_damaged_holds ) && ($itm->{'itemnotforloan'}<0 || not $itm->{'itemnotforloan'}) && !$itemtypes->{$itm->{'itype'}}->{notforloan} && $itm->{'itemnumber'}; -- 2.20.1