[open-ils-commits] r19626 - trunk/Open-ILS/src/support-scripts (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Mar 7 14:30:09 EST 2011


Author: dbs
Date: 2011-03-07 14:30:04 -0500 (Mon, 07 Mar 2011)
New Revision: 19626

Modified:
   trunk/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.


Modified: trunk/Open-ILS/src/support-scripts/marc_export
===================================================================
--- trunk/Open-ILS/src/support-scripts/marc_export	2011-03-07 16:53:25 UTC (rev 19625)
+++ trunk/Open-ILS/src/support-scripts/marc_export	2011-03-07 19:30:04 UTC (rev 19626)
@@ -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