From b15a4471c0c6e465dae67daaf0d8cbacca548854 Mon Sep 17 00:00:00 2001 From: David Gustafsson Date: Thu, 17 Sep 2020 14:10:51 +0200 Subject: [PATCH] Strip items when adding new biblio to preserve previous behaviour of the script https://bugs.koha-community.org/show_bug.cgi?id=25539 --- misc/migration_tools/bulkmarcimport.pl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/misc/migration_tools/bulkmarcimport.pl b/misc/migration_tools/bulkmarcimport.pl index 5e4702449a..2a8ed01c33 100755 --- a/misc/migration_tools/bulkmarcimport.pl +++ b/misc/migration_tools/bulkmarcimport.pl @@ -468,7 +468,15 @@ RECORD: while ( ) { } } else { if ($insert) { - eval { ( $biblionumber, $biblioitemnumber ) = AddBiblio( $record, '') }; + my $record_clone = $record->clone(); + my $_framework = ''; + C4::Biblio::_strip_item_fields($record_clone, $_framework ); + eval { ( $biblionumber, $biblioitemnumber ) = AddBiblio( $record_clone, $_framework ) }; + # If incoming record has bib ids set we need to transfer + # new ids from record_clone to incoming record to avoid + # working on wrong record (the original record) later on + # when adding items for example + C4::Biblio::_koha_marc_update_bib_ids($record, $_framework, $biblionumber, $biblioitemnumber); if ($@) { warn "ERROR: Adding biblio $biblionumber failed: $@\n"; printlog( { id => $id || $originalid || $biblionumber, op => "insert", status => "ERROR" } ) if ($logfile); -- 2.20.1