From d5ebdb75e00180f19d4ef77058e96ea21541bdb3 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 20 Jul 2018 11:46:58 +0200 Subject: [PATCH] Bug 20811: (QA follow-up) Prevent calling AddItemBatchFromMarc and ModBiblioMarc without biblionumber If you use -update but do not find matches (or did not want to match), you should not call those routines. We should warn and skip this record. Adding a warn at the start that the choice of options may not be smart. Note that this needs further attention somewhere else. You could mix -update with -insert for instance and still see some problems. (May depend on items with unique barcode etc.) Test plan: Run -update without match or isbn. Or run -update -isbn with a non-matching ISBN. Signed-off-by: Marcel de Rooy Signed-off-by: Nick Clemens (cherry picked from commit 15b865c6ee558ef278f911ba3693c38c024c7f11) Signed-off-by: Martin Renvoize (cherry picked from commit 8191625667162ac240a5d0e4d180632bcf100884) Signed-off-by: Fridolin Somers (cherry picked from commit c71253eb2ed3824cbc6c7d3972319712d3d5bf03) Signed-off-by: Fridolin Somers --- misc/migration_tools/bulkmarcimport.pl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/misc/migration_tools/bulkmarcimport.pl b/misc/migration_tools/bulkmarcimport.pl index 5b4d6ca526..6231df3d0a 100755 --- a/misc/migration_tools/bulkmarcimport.pl +++ b/misc/migration_tools/bulkmarcimport.pl @@ -95,6 +95,9 @@ if ($version || ($input_marc_file eq '')) { pod2usage( -verbose => 2 ); exit; } +if( $update && ( !$match || $isbn_check ) ) { + warn "Using -update without -match or -isbn seems to be useless.\n"; +} if(defined $localcust) { #local customize module if(!-e $localcust) { @@ -441,7 +444,9 @@ RECORD: while ( ) { printlog( { id => $id || $originalid || $biblionumber, op => "insert", status => "ok" } ) if ($logfile); } } else { + warn "WARNING: Updating record ".($id||$originalid)." failed"; printlog( { id => $id || $originalid || $biblionumber, op => "update", status => "warning : not in database" } ) if ($logfile); + next RECORD; } } eval { ( $itemnumbers_ref, $errors_ref ) = AddItemBatchFromMarc( $record, $biblionumber, $biblioitemnumber, '' ); }; -- 2.39.5