[open-ils-commits] r19582 - trunk/Open-ILS/src/support-scripts (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Mar 4 13:03:15 EST 2011
Author: dbs
Date: 2011-03-04 13:03:12 -0500 (Fri, 04 Mar 2011)
New Revision: 19582
Modified:
trunk/Open-ILS/src/support-scripts/marc_export
Log:
Teac marc_export how to replace the 001 field value with the record ID
This is option is probably more useful prior to 2.0 where we introduced
the automated "munge control numbers" option, but new features go
here, right? A site that wants to export their bibliographic records
to send to a large library consortium for control number matching
may find this a useful way to send out records with a local 001 record
ID and get standard identifier control numbers back that they can
add as a 035, per MARC standards.
Modified: trunk/Open-ILS/src/support-scripts/marc_export
===================================================================
--- trunk/Open-ILS/src/support-scripts/marc_export 2011-03-04 14:29:40 UTC (rev 19581)
+++ trunk/Open-ILS/src/support-scripts/marc_export 2011-03-04 18:03:12 UTC (rev 19582)
@@ -23,13 +23,26 @@
my @formats = qw/USMARC UNIMARC XML BRE ARE/;
-my ($config,$format,$encoding,$location,$dollarsign,$idl,$help,$holdings,$timeout,$export_mfhd,$type,$all_records) = ('/openils/conf/opensrf_core.xml','USMARC','MARC8','','$',0,undef,undef,0,undef,'biblio',undef);
+my $config = '/openils/conf/opensrf_core.xml';
+my $format = 'USMARC';
+my $encoding = 'MARC8';
+my $location = '';
+my $dollarsign = '$';
+my $idl = 0;
+my $help = undef;
+my $holdings = undef;
+my $timeout = 0;
+my $export_mfhd = undef;
+my $type = 'biblio';
+my $all_records = undef;
+my $replace_001 = undef;
GetOptions(
'help' => \$help,
'items' => \$holdings,
'mfhd' => \$export_mfhd,
'all' => \$all_records,
+ 'replace_001'=> \$replace_001,
'location=s' => \$location,
'money=s' => \$dollarsign,
'config=s' => \$config,
@@ -66,6 +79,7 @@
have a lot of items attached to them.
--type or -t Record type (BIBLIO, AUTHORITY) [BIBLIO]
--all or -a Export all records; ignores input list
+ --replace_001 Replace the 001 field value with the record ID
Additional options for type = 'BIBLIO':
--items or -i Include items (holdings) in the output
@@ -181,7 +195,7 @@
DONE
sub export_record {
- my $id = shift;
+ my $id = int(shift);
my $bib;
@@ -219,6 +233,11 @@
add_bib_holdings($bib, $r);
}
+ if ($replace_001) {
+ my $tcn = $r->field('001');
+ $tcn->update($id);
+ }
+
if ($format eq 'XML') {
my $xml = $r->as_xml_record;
$xml =~ s/^<\?.+?\?>$//mo;
More information about the open-ils-commits
mailing list