Bug 16506: Remove warning for UNIMARC installs
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Sat, 21 May 2016 09:20:55 +0000 (10:20 +0100)
committerKyle M Hall <kyle@bywatersolutions.com>
Mon, 23 May 2016 17:29:12 +0000 (17:29 +0000)
Use of uninitialized value in numeric eq (==)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
misc/migration_tools/rebuild_zebra.pl

index 3a0fe6d..6c036ba 100755 (executable)
@@ -782,7 +782,8 @@ sub fix_unimarc_100 {
     my $marc = shift;
 
     my $string;
-    if ( length($marc->subfield( 100, "a" )) == 36 ) {
+    my $length_100a = length($marc->subfield( 100, "a" ));
+    if (  $length_100a and $length_100a == 36 ) {
         $string = $marc->subfield( 100, "a" );
         my $f100 = $marc->field(100);
         $marc->delete_field($f100);
@@ -793,7 +794,8 @@ sub fix_unimarc_100 {
         $string = sprintf( "%-*s", 35, $string );
     }
     substr( $string, 22, 6, "frey50" );
-    unless ( length($marc->subfield( 100, "a" )) == 36 ) {
+    $length_100a = length($marc->subfield( 100, "a" ));
+    unless ( $length_100a and $length_100a == 36 ) {
         $marc->delete_field($marc->field(100));
         $marc->insert_grouped_field(MARC::Field->new( 100, "", "", "a" => $string ));
     }