From: dbs Date: Wed, 20 May 2009 20:04:21 +0000 (+0000) Subject: Give marc2sre the ability to read subfields for an id field X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=90d3f316c2a2100c4770117e3c7f6c220bb24863;p=evergreen%2Fbjwebb.git Give marc2sre the ability to read subfields for an id field git-svn-id: svn://svn.open-ils.org/ILS/trunk@13210 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/extras/import/marc2sre.pl b/Open-ILS/src/extras/import/marc2sre.pl index 3687257e5..49b3ba708 100755 --- a/Open-ILS/src/extras/import/marc2sre.pl +++ b/Open-ILS/src/extras/import/marc2sre.pl @@ -25,11 +25,12 @@ use MARC::Charset; 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 @@ my $rec; 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