@@ -, +, @@ EasyAnalyticalRecords indentation in that loop (removing tabs). So no change at all there. searches for Host-Item-Number with 1=8911. (As well as ERROR 114 on this index.) --- catalogue/detail.pl | 2 +- cataloguing/additem.pl | 26 ++++++++++---------------- 2 files changed, 11 insertions(+), 17 deletions(-) --- a/catalogue/detail.pl +++ a/catalogue/detail.pl @@ -298,7 +298,7 @@ foreach my $item (@items) { } #count if item is used in analytical bibliorecords - my $countanalytics= GetAnalyticsCount($item->{itemnumber}); + my $countanalytics = C4::Context->preference('EasyAnalyticalRecords') ? GetAnalyticsCount($item->{itemnumber}) : 0; if ($countanalytics > 0){ $analytics_flag=1; $item->{countanalytics} = $countanalytics; --- a/cataloguing/additem.pl +++ a/cataloguing/additem.pl @@ -793,22 +793,16 @@ foreach my $field (@fields) { } $this_row{itemnumber} = $subfieldvalue if ($field->tag() eq $itemtagfield && $subfieldcode eq $itemtagsubfield); - if ( C4::Context->preference('EasyAnalyticalRecords') ) { - foreach my $hostitemnumber (@hostitemnumbers){ - my $item = Koha::Items->find( $hostitemnumber ); - if ($this_row{itemnumber} eq $hostitemnumber){ - $this_row{hostitemflag} = 1; - $this_row{hostbiblionumber}= $item->biblio->biblionumber; - last; - } - } - -# my $countanalytics=GetAnalyticsCount($this_row{itemnumber}); -# if ($countanalytics > 0){ -# $this_row{countanalytics} = $countanalytics; -# } - } - + if ( C4::Context->preference('EasyAnalyticalRecords') ) { + foreach my $hostitemnumber (@hostitemnumbers) { + my $item = Koha::Items->find( $hostitemnumber ); + if ($this_row{itemnumber} eq $hostitemnumber) { + $this_row{hostitemflag} = 1; + $this_row{hostbiblionumber}= $item->biblio->biblionumber; + last; + } + } + } } if (%this_row) { push(@big_array, \%this_row); --