remove all the 901 mangling -- handled by the db now
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 6 Jul 2010 17:12:25 +0000 (17:12 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 6 Jul 2010 17:12:25 +0000 (17:12 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@16855 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/extras/import/marc2bre.pl
Open-ILS/src/extras/import/marc_add_ids
Open-ILS/src/perlmods/OpenILS/Application/Cat/BibCommon.pm
Open-ILS/src/perlmods/OpenILS/WWW/Exporter.pm
Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
Open-ILS/src/support-scripts/marc_export

index b0a85cb..e5c9604 100755 (executable)
@@ -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 {
index 6ddb38d..8a74d96 100755 (executable)
@@ -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) {
index c19c5b9..4769f09 100644 (file)
@@ -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;
 }
 
index f39288a..56d59ba 100644 (file)
@@ -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;
index 8d0c174..65d4eae 100644 (file)
@@ -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;
index b8c0a4f..c2ed646 100755 (executable)
@@ -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) {