From 443306b0d69d728e0e0b98516f442f1be005b271 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 26 Feb 2026 13:30:55 +0000 Subject: [PATCH] Bug 35104: Warn and log when non-XML characters are stripped in bulkmarcimport Pass a per-record warnings arrayref through the ModBiblio/AddBiblio options so that any nonxml_stripped events are captured and reported via print STDERR and via printlog() to the import log file. Sponsored-by: OpenFifth --- misc/migration_tools/bulkmarcimport.pl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/misc/migration_tools/bulkmarcimport.pl b/misc/migration_tools/bulkmarcimport.pl index 147aa57118c..76505928174 100755 --- a/misc/migration_tools/bulkmarcimport.pl +++ b/misc/migration_tools/bulkmarcimport.pl @@ -562,6 +562,9 @@ RECORD: while () { } # Create biblio, unless we already have it (either match or ISBN) + my @import_warnings; + $mod_biblio_options->{warnings} = \@import_warnings; + $add_biblio_options->{warnings} = \@import_warnings; if ($matched_record_id) { eval { $biblioitemnumber = Koha::Biblios->find($matched_record_id)->biblioitem->biblioitemnumber; }; if ($update) { @@ -622,6 +625,17 @@ RECORD: while () { ) if ($logfile); next RECORD; } + for my $w ( grep { $_->{type} eq 'nonxml_stripped' } @import_warnings ) { + warn sprintf( "WARNING: Non-XML characters stripped from biblio %s: %s\n", + $record_id // $originalid, $w->{message} ); + printlog( + { + id => $record_id // $originalid, + op => "import", + status => "warning : non-XML characters stripped" + } + ) if ($logfile); + } my $record_has_added_items = 0; if ($record_id) { $yamlhash->{$originalid} = $record_id if $yamlfile; -- 2.53.0