Bug 5202: QA follow-up: quiet warnings
authorJared Camins-Esakov <jcamins@cpbibliography.com>
Sun, 14 Jul 2013 21:13:07 +0000 (17:13 -0400)
committerGalen Charlton <gmc@esilibrary.com>
Thu, 10 Oct 2013 21:36:59 +0000 (21:36 +0000)
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 <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>

Koha/Util/MARC.pm
authorities/merge.pl

index 500ba53..5d026ee 100644 (file)
@@ -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,
                   {
index 0e3fb6d..3d4b881 100755 (executable)
@@ -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 )