From 106675e28e896f207d781b2af85286e29da38d61 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 1 May 2026 14:57:02 +0000 Subject: [PATCH] Bug 42512: Pass already checked/cleaned MARC::Record to Metadata Extractor To test: 1 - In Koha testing docker record 369 has invalid xml, otherwise corrupt a record like: sudo koha-mysql kohadev UPDATE biblio_metadata SET metadata = UpdateXML(metadata, '//datafield[@tag="040"]/subfield[@code="c"]',CONCAT('OSt')) WHERE biblionumber=438; 2 - View the record in the staff client - note bad metadata message http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=438 3 - Click 'Edit' 4 - Error 500, in logs: Invalid data, cannot decode metadata object 5 - Apply patch, restart all 6 - Reload record and click edit 7 - Success! Message about bad metadata, but can edit/save Signed-off-by: Phil Ringnalda Signed-off-by: Martin Renvoize Signed-off-by: Lucas Gass (cherry picked from commit 8c66e6ef7277fef0b5b70e0b3d632f28be8eb904) Signed-off-by: Baptiste Wojtkowski --- cataloguing/addbiblio.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index a8e2720b5c..5b44aaed31 100755 --- a/cataloguing/addbiblio.pl +++ b/cataloguing/addbiblio.pl @@ -833,7 +833,7 @@ if ( $op eq "cud-addbiblio" ) { if ( $biblio && C4::Context->preference('marcflavour') eq 'MARC21' ) { my $fixed_length_info = - Koha::Biblio::Metadata::Extractor::MARC->new( { biblio => $biblio } )->check_fixed_length; + Koha::Biblio::Metadata::Extractor::MARC->new( { metadata => $record } )->check_fixed_length; $template->param( marc21_fixlen => $fixed_length_info ) if @{ $fixed_length_info->{failed} }; }