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
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'");
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;
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));
}
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);