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('<subfield code',CHAR(27),'="c">OSt</subfield>')) 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 <phil@chetcolibrary.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 8c66e6ef72)
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
This commit is contained in:
Nick Clemens 2026-05-01 14:57:02 +00:00 committed by Baptiste Wojtkowski
parent 1acdd1f996
commit 106675e28e
No known key found for this signature in database
GPG Key ID: 47A8A13E10BC0D40
1 changed files with 1 additions and 1 deletions

View File

@ -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} };
}