Use all subfield values to link authority records to bibs
authorMike Rylander <mrylander@gmail.com>
Tue, 29 Oct 2013 15:37:36 +0000 (11:37 -0400)
committerDan Wells <dbw2@calvin.edu>
Fri, 1 Nov 2013 20:09:30 +0000 (16:09 -0400)
Given an Evergreen instance with two authority records loaded, one
being a more specific than the other via a repeated subdivision subfield,
we must make sure that we use all the bib-supplied subfield values when
attempting to auto-link to the correct authority.  Otherwise, the "shorter"
authority record may be selected as appropriate, and data in the bib record
would be lost.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Dan Wells <dbw2@calvin.edu>
Open-ILS/src/support-scripts/authority_control_fields.pl.in

index 83f7db2..046589e 100755 (executable)
@@ -410,14 +410,14 @@ foreach my $rec_id (@records) {
                 my $match_tag;
                 my @searches;
                 foreach my $c_subfield (@c_subfields) {
-                    my $sf = $bib_field->subfield($c_subfield);
-                    if ($sf) {
+                    my @sf_values = $bib_field->subfield($c_subfield);
+                    if (@sf_values) {
                         # Give me the first element of the list of authority controlling tags for this subfield
                         # XXX Will we need to support more than one controlling tag per subfield? Probably. That
                         # will suck. Oh well, leave that up to Ole to implement.
                         $match_subfields{$c_subfield} = (keys %{$controllees{$c_tag}{$c_subfield}})[0];
                         $match_tag = $match_subfields{$c_subfield};
-                        push @searches, {term => $sf, subfield => $c_subfield};
+                        push @searches, map {{term => $_, subfield => $c_subfield}} @sf_values;
                     }
                 }
                 # print Dumper(\%match_subfields);