From 80d3358ba8f9cadce8859161a54c4def11280726 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Tue, 24 Jan 2017 10:42:49 +0100 Subject: [PATCH] Bug 17980: Fix wrong call to ModZebra in AddAuthority (affects Elastic Search users) Content-Type: text/plain; charset=utf-8 The ModZebra call in AddAuthority incorrectly passes five parameters to ModZebra including $oldRecord. This makes the last parameter (the new record) being ignored !! A closer inspection of ModZebra reveals that this only affects installs using Elastic Search. The record parameter is ignored when you still use Zebra. Note: Keep in mind that AddAuthority is being used in adding as well as modifying authority records. This patch is part of a larger effort to make improvements in this area and will not be last one. Please help to get this further (see bug 17908). Trivial fix. Test plan: [1] If you use Elastic Search, verify that the new authority record is being indexed, not the old one. [2] If you do not use Elastic Search, add or modify an authority and search for this change in Authority (Search entire record). --- C4/AuthoritiesMarc.pm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index 0c410a2..12acee7 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -664,7 +664,6 @@ sub AddAuthority { } my $auth_exists=0; - my $oldRecord; if (!$authid) { my $sth=$dbh->prepare("select max(authid) from auth_header"); $sth->execute; @@ -680,7 +679,6 @@ sub AddAuthority { # warn "auth_exists = $auth_exists"; } if ($auth_exists>0){ - $oldRecord=GetAuthority($authid); $record->add_fields('001',$authid) unless ($record->field('001')); # warn "\n\n\n enregistrement".$record->as_formatted; my $sth=$dbh->prepare("update auth_header set authtypecode=?,marc=?,marcxml=? where authid=?"); @@ -693,7 +691,7 @@ sub AddAuthority { $sth->finish; logaction( "AUTHORITIES", "ADD", $authid, "authority" ) if C4::Context->preference("AuthoritiesLog"); } - ModZebra($authid,'specialUpdate',"authorityserver",$oldRecord,$record); + ModZebra( $authid, 'specialUpdate', 'authorityserver', $record ); return ($authid); } -- 2.1.4