From a2cbbb4e1d091d41b75700f153976e470b72e18d Mon Sep 17 00:00:00 2001 From: David Cook Date: Tue, 18 Aug 2020 12:20:32 +1000 Subject: [PATCH] Bug 26231: Remove incorrect use of AddAuthority() when 001 present This patch removes the use of AddAuthority with a non-empty authid argument, since that triggers an update rather than an insert. In practice, the update also fails, but the error isn't raised, as the database connection doesn't have RaiseError set. Test plan: 1) Do not apply patch 2) Try to bulkmarcimport an authority file with a 001 3) Observe that the script reports success but no authority is added 4) Apply the path 5) Try to bulkmarcimport an authority file with a 001 6) Observe that the script reports success and the authority is added Signed-off-by: Kyle M Hall Signed-off-by: Julian Maurice Signed-off-by: Jonathan Druart (cherry picked from commit 9622561636387ced932cc31e285d13cdba607c47) Signed-off-by: Lucas Gass (cherry picked from commit 276602aadbdb27cbec780c9564b93ccd0c1961b6) Signed-off-by: Aleisha Amohia (cherry picked from commit be9eeef3c9cc746e25a44b362d4d78a3739e4fb5) Signed-off-by: Victor Grousset/tuxayo --- misc/migration_tools/bulkmarcimport.pl | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/misc/migration_tools/bulkmarcimport.pl b/misc/migration_tools/bulkmarcimport.pl index 6e34974231..72578e61c2 100755 --- a/misc/migration_tools/bulkmarcimport.pl +++ b/misc/migration_tools/bulkmarcimport.pl @@ -395,17 +395,6 @@ RECORD: while ( ) { printlog({id=>$originalid||$id||$authid, op=>"edit",status=>"ok"}) if ($logfile); } } - elsif (defined $authid) { - ## An authid is defined but no authority in database : add - eval { ( $authid ) = AddAuthority($record,$authid, $authtypecode) }; - if ($@){ - warn "Problem with authority $authid Cannot Add ".$@; - printlog({id=>$originalid||$id||$authid, op=>"insert",status=>"ERROR"}) if ($logfile); - } - else{ - printlog({id=>$originalid||$id||$authid, op=>"insert",status=>"ok"}) if ($logfile); - } - } else { ## True insert in database eval { ( $authid ) = AddAuthority($record,"", $authtypecode) }; -- 2.39.5