From 67aa77c86e6ea9fe567cd7becaa6a420851e5825 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 20 Nov 2015 08:57:05 -0800 Subject: [PATCH] JBAS-980 bib linking minor repairs and logging updates Signed-off-by: Bill Erickson --- KCLS/linking/authority_control_fields.pl | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/KCLS/linking/authority_control_fields.pl b/KCLS/linking/authority_control_fields.pl index 230e9a36bc..577fedb028 100755 --- a/KCLS/linking/authority_control_fields.pl +++ b/KCLS/linking/authority_control_fields.pl @@ -592,7 +592,9 @@ if($input_file) { sub find_matching_auth_for_thesaurus { my ($e, $bib_field, $auth_ids) = @_; - my $cfield_ind2 = $bib_field->indicator(2) || ''; + my $cfield_ind2 = $bib_field->indicator(2); + + announce("6XX indicator 2 value = $cfield_ind2"); if ($cfield_ind2 eq '7') { # subject thesaurus code is embedded in the bib field subfield 2 @@ -600,9 +602,9 @@ sub find_matching_auth_for_thesaurus { my $thesaurus = $bib_field->subfield('2') || ''; announce("Found local thesaurus value $thesaurus"); - $cfield_ind2 = $BIB_SF2_TO_AUTH{$thesaurus} || ''; + $cfield_ind2 = $BIB_SF2_TO_AUTH{$thesaurus}; - if ($cfield_ind2) { + if (defined $cfield_ind2) { announce("Mapped local thesaurus '$thesaurus' to '$cfield_ind2'"); } else { announce("No mapping found for local thesaurus '$thesaurus'"); @@ -620,8 +622,11 @@ sub find_matching_auth_for_thesaurus { my $value = $leader->{value}; next unless $value; my $thesaurus = substr($value, 11, 1); # leader/11 -- zero based. - return $leader->{record} if - $AUTH_TO_BIB_IND2{$thesaurus} eq $cfield_ind2; + if ($AUTH_TO_BIB_IND2{$thesaurus} eq $cfield_ind2) { + announce("Found a match on thesaurus ". + "'$thesaurus' for " . $leader->{record}); + return $leader->{record}; + } } return undef; @@ -645,7 +650,6 @@ foreach my $rec_id (@records) { foreach my $c_tag (@c_fields) { my @c_subfields = keys %{$controllees{"$c_tag"}}; - announce "Inspecting controlled field $c_tag"; # Get the MARCXML from the record and check for controlled fields/subfields my @bib_fields = ($marc->field($c_tag)); @@ -673,8 +677,8 @@ foreach my $rec_id (@records) { } next if !$match_tag; - announce("Searching for matches (auth tag=$match_tag): \n\t". - Dumper(\@searches)); + announce("Searching for matches on controlled field $c_tag ". + "(auth tag=$match_tag): \n - ".Dumper(\@searches)); my @tags = ($match_tag); -- 2.11.0