[open-ils-commits] r13210 - trunk/Open-ILS/src/extras/import (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed May 20 16:04:25 EDT 2009
Author: dbs
Date: 2009-05-20 16:04:21 -0400 (Wed, 20 May 2009)
New Revision: 13210
Modified:
trunk/Open-ILS/src/extras/import/marc2sre.pl
Log:
Give marc2sre the ability to read subfields for an id field
Modified: trunk/Open-ILS/src/extras/import/marc2sre.pl
===================================================================
--- trunk/Open-ILS/src/extras/import/marc2sre.pl 2009-05-20 19:58:06 UTC (rev 13209)
+++ trunk/Open-ILS/src/extras/import/marc2sre.pl 2009-05-20 20:04:21 UTC (rev 13210)
@@ -25,11 +25,12 @@
MARC::Charset->ignore_errors(1);
-my ($idfield, $count, $user, $password, $config, $marctype, @files, @trash_fields, $quiet) =
+my ($idfield, $count, $user, $password, $config, $marctype, $idsubfield, @files, @trash_fields, $quiet) =
('001', 1, 'admin', 'open-ils', '/openils/conf/opensrf_core.xml', 'USMARC');
GetOptions(
'idfield=i' => \$idfield,
+ 'idsubfield=a' => \$idsubfield,
'startid=i' => \$count,
'user=s' => \$user,
'password=s' => \$password,
@@ -62,7 +63,12 @@
while ( try { $rec = $batch->next } otherwise { $rec = -1 } ) {
next if ($rec == -1);
my $id = $count;
- my $record_field = $rec->field($idfield);
+ my $record_field;
+ if ($idsubfield) {
+ $record_field = $rec->field($idfield, $idsubfield);
+ } else {
+ $record_field = $rec->field($idfield);
+ }
my $record = $count;
# On some systems, the 001 actually points to the record ID
More information about the open-ils-commits
mailing list