check for undefined values when mapping item to MARC
authorGalen Charlton <galen.charlton@liblime.com>
Thu, 3 Jan 2008 18:36:26 +0000 (12:36 -0600)
committerJoshua Ferraro <jmf@liblime.com>
Thu, 3 Jan 2008 22:24:33 +0000 (16:24 -0600)
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
C4/Items.pm

index 651dad0..e7f8e31 100644 (file)
@@ -775,7 +775,7 @@ sub _marc_from_item_hash {
    
     # Tack on 'items.' prefix to column names so lookup from MARC frameworks will work
     # Also, don't emit a subfield if the underlying field is blank.
-    my $mungeditem = { map {  $item->{$_} ne '' ? 
+    my $mungeditem = { map {  (defined($item->{$_}) and $item->{$_} ne '') ? 
                                 (/^items\./ ? ($_ => $item->{$_}) : ("items.$_" => $item->{$_})) 
                                 : ()  } keys %{ $item } };