[open-ils-commits] r19993 - trunk/Open-ILS/src/extras/import (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Apr 5 23:58:39 EDT 2011


Author: dbs
Date: 2011-04-05 23:58:36 -0400 (Tue, 05 Apr 2011)
New Revision: 19993

Modified:
   trunk/Open-ILS/src/extras/import/marc2sre.pl
Log:
Make the bib record lookup in marc2sre.pl more specific

Don't strip the identifier down to a bare integer if we are doing
a lookup of the value in the bib record. Otherwise, identifiers
such as ABC1001 and ABC001 will overlap ('%001' will return both
records).


Modified: trunk/Open-ILS/src/extras/import/marc2sre.pl
===================================================================
--- trunk/Open-ILS/src/extras/import/marc2sre.pl	2011-04-06 03:30:51 UTC (rev 19992)
+++ trunk/Open-ILS/src/extras/import/marc2sre.pl	2011-04-06 03:58:36 UTC (rev 19993)
@@ -89,12 +89,8 @@
     }
     my $record = $count;
 
-    # On some systems, the 001 actually points to the record ID
-    # We need to attach to the call number to handle holdings in different libraries
-    # but we can work out call numbers later in SQL by the record ID + call number text
     if ($record_field) {
         $record = $record_field->data;
-        $record =~ s/^.*?(\d+).*?$/$1/o;
     }
 
     # If we have been given bibfield / bibsubfield values, use those to find
@@ -105,6 +101,9 @@
             print("Could not find matching bibliographic record for $record\n");
         }
         $record = $result->record;
+    } else {
+        # Strip the identifier down to a usable integer
+        $record =~ s/^.*?(\d+).*?$/$1/o;
     }
 
     (my $xml = $rec->as_xml_record()) =~ s/\n//sog;
@@ -192,7 +191,7 @@
 
     my %search = (
         tag => $bibfield, 
-        value => { like => '%' . $record }
+        value => { ilike => '%' . $record }
     );
 
     if ($bibsubfield) {



More information about the open-ils-commits mailing list