From 5562eee7567a840b8c222ebfd9cbd0b21f75986d Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Tue, 10 Apr 2012 00:29:59 +0200 Subject: [PATCH] Bug 7937: Silence warns in OPAC error log (koha-opac-error_log) I noticed warnings in the logs for an item without itemtype on item and record level. While trying to resolve the warns, I noticed a possible optimization in XSLT.pm. GetItemsInfo is built to return the notforloan value both for the item and record level, depending on the item-level_itype setting. - $item->{notforloan} doesn't exist in @items - $itemtypes->{ $item->{itype} }->{notforloan} can be replaced by $item->{notforloan_per_itemtype} --- C4/XSLT.pm | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/C4/XSLT.pm b/C4/XSLT.pm index 56ba544..02922e9 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -232,7 +232,6 @@ sub buildKohaItemsNamespace { @items = grep { !$hi{$_->{itemnumber}} } @items; } my $branches = GetBranches(); - my $itemtypes = GetItemTypes(); my $xml = ''; for my $item (@items) { my $status; @@ -240,13 +239,12 @@ sub buildKohaItemsNamespace { my ( $transfertwhen, $transfertfrom, $transfertto ) = C4::Circulation::GetTransfers($item->{itemnumber}); my ( $reservestatus, $reserveitem, undef ) = C4::Reserves::CheckReserves($item->{itemnumber}); - - if ( $itemtypes->{ $item->{itype} }->{notforloan} || $item->{notforloan} || $item->{onloan} || $item->{wthdrawn} || $item->{itemlost} || $item->{damaged} || + if ( $item->{notforloan_per_itemtype} || $item->{onloan} || $item->{wthdrawn} || $item->{itemlost} || $item->{damaged} || (defined $transfertwhen && $transfertwhen ne '') || $item->{itemnotforloan} || (defined $reservestatus && $reservestatus eq "Waiting") ){ if ( $item->{notforloan} < 0) { $status = "On order"; } - if ( $item->{itemnotforloan} > 0 || $item->{notforloan} > 0 || $itemtypes->{ $item->{itype} }->{notforloan} == 1 ) { + if ( $item->{itemnotforloan} > 0 || ($item->{notforloan_per_itemtype} && $item->{notforloan_per_itemtype}) == 1 ) { $status = "reference"; } if ($item->{onloan}) { -- 1.7.5.4