From 1460065d244b4a54350cf83c23fdc560e773e34b Mon Sep 17 00:00:00 2001 From: Jared Camins-Esakov Date: Sun, 14 Jul 2013 17:13:07 -0400 Subject: [PATCH] Bug 5202: QA follow-up: quiet warnings Due to massively incorrect data in the default authority frameworks, we were getting warnings about undefined values and spaces from checking which tab subfields/fields were displayed in. This patch eliminates those warnings. Signed-off-by: Katrin Fischer Signed-off-by: Galen Charlton --- Koha/Util/MARC.pm | 18 +++++++++++++++--- authorities/merge.pl | 5 +++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Koha/Util/MARC.pm b/Koha/Util/MARC.pm index 500ba53a2c..5d026ee3cf 100644 --- a/Koha/Util/MARC.pm +++ b/Koha/Util/MARC.pm @@ -62,8 +62,13 @@ sub createMergeHash { my @subfields = $field->subfields(); my @subfield_array; foreach my $subfield (@subfields) { - if ( !defined($tagslib) - || $tagslib->{$fieldtag}->{ @$subfield[0] }->{'tab'} >= 0 ) + if ( + !defined($tagslib) + || ( defined $tagslib->{$fieldtag} + && defined $tagslib->{$fieldtag}->{ @$subfield[0] } + && defined $tagslib->{$fieldtag}->{ @$subfield[0] }->{'tab'} + && $tagslib->{$fieldtag}->{ @$subfield[0] }->{'tab'} >= 0 ) + ) { push @subfield_array, { @@ -75,7 +80,14 @@ sub createMergeHash { } - if ( !defined($tagslib) || @subfield_array ) + if ( + ( + !defined($tagslib) || ( defined $tagslib->{$fieldtag} + && defined $tagslib->{$fieldtag}->{'tab'} + && $tagslib->{$fieldtag}->{'tab'} >= 0 ) + ) + && @subfield_array + ) { push @array, { diff --git a/authorities/merge.pl b/authorities/merge.pl index 0e3fb6df84..3d4b881b14 100755 --- a/authorities/merge.pl +++ b/authorities/merge.pl @@ -114,6 +114,11 @@ else { # Getting MARC Structure my $tagslib = GetTagsLabels( 1, $framework ); + foreach my $field ( keys %$tagslib ) { + if ( defined $tagslib->{$field}->{'tab'} && $tagslib->{$field}->{'tab'} eq ' ' ) { + $tagslib->{$field}->{'tab'} = 0; + } + } my $notreference = ( $authid[0] == $mergereference ) -- 2.39.5