From ed24da7e0f7e42fbd31183087e7b76179bc77984 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 30 Oct 2025 18:17:47 +0000 Subject: [PATCH] Bug 41147: Don't double count records This patch prevents double counting records as we process them To test: 1 - Export a single record from Koha in marcxml format 2 - perl misc/migration_tools/bulkmarcimport.pl -b -v -m MARCXML --file record.marcxml 3 - Note it says "3 MARC records processed" 4 - Apply patch 5 - Repeat 6 - 1 record processed --- misc/migration_tools/bulkmarcimport.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/misc/migration_tools/bulkmarcimport.pl b/misc/migration_tools/bulkmarcimport.pl index cd5fa255a6e..88c42e61e3f 100755 --- a/misc/migration_tools/bulkmarcimport.pl +++ b/misc/migration_tools/bulkmarcimport.pl @@ -329,7 +329,9 @@ $schema->txn_begin; RECORD: while () { my $record; - $record_number++; + $record_number++ + ; # We increment here, if a record is skipped because we can't load form the batch or can't be converted + # it still counts against the limit if a number to process is passed # get record eval { $record = $batch->next() }; @@ -345,7 +347,6 @@ RECORD: while () { next; } if ($record) { - $record_number++; if ($skip_bad_records) { my $xml = $record->as_xml_record(); -- 2.39.5