adding a function to force 901 fields to regenerate
authorJames Fournie <jfournie@sitka.bclibraries.ca>
Sat, 10 Sep 2011 03:51:03 +0000 (20:51 -0700)
committerJames Fournie <jfournie@sitka.bclibraries.ca>
Sat, 10 Sep 2011 03:51:03 +0000 (20:51 -0700)
marc_export_custom/marc_export_custom

index c5d564e..e62e199 100755 (executable)
@@ -28,6 +28,7 @@ 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 ($exclusion_ini,$collapse_to_depth);
 my $cfg;
+my $force901;
 
 GetOptions(
         'help'       => \$help,
@@ -42,6 +43,7 @@ GetOptions(
         'xml-idl=s'  => \$idl,
         'encoding=s' => \$encoding,
         'timeout=i'  => \$timeout,
+        'force901'  => \$force901,
         'exclusion_ini=s' => \$exclusion_ini,
         'collapse_to_depth=i' => \$collapse_to_depth,
 
@@ -482,7 +484,6 @@ sub add_bib_holdings {
                                 }
                             }
 
-
                             if($thisorg->parent_ou){
                                  $thisorg = $orgs{$thisorg->parent_ou}
                             } else {
@@ -513,6 +514,19 @@ sub add_bib_holdings {
                         )
                     );
 
+                    if($force901){
+                        $r->delete_field( $r->field('901') );
+                        $r->append_fields(
+                            MARC::Field->new(
+                                '901', ' ', ' ',
+                                a => $bib->tcn_value,
+                                b => $bib->tcn_source,
+                                c => $bib->id
+                            )
+                        );
+
+                    }
+
                     stats() if (! ($count{cp} % 100 ));
                 } # for cnmap
             } # for cnlist