bugfix : handling biblionumber in a field < 010
authorPaul POULAIN <paul@koha-fr.org>
Mon, 22 Oct 2007 08:19:47 +0000 (03:19 -0500)
committerJoshua Ferraro <jmf@liblime.com>
Mon, 22 Oct 2007 12:20:22 +0000 (07:20 -0500)
the bug occur only if we have a malformed biblio, so it should "never" happend, but i've seen it once ;-)

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
C4/Biblio.pm

index 1b93f0f..d192b13 100644 (file)
@@ -393,12 +393,19 @@ sub ModBiblio {
     
     # adding biblionumber
     my ($tag_biblionumber, $subfield_biblionumber) = GetMarcFromKohaField('biblio.biblionumber',$frameworkcode);
-    $record->append_fields(
-           MARC::Field->new(
-                   $tag_biblionumber,'','',$subfield_biblionumber => $biblionumber
-           )
-    ) unless ($record->subfield($tag_biblionumber,$subfield_biblionumber));
-    
+    if ($tag_biblionumber < 10) {
+        $record->append_fields(
+                MARC::Field->new(
+                        $tag_biblionumber, $biblionumber
+                )
+        ) unless $record->field($tag_biblionumber);
+    } else {
+        $record->append_fields(
+                MARC::Field->new(
+                        $tag_biblionumber,'','',$subfield_biblionumber => $biblionumber
+                )
+        ) unless ($record->subfield($tag_biblionumber,$subfield_biblionumber));
+    }
     # update the MARC record (that now contains biblio and items) with the new record data
     &ModBiblioMarc( $record, $biblionumber, $frameworkcode );