From d244f21d31f934b7fada6650b5345d20b7973249 Mon Sep 17 00:00:00 2001 From: wajasu Date: Fri, 7 Mar 2014 21:44:39 -0600 Subject: [PATCH] Bug 2946 - Lost items (hidden in Normal View) still show up in the MARC View in OPAC Hides the Holdings that are "Lost" and the entire Holdings table if all items are lost, when the hidelostitems syspref is "Don't Show". Should work in plain text view as well. For the OPAC MARC view of a biblio details. --- opac/opac-MARCdetail.pl | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl index a899e92..6970f82 100755 --- a/opac/opac-MARCdetail.pl +++ b/opac/opac-MARCdetail.pl @@ -277,12 +277,14 @@ foreach my $field (@fields) { @items2hide) ); my @subf = $field->subfields; my $item; + my $hideitem=0; # loop through each subfield for my $i ( 0 .. $#subf ) { my $sf_def = $tagslib->{ $field->tag() }->{ $subf[$i][0] }; next if ( ($sf_def->{tab}||0) != 10 ); next if ( ($sf_def->{hidden}||0) > 0 ); + ( $hideitem=1) if (C4::Context->preference("hidelostitems") && ($sf_def->{kohafield} eq 'items.itemlost') && ($subf[$i][0] > 0) ); push @item_subfield_codes, $subf[$i][0]; $witness{ $subf[$i][0] } = $sf_def->{lib}; @@ -297,7 +299,7 @@ foreach my $field (@fields) { $subf[$i][1], '', $tagslib, '', 'opac' ); } } - push @item_loop, $item if $item; + push @item_loop, $item if ( $item && !$hideitem ); } my ( $holdingbrtagf, $holdingbrtagsubf ) = &GetMarcFromKohaField( "items.holdingbranch", $framework ); @@ -307,11 +309,13 @@ my ( $holdingbrtagf, $holdingbrtagsubf ) = @item_subfield_codes = uniq @item_subfield_codes; # fill item info my @item_header_loop; -for my $subfield_code ( @item_subfield_codes ) { - push @item_header_loop, $witness{$subfield_code}; - for my $item_data ( @item_loop ) { - $item_data->{$subfield_code} ||= " " - } +if (@item_loop > 0) { # prevent display of header if no items to display + for my $subfield_code ( @item_subfield_codes ) { + push @item_header_loop, $witness{$subfield_code}; + for my $item_data ( @item_loop ) { + $item_data->{$subfield_code} ||= " " + } + } } if ( C4::Context->preference("OPACISBD") ) { -- 2.1.4