[open-ils-commits] r16855 - in trunk/Open-ILS/src: extras/import perlmods/OpenILS/Application/Cat perlmods/OpenILS/WWW support-scripts (miker)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Jul 6 13:12:29 EDT 2010


Author: miker
Date: 2010-07-06 13:12:25 -0400 (Tue, 06 Jul 2010)
New Revision: 16855

Modified:
   trunk/Open-ILS/src/extras/import/marc2bre.pl
   trunk/Open-ILS/src/extras/import/marc_add_ids
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Cat/BibCommon.pm
   trunk/Open-ILS/src/perlmods/OpenILS/WWW/Exporter.pm
   trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
   trunk/Open-ILS/src/support-scripts/marc_export
Log:
remove all the 901 mangling -- handled by the db now

Modified: trunk/Open-ILS/src/extras/import/marc2bre.pl
===================================================================
--- trunk/Open-ILS/src/extras/import/marc2bre.pl	2010-07-06 16:14:32 UTC (rev 16854)
+++ trunk/Open-ILS/src/extras/import/marc2bre.pl	2010-07-06 17:12:25 UTC (rev 16855)
@@ -250,11 +250,9 @@
 		}
 
 		# turn our id and tcn into a 901 field, and also create a tcn and/or figure out the tcn source
-		my $field901;
-		($field901, $tcn_value, $tcn_source) = preprocess($rec, $tcn_value, $id);
+		($tcn_value, $tcn_source) = preprocess($rec, $tcn_value, $id);
 		# delete the old identifier and trash fields
 		$rec->delete_field($_) for ($rec->field('901', $tcn_field, $id_field, @trash_fields));
-		$rec->append_fields($field901);
 	}
 
 	(my $xml = $rec->as_xml_record()) =~ s/\n//sog;
@@ -385,14 +383,7 @@
 		warn "\n!!! TCN $passed_tcn is already in use, using TCN ($tcn_value) derived from $tcn_source ID.\n";
 	}
 
-	my $field901 = MARC::Field->new(
-		'901' => ('', ''),
-		a => $tcn_value,
-		b => $tcn_source,
-		c => $id
-	);
-
-	return ($field901, $tcn_value, $tcn_source);
+	return ($tcn_value, $tcn_source);
 }
 
 sub despace {

Modified: trunk/Open-ILS/src/extras/import/marc_add_ids
===================================================================
--- trunk/Open-ILS/src/extras/import/marc_add_ids	2010-07-06 16:14:32 UTC (rev 16854)
+++ trunk/Open-ILS/src/extras/import/marc_add_ids	2010-07-06 17:12:25 UTC (rev 16855)
@@ -65,15 +65,8 @@
 	try {
 		my $r = MARC::Record->new_from_xml($partlist{marc});
 
-		my %sfmap;
-		$sfmap{a} = $partlist{tcn_value} if ($partlist{tcn_value});
-		$sfmap{b} = $partlist{tcn_source} if ($partlist{tcn_source});
-		$sfmap{c} = $partlist{id} if ($partlist{id});
 
-		my $f = MARC::Field->new(901 => ' ' => ' ' => %sfmap);
-		$r->delete_field($_) for ($r->field('901'));
-		$r->append_fields( $f );
-
+        # XXX the following wil likely be subsumed by an in-db process, as the 901 was
         if ($set_001_003) {
             my $old_001 = $r->field('001');
             if ($old_001) {

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Cat/BibCommon.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Cat/BibCommon.pm	2010-07-06 16:14:32 UTC (rev 16854)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Cat/BibCommon.pm	2010-07-06 17:12:25 UTC (rev 16855)
@@ -230,8 +230,6 @@
 	my $editor = shift;
 	my $existing_rec = shift;
 
-	my $add_901 = 0;
-
 	my $xpath = '//marc:datafield[@tag="901"]/marc:subfield[@code="a"]';
 	my ($tcn) = $marcxml->documentElement->findvalue($xpath) =~ /(\w+)\s*$/o;
 
@@ -249,8 +247,6 @@
 
 	if(_tcn_exists($editor, $tcn, $tcn_source, $existing_rec)) {
 		$tcn = undef;
-	} else {
-		$add_901++;
 	}
 
 
@@ -289,32 +285,6 @@
 	}
 
 	return undef unless $tcn;
-
-	if ($add_901) {
-		my $df = $marcxml->createElementNS( 'http://www.loc.gov/MARC21/slim', 'datafield');
-		$df->setAttribute( tag => '901' );
-		$df->setAttribute( ind1 => ' ' );
-		$df->setAttribute( ind2 => ' ' );
-		$marcxml->documentElement->appendChild( $df );
-
-		my $sfa = $marcxml->createElementNS( 'http://www.loc.gov/MARC21/slim', 'subfield');
-		$sfa->setAttribute( code => 'a' );
-		$sfa->appendChild( $marcxml->createTextNode( $tcn ) );
-		$df->appendChild( $sfa );
-
-		my $sfb = $marcxml->createElementNS( 'http://www.loc.gov/MARC21/slim', 'subfield');
-		$sfb->setAttribute( code => 'b' );
-		$sfb->appendChild( $marcxml->createTextNode( $tcn_source ) );
-		$df->appendChild( $sfb );
-
-        if ($existing_rec) {
-    		my $sfc = $marcxml->createElementNS( 'http://www.loc.gov/MARC21/slim', 'subfield');
-    		$sfc->setAttribute( code => 'c' );
-	    	$sfc->appendChild( $marcxml->createTextNode( $existing_rec ) );
-		    $df->appendChild( $sfb );
-        }
-	}
-
 	return $tcn;
 }
 

Modified: trunk/Open-ILS/src/perlmods/OpenILS/WWW/Exporter.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/WWW/Exporter.pm	2010-07-06 16:14:32 UTC (rev 16854)
+++ trunk/Open-ILS/src/perlmods/OpenILS/WWW/Exporter.pm	2010-07-06 17:12:25 UTC (rev 16855)
@@ -218,19 +218,8 @@
 		try {
 
 			my $req = MARC::Record->new_from_xml( $bib->marc, $encoding, $format );
-			$req->delete_field( $_ ) for ($req->field(901));
 			$req->encoding($encoding) if ($encoding eq 'UTF-8');
 
-			$req->append_fields(
-				MARC::Field->new(
-					901, '', '', 
-					a => $bib->$tcn_v,
-					b => $bib->$tcn_s,
-					c => $bib->id
-				)
-			);
-
-
 			if ($holdings) {
 				$req->delete_field( $_ ) for ($req->field('852')); # remove any legacy 852s
         			my $cn_list = $bib->call_numbers;

Modified: trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm	2010-07-06 16:14:32 UTC (rev 16854)
+++ trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm	2010-07-06 17:12:25 UTC (rev 16855)
@@ -778,21 +778,8 @@
 		try {
 			my $bib = $supercat->request( "open-ils.supercat.record.object.retrieve", $id )->gather(1)->[0];
         
-			my $r = MARC::Record->new_from_xml( $bib->marc, 'UTF-8', 'USMARC' );
-			$r->delete_field( $_ ) for ($r->field(901));
-                
-			$r->append_fields(
-				MARC::Field->new(
-					901, '', '',
-					a => $bib->tcn_value,
-					b => $bib->tcn_source,
-					c => $bib->id
-				)
-			);
+			print "Content-type: application/octet-stream\n\n" . MARC::Record->new_from_xml( $bib->marc, 'UTF-8', 'USMARC' )->as_usmarc;
 
-			print "Content-type: application/octet-stream\n\n";
-			print $r->as_usmarc;
-
 		} otherwise {
 			warn shift();
 			
@@ -1834,16 +1821,6 @@
 					}
 				}
 
-				$marc->delete_field( $_ ) for ($marc->field(901));
-				$marc->append_fields(
-					MARC::Field->new(
-						901, '', '', 
-						a => $record->tcn_value,
-						b => $record->tcn_source,
-						c => $record->id
-					)
-				);
-
 				# Ensure the data is encoded as UTF8 before we hand it off
 				$marcxml = encode_utf8($marc->as_xml_record());
 				$marcxml =~ s/^<\?xml version="1.0" encoding="UTF-8"\?>//o;

Modified: trunk/Open-ILS/src/support-scripts/marc_export
===================================================================
--- trunk/Open-ILS/src/support-scripts/marc_export	2010-07-06 16:14:32 UTC (rev 16854)
+++ trunk/Open-ILS/src/support-scripts/marc_export	2010-07-06 17:12:25 UTC (rev 16855)
@@ -147,18 +147,6 @@
 	try {
 
 		my $r = MARC::Record->new_from_xml( $bib->marc, $encoding, $format );
-		$r->delete_field( $_ ) for ($r->field(901));
-
-		$r->append_fields(
-			MARC::Field->new(
-				901, '', '', 
-				a => $bib->tcn_value,
-				b => $bib->tcn_source,
-				c => $bib->id
-			)
-		);
-
-
         my $cn_list = $bib->call_numbers;
         if ($cn_list && @$cn_list) {
 



More information about the open-ils-commits mailing list