From d456db52489a3fe40fde12f8a4ba892293c862db Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 26 Oct 2016 12:03:21 -0400 Subject: [PATCH] JBAS-1437 Bib ignores 'fast' headings. Avoid any attempts at controlling fields whose thesaurus value (ind2=7 and $2) is 'fast'. Signed-off-by: Bill Erickson --- KCLS/linking/authority_control_fields.pl | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/KCLS/linking/authority_control_fields.pl b/KCLS/linking/authority_control_fields.pl index 414ad7f8c3..c848f5ff0f 100755 --- a/KCLS/linking/authority_control_fields.pl +++ b/KCLS/linking/authority_control_fields.pl @@ -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; -- 2.11.0