[Koha-patches] [PATCH 2/2] Bug 7937: Silence warns in OPAC error log (koha-opac-error_log)

Katrin Fischer Katrin.Fischer.83 at web.de
Tue Apr 10 00:43:19 CEST 2012


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



More information about the Koha-patches mailing list