[open-ils-commits] r20241 - branches/rel_2_1/Open-ILS/src/support-scripts (gmc)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Apr 20 10:50:17 EDT 2011


Author: gmc
Date: 2011-04-20 10:50:14 -0400 (Wed, 20 Apr 2011)
New Revision: 20241

Modified:
   branches/rel_2_1/Open-ILS/src/support-scripts/marc_export
Log:
Create a 001 field if it doesn't exist in marc_export

Real data has a way of surprising you sometimes, like by not having 001 fields.

Signed-off-by: Galen Charlton <gmc at esilibrary.com>

Modified: branches/rel_2_1/Open-ILS/src/support-scripts/marc_export
===================================================================
--- branches/rel_2_1/Open-ILS/src/support-scripts/marc_export	2011-04-20 14:50:13 UTC (rev 20240)
+++ branches/rel_2_1/Open-ILS/src/support-scripts/marc_export	2011-04-20 14:50:14 UTC (rev 20241)
@@ -278,7 +278,12 @@
 
         if ($replace_001) {
             my $tcn = $r->field('001');
-            $tcn->update($id);
+            if ($tcn) {
+                $tcn->update($id);
+            } else {
+                my $new_001 = MARC::Field->new('001', $id);
+                $r->insert_fields_ordered($new_001);
+            }
         }
 
         if ($format eq 'XML') {



More information about the open-ils-commits mailing list