JBAS-1437 Auth linker uses 'KCLS' control number identifer
authorBill Erickson <berickxx@gmail.com>
Thu, 27 Oct 2016 20:22:55 +0000 (16:22 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
Affects bib-to-auth and auth-to-auth linking.

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

index bf0f8ec..2c134e7 100755 (executable)
@@ -54,6 +54,7 @@ my $db_user = $ENV{PGDATABASE} || 'evergreen';
 my $db_pass = $ENV{PGPASSWORD};
 my $links_removed = 0;
 my $links_added = 0;
+my $CNI = 'KCLS';
 
 my %options;
 my $result = GetOptions(
@@ -209,7 +210,6 @@ while (my ($src, $links) = $sth->fetchrow_array) {
                 next;
             }
 
-            my $cni = $target_marc->field('003')->data;
             my $acsaf = get_acsaf($e, $field_id);
             if (!$acsaf) {
                 warn "No authority control set field found for $field_id. Skipping\n";
@@ -254,7 +254,7 @@ while (my ($src, $links) = $sth->fetchrow_array) {
 
                     if ($target_string eq $src_string) {
                         announce("Got a match");
-                        $field->update('0' => "($cni)$target");
+                        $field->update('0' => "($CNI)$target");
                         $changed = 1;
                         $links_added++;
                     }
index c848f5f..5390bb8 100755 (executable)
@@ -49,6 +49,7 @@ my $db_host = $ENV{PGHOST} || 'localhost';
 my $db_port = $ENV{PGPORT} || '5432';
 my $db_user = $ENV{PGDATABASE} || 'evergreen';
 my $db_pass = $ENV{PGPASSWORD};
+my $CNI     = 'KCLS';
 
 my %options;
 my $result = GetOptions(
@@ -822,19 +823,9 @@ foreach my $rec_id (@records) {
                 if ($auth_id) {
                     # Add the auth ID and control number agency info from the 
                     # matching authority record to the controlled bib field.
-
-                    my $auth_003 = $e->json_query({
-                        select => {afr => ['value']},
-                        from => 'afr',
-                        where => {'+afr' => 
-                            {tag => '003', record => $auth_id}}
-                    })->[0];
-
-                    my $cni = $auth_003->{value} || '';
-                    $bib_field->add_subfields('0' => "($cni)$auth_id");
                     $changed = 1;
-
-                    announce("auth=$auth_id cni=$cni.  It's a match!");
+                    $bib_field->add_subfields('0' => "($CNI)$auth_id");
+                    announce("auth=$auth_id cni=$CNI.  It's a match!");
                 }
             }
         }