Koha-clms/misc/migration_tools
Jan Kissig 08a906d95b
Bug 41681: (follow-up) Fix record number count when broken records are processed
When running the script bulkmarcimport.pl, the number of MARC records reported at the end of the execution does not match the actual number of records processed from the input file.

This patch fixes 3 issues
- broken (invalid) records from batch get now counted (record_number)
- when using the number param (n) to limit the number of records to be processed valid and invalid records get counted
- when using th offset param (o) the scipt errored when broken records were part of the offset.

To test:

1. Download the MARC file with the broken record
2. Run the following import commands and compare the counted import numbers:
  a) all records
     perl misc/migration_tools/bulkmarcimport.pl -b -v -m MARCXML --file 2_records_1st_broken.xml
     1 MARC records done in 0.0421221256256104 seconds
  b) limit to 1 record in total
     perl misc/migration_tools/bulkmarcimport.pl -b -v -n 1 -m MARCXML --file 2_records_1st_broken.xml
     1 MARC records done in 0.0420489311218262 seconds
  c) limit to 1 record  offset 1 record
     perl misc/migration_tools/bulkmarcimport.pl -b -v -n 1 -o 1 -m MARCXML --file 2_records_1st_broken.xml
     :2: parser error : Opening and ending tag mismatch: leader2 line 2 and leader
  <leader2>00216nam a22001097a 4500</leader>

3. Apply the patch
4. Repeat steps in 2 and compare the results
  a) 2 MARC records done in 0.0405838489532471 seconds
  b) 1 MARC records done in 0.00948596000671387 seconds  *
  c) 1 MARC records done in 0.0294840335845947 seconds

*though this one was skipped

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
2026-07-28 14:32:46 +00:00
..
22_to_30 Bug 39325: Manual fixes 2025-04-28 18:51:23 +02:00
ifla Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
buildCOUNTRY.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
buildEDITORS.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
buildLANG.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
build_oai_sets.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
bulkmarcimport.pl Bug 41681: (follow-up) Fix record number count when broken records are processed 2026-07-28 14:32:46 +00:00
checkNonIndexedBiblios.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
create_analytical_rel.pl Bug 42764: Fix spelling errors across the codebase 2026-06-03 16:09:04 +00:00
import_lexile.pl Bug 41076: Adjust our perl tidiness for v20250105 2026-02-05 09:03:51 -07:00
koha-svc.pl Bug 41076: Adjust our perl tidiness for v20250105 2026-02-05 09:03:51 -07:00
rebuild_zebra.pl Bug 42185: Remove C4::Context::_new_dbh 2026-04-29 09:08:59 -06:00
rebuild_zebra_sliced.sh Bug 13660: Exclude export phase and use existing exported MARCXML - rebuild_zebra_sliced.sh 2018-01-09 17:23:50 -03:00
remove_unused_authorities.pl Bug 42714: Remove redundant manual cronlogaction calls from scripts 2026-07-28 14:32:32 +00:00
switch_marc21_series_info.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
upgradeitems.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00