From 82ef4d2dd29c0de4de4df35c813f5f1b19dc2769 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Sat, 28 Feb 2026 17:13:31 +0000 Subject: [PATCH] Bug 35104: Display non-XML stripping warnings on biblio detail pages When a bibliographic record has nonxml_stripped errors recorded in biblio_metadata_errors, display a warning banner on both the normal detail page (catalogue/detail.pl) and the MARC detail page (catalogue/MARCdetail.pl) so that staff are aware the stored record may differ from the original data. Sponsored-by: OpenFifth --- catalogue/MARCdetail.pl | 5 +++++ catalogue/detail.pl | 5 +++++ .../prog/en/modules/catalogue/MARCdetail.tt | 10 ++++++++++ .../intranet-tmpl/prog/en/modules/catalogue/detail.tt | 10 ++++++++++ 4 files changed, 30 insertions(+) diff --git a/catalogue/MARCdetail.pl b/catalogue/MARCdetail.pl index 72cf4807c4a..dbc3b42203a 100755 --- a/catalogue/MARCdetail.pl +++ b/catalogue/MARCdetail.pl @@ -121,6 +121,11 @@ if ( $query->cookie("searchToOrder") ) { } $template->param( ocoins => $biblio_object->get_coins ); +my $nonxml_errors = $biblio_object->metadata->metadata_errors->search( { error_type => 'nonxml_stripped' } ); +if ( $nonxml_errors->count ) { + my @messages = map { $_->message } $nonxml_errors->as_list; + $template->param( nonxml_stripped => join( "\n", @messages ) ); +} #count of item linked my $itemcount = $biblio_object->items->count; diff --git a/catalogue/detail.pl b/catalogue/detail.pl index d6ff6220315..b74fcb382a7 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -177,6 +177,11 @@ my $marcflavour = C4::Context->preference("marcflavour"); $template->param( 'SpineLabelShowPrintOnBibDetails' => C4::Context->preference("SpineLabelShowPrintOnBibDetails") ); $template->param( ocoins => !$invalid_marc_record ? $biblio->get_coins : undef ); +my $nonxml_errors = $biblio->metadata->metadata_errors->search( { error_type => 'nonxml_stripped' } ); +if ( $nonxml_errors->count ) { + my @messages = map { $_->message } $nonxml_errors->as_list; + $template->param( nonxml_stripped => join( "\n", @messages ) ); +} # some useful variables for enhanced content; # in each case, we're grabbing the first value we find in diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/MARCdetail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/MARCdetail.tt index 66a5774709d..dcf6fd84ae5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/MARCdetail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/MARCdetail.tt @@ -68,6 +68,16 @@

+ [% IF nonxml_stripped %] +
+

Record was automatically modified

+

Non-XML characters were stripped from this record when it was last saved. Please review and re-save the record to confirm the data + is correct.

+
[% nonxml_stripped | html %]
+
+ [% END %] [% IF ( ocoins ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index 763cda06baf..6c1d78ad720 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -102,6 +102,16 @@
+ [% IF nonxml_stripped %] +
+

Record was automatically modified

+

Non-XML characters were stripped from this record when it was last saved. Please review and re-save the record to + confirm the data is correct.

+
[% nonxml_stripped | html %]
+
+ [% END %] [% IF decoding_error || analytics_error %]

Errors found

-- 2.53.0