Bugzilla – Attachment 194223 Details for
Bug 35104
We should warn when attempting to save MARC records that contain characters invalid in XML
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35104: Display non-XML stripping warnings on biblio detail pages
82ef4d2.patch (text/plain), 4.48 KB, created by
Martin Renvoize (ashimema)
on 2026-03-01 16:23:50 UTC
(
hide
)
Description:
Bug 35104: Display non-XML stripping warnings on biblio detail pages
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2026-03-01 16:23:50 UTC
Size:
4.48 KB
patch
obsolete
>From 82ef4d2dd29c0de4de4df35c813f5f1b19dc2769 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >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 @@ > </select> > </strong></p > > >+ [% IF nonxml_stripped %] >+ <div class="alert alert-warning"> >+ <h1>Record was automatically modified</h1> >+ <p >+ >Non-XML characters were stripped from this record when it was last saved. Please <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% biblionumber | uri %]">review and re-save the record</a> to confirm the data >+ is correct.</p >+ > >+ <pre class="error">[% nonxml_stripped | html %]</pre> >+ </div> >+ [% END %] > [% IF ( ocoins ) %] > <!-- COinS / OpenURL --> > <span class="Z3988" title="[% ocoins | html %]"></span> >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 @@ > <!-- /.row --> > <div class="row"> > <div id="catalogue_detail_biblio" class="col"> >+ [% IF nonxml_stripped %] >+ <div class="alert alert-warning"> >+ <h1>Record was automatically modified</h1> >+ <p >+ >Non-XML characters were stripped from this record when it was last saved. Please <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% biblio.biblionumber | uri %]">review and re-save the record</a> to >+ confirm the data is correct.</p >+ > >+ <pre class="error">[% nonxml_stripped | html %]</pre> >+ </div> >+ [% END %] > [% IF decoding_error || analytics_error %] > <div class="alert alert-warning"> > <h1>Errors found</h1> >-- >2.53.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35104
:
157625
|
157627
|
157628
|
157642
|
159615
|
159620
|
159621
|
159630
|
159810
|
159811
|
159812
|
159813
|
166431
|
173145
|
173146
|
176820
|
176821
|
176850
|
176851
|
176852
|
176860
|
193985
|
193986
|
193987
|
193988
|
193989
|
193990
|
193991
|
193992
|
193993
|
193994
|
193995
|
193996
|
193997
|
193998
|
193999
|
194000
|
194001
|
194004
|
194005
|
194006
|
194007
|
194008
|
194009
|
194010
|
194011
|
194012
|
194013
|
194152
|
194153
|
194154
|
194155
|
194156
|
194157
|
194158
|
194159
|
194160
|
194161
|
194162
|
194163
|
194164
|
194165
|
194166
|
194167
|
194168
|
194169
|
194170
|
194171
|
194172
|
194213
|
194214
|
194215
|
194216
|
194217
|
194218
|
194219
|
194220
|
194221
|
194222
| 194223 |
194224
|
194225
|
194226
|
194227