JBAS-1437 Bib ignores 'fast' headings.
authorBill Erickson <berickxx@gmail.com>
Wed, 26 Oct 2016 16:03:21 +0000 (12:03 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
Avoid any attempts at controlling fields whose thesaurus value (ind2=7
and $2) is 'fast'.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
KCLS/linking/authority_control_fields.pl

index 414ad7f..c848f5f 100755 (executable)
@@ -679,6 +679,22 @@ sub find_matching_auth_for_thesaurus {
     return undef;
 }
 
+# Returns true if the thesaurus controlling the bib field is "fast".
+sub is_fast_heading {
+    my $bib_field = shift;
+
+    if ($bib_field->tag() =~ /^65[015]/) {
+        my $ind2 = $bib_field->indicator(2) || '';
+        
+        if ($ind2 eq '7') { # field controlled by "other"
+            my $thesaurus = $bib_field->subfield('2') || '';
+            return $thesaurus eq 'fast';
+        }
+    }
+
+    return 0;
+}
+
 foreach my $rec_id (@records) {
     announce("processing bib record $rec_id");
 
@@ -701,13 +717,21 @@ foreach my $rec_id (@records) {
             # Get the MARCXML from the record and check for controlled fields/subfields
             my @bib_fields = ($marc->field($c_tag));
             foreach my $bib_field (@bib_fields) {
-                # print $_->as_formatted(); 
 
-                if ($refresh and defined(scalar($bib_field->subfield('0')))) {
+                my $sf0 = $bib_field->subfield('0') || '';
+
+                if (is_fast_heading($bib_field)) {
+                    # Ignore all 'fast' headings.
+                    announce("Skipping FAST on rec=$rec_id and tag=$c_tag \$0 $sf0");
+                    next;
+                }
+
+                if ($sf0 && $refresh) {
+                    announce("Removing \$0 $sf0 for rec=$rec_id and tag=$c_tag");
                     $bib_field->delete_subfield(code => '0');
                     $changed = 1;
                 }
-                    
+
                 my %match_subfields;
                 my $match_tag;
                 my @searches;