From bd55628c93f158d9318af291acbfd0cc2e30682a Mon Sep 17 00:00:00 2001 From: miker Date: Tue, 6 Jul 2010 17:12:25 +0000 Subject: [PATCH] remove all the 901 mangling -- handled by the db now git-svn-id: svn://svn.open-ils.org/ILS/trunk@16855 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/extras/import/marc2bre.pl | 13 ++-------- Open-ILS/src/extras/import/marc_add_ids | 9 +------ .../perlmods/OpenILS/Application/Cat/BibCommon.pm | 30 ---------------------- Open-ILS/src/perlmods/OpenILS/WWW/Exporter.pm | 11 -------- Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm | 25 +----------------- Open-ILS/src/support-scripts/marc_export | 12 --------- 6 files changed, 4 insertions(+), 96 deletions(-) diff --git a/Open-ILS/src/extras/import/marc2bre.pl b/Open-ILS/src/extras/import/marc2bre.pl index b0a85cbc25..e5c9604dcb 100755 --- a/Open-ILS/src/extras/import/marc2bre.pl +++ b/Open-ILS/src/extras/import/marc2bre.pl @@ -250,11 +250,9 @@ PROCESS: while ( try { $rec = $batch->next } otherwise { $rec = -1 } ) { } # 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 @@ sub preprocess { 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 { diff --git a/Open-ILS/src/extras/import/marc_add_ids b/Open-ILS/src/extras/import/marc_add_ids index 6ddb38da0d..8a74d9639c 100755 --- a/Open-ILS/src/extras/import/marc_add_ids +++ b/Open-ILS/src/extras/import/marc_add_ids @@ -65,15 +65,8 @@ while (<>) { 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) { diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Cat/BibCommon.pm b/Open-ILS/src/perlmods/OpenILS/Application/Cat/BibCommon.pm index c19c5b952b..4769f095b7 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Cat/BibCommon.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Cat/BibCommon.pm @@ -230,8 +230,6 @@ sub find_free_tcn { 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 @@ sub find_free_tcn { if(_tcn_exists($editor, $tcn, $tcn_source, $existing_rec)) { $tcn = undef; - } else { - $add_901++; } @@ -289,32 +285,6 @@ sub find_free_tcn { } 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; } diff --git a/Open-ILS/src/perlmods/OpenILS/WWW/Exporter.pm b/Open-ILS/src/perlmods/OpenILS/WWW/Exporter.pm index f39288aea7..56d59ba8ce 100644 --- a/Open-ILS/src/perlmods/OpenILS/WWW/Exporter.pm +++ b/Open-ILS/src/perlmods/OpenILS/WWW/Exporter.pm @@ -218,19 +218,8 @@ sub handler { 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; diff --git a/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm b/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm index 8d0c174304..65d4eae0df 100644 --- a/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm +++ b/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm @@ -778,20 +778,7 @@ sub supercat { 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"; - print $r->as_usmarc; + print "Content-type: application/octet-stream\n\n" . MARC::Record->new_from_xml( $bib->marc, 'UTF-8', 'USMARC' )->as_usmarc; } otherwise { warn shift(); @@ -1834,16 +1821,6 @@ sub sru_search { } } - $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; diff --git a/Open-ILS/src/support-scripts/marc_export b/Open-ILS/src/support-scripts/marc_export index b8c0a4f797..c2ed646f2d 100755 --- a/Open-ILS/src/support-scripts/marc_export +++ b/Open-ILS/src/support-scripts/marc_export @@ -147,18 +147,6 @@ while ( my $i = <> ) { 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) { -- 2.11.0