Bug 10876: Fix opac-MARCdetail.pl displaying items that are meant to be hidden

When OpacHiddenItems is used to hide some, but not all of the
items for a biblio, then the opac-MARCdetail page displayed
all the items, rather than just the ones intended to be visible.

By determining the tag and subtag for items.itemnumber, the
loop which builds the big array can be filtered to exclude
records that should be hidden.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Works as expected, passes koha-qa also.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
Mark Tompsett 2013-09-13 06:47:15 -04:00 committed by Galen Charlton
parent 5d8ad73929
commit f072cbdf9b
1 changed files with 5 additions and 0 deletions

View File

@ -53,6 +53,7 @@ use C4::Biblio;
use C4::Items;
use C4::Acquisition;
use C4::Koha;
use List::MoreUtils qw/any/;
my $query = new CGI;
@ -77,6 +78,7 @@ if (scalar @all_items >= 1) {
my $itemtype = &GetFrameworkCode($biblionumber);
my $tagslib = &GetMarcStructure( 0, $itemtype );
my ($tag_itemnumber,$subtag_itemnumber) = &GetMarcFromKohaField('items.itemnumber',$itemtype);
my $biblio = GetBiblioData($biblionumber);
$biblionumber = $biblio->{biblionumber};
my $record = GetMarcBiblio($biblionumber, 1);
@ -238,6 +240,9 @@ my %witness
my @big_array;
foreach my $field (@fields) {
next if ( $field->tag() < 10 );
next if ( ( $field->tag() eq $tag_itemnumber ) &&
( any { $field->subfield($subtag_itemnumber) eq $_ }
@items2hide) );
my @subf = $field->subfields;
my %this_row;