[open-ils-commits] r10357 - trunk/Open-ILS/src/extras/import
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Aug 13 18:12:02 EDT 2008
Author: sboyette
Date: 2008-08-13 18:11:57 -0400 (Wed, 13 Aug 2008)
New Revision: 10357
Modified:
trunk/Open-ILS/src/extras/import/marc2bre.pl
Log:
New flag, --use901. Passing this flag causes the preprocess() routine to be bypassed, as well as all secondary code related to it (basically, anything that references $tcn)
Modified: trunk/Open-ILS/src/extras/import/marc2bre.pl
===================================================================
--- trunk/Open-ILS/src/extras/import/marc2bre.pl 2008-08-13 17:52:06 UTC (rev 10356)
+++ trunk/Open-ILS/src/extras/import/marc2bre.pl 2008-08-13 22:11:57 UTC (rev 10357)
@@ -28,28 +28,28 @@
my ($db_driver,$db_host,$db_name,$db_user,$db_pw) =
('Pg','localhost','evergreen','postgres','postgres');
-GetOptions(
- 'marctype=s' => \$marctype,
- 'startid=i' => \$recid,
- 'idfield=s' => \$id_field,
- 'idsubfield=s' => \$id_subfield,
- 'user=s' => \$user,
- 'encoding=s' => \$enc,
- 'hard_encoding' => \$force_enc,
- 'keyfile=s' => \$keyfile,
- 'config=s' => \$config,
- 'file=s' => \@files,
- 'required_field=s' => \@req_fields,
- 'trash=s' => \@trash_fields,
- 'xml_idl=s' => \$idlfile,
- 'dontuse=s' => \$dontuse_file,
- "db_driver=s" => \$db_driver,
- "db_host=s" => \$db_host,
- "db_name=s" => \$db_name,
- "db_user=s" => \$db_user,
- "db_pw=s" => \$db_pw,
- 'quiet' => \$quiet
-);
+GetOptions( 'marctype=s' => \$marctype,
+ 'startid=i' => \$recid,
+ 'idfield=s' => \$id_field,
+ 'idsubfield=s' => \$id_subfield,
+ 'user=s' => \$user,
+ 'encoding=s' => \$enc,
+ 'hard_encoding' => \$force_enc,
+ 'keyfile=s' => \$keyfile,
+ 'config=s' => \$config,
+ 'file=s' => \@files,
+ 'required_field=s' => \@req_fields,
+ 'trash=s' => \@trash_fields,
+ 'xml_idl=s' => \$idlfile,
+ 'dontuse=s' => \$dontuse_file,
+ "db_driver=s" => \$db_driver,
+ "db_host=s" => \$db_host,
+ "db_name=s" => \$db_name,
+ "db_user=s" => \$db_user,
+ "db_pw=s" => \$db_pw,
+ "use901" => \$use901
+ 'quiet' => \$quiet,
+ );
@trash_fields = split(/,/,join(',', at trash_fields));
@@ -87,13 +87,13 @@
$dbh->disconnect;
}
-my %source_map = (
+my %source_map = (
o => 'OCLC',
- i => 'ISxN',
+ i => 'ISxN',
l => 'LCCN',
- s => 'System',
- g => 'Gutenberg',
-);
+ s => 'System',
+ g => 'Gutenberg',
+);
Fieldmapper->import(IDL => $idlfile);
@@ -175,17 +175,18 @@
}
my $tcn;
- ($rec, $tcn) = preprocess($rec, $id);
+ if ($use901) {
+ $id = $rec->subfield('901' => 'c')
+ } else {
+ ($rec, $tcn) = preprocess($rec, $id);
+ $tcn->add_subfields(c => $id);
- $tcn->add_subfields(c => $id);
+ $rec->delete_field( $_ ) for ($rec->field($id_field));
+ $rec->append_fields( $tcn );
- $rec->delete_field( $_ ) for ($rec->field($id_field));
- $rec->append_fields( $tcn );
+ next unless $rec;
+ }
- if (!$rec) {
- next;
- }
-
my $tcn_value = $rec->subfield('901' => 'a') || "SYS$id";
my $tcn_source = $rec->subfield('901' => 'b') || 'System';
More information about the open-ils-commits
mailing list