Bug 12288: (follow-up) test for defined values
authorGalen Charlton <gmc@esilibrary.com>
Mon, 19 May 2014 19:56:14 +0000 (19:56 +0000)
committerGalen Charlton <gmc@esilibrary.com>
Mon, 19 May 2014 20:03:30 +0000 (20:03 +0000)
This patch adjusts the test so that if an "ISBN" is not
defined (because the source string did not specify a valid
ISBN), it doesn't result in a warning once the warnings
stricture is enabled in C4::Koha.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
C4/Koha.pm

index 8dd513d..6f98ac6 100644 (file)
@@ -1641,7 +1641,7 @@ sub GetVariationsOfISBN {
     push( @isbns, NormalizeISBN({ isbn => $isbn, format => 'ISBN-13', strip_hyphens => 1 }) );
 
     # Strip out any "empty" strings from the array
-    @isbns = grep { /\S/ } @isbns;
+    @isbns = grep { defined($_) && $_ =~ /\S/ } @isbns;
 
     return wantarray ? @isbns : join( " | ", @isbns );
 }