Bugzilla – Attachment 194217 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: Add biblio_metadata_errors table
b13a3ea.patch (text/plain), 4.31 KB, created by
Martin Renvoize (ashimema)
on 2026-03-01 16:23:41 UTC
(
hide
)
Description:
Bug 35104: Add biblio_metadata_errors table
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2026-03-01 16:23:41 UTC
Size:
4.31 KB
patch
obsolete
>From b13a3eaddbd8489ef8953265db73b59a0e53d9c5 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >Date: Sat, 28 Feb 2026 17:01:32 +0000 >Subject: [PATCH] Bug 35104: Add biblio_metadata_errors table > >The preceding signed-off commits (69a6b1c09f7..bfb14bb949e) established an >approach where Metadata::store throws a Koha::Exceptions::Metadata::Invalid >exception when non-XML characters are encountered, requiring every caller to >catch and handle the exception explicitly. > >Building on that foundation, we change direction here: instead of throwing, >Metadata::store will strip non-XML characters gracefully on save and persist >structured error details in a new biblio_metadata_errors table. This will give >cataloguers a clear view of which fields were affected, with context snippets >pointing to the exact character positions, and allows them to review and >confirm or correct the data before marking the errors as resolved. > >The new biblio_metadata_errors table supports multiple per-field error records >per metadata row. > >Sponsored-by: OpenFifth >--- > .../data/mysql/atomicupdate/bug_35104.pl | 29 +++++++++++++++++++ > installer/data/mysql/kohastructure.sql | 19 ++++++++++++ > 2 files changed, 48 insertions(+) > create mode 100755 installer/data/mysql/atomicupdate/bug_35104.pl > >diff --git a/installer/data/mysql/atomicupdate/bug_35104.pl b/installer/data/mysql/atomicupdate/bug_35104.pl >new file mode 100755 >index 00000000000..bd52d9ca266 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_35104.pl >@@ -0,0 +1,29 @@ >+use Modern::Perl; >+use Koha::Installer::Output qw(say_warning say_success say_info); >+ >+return { >+ bug_number => "35104", >+ description => "Add biblio_metadata_errors table for normalised error tracking", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ unless ( TableExists('biblio_metadata_errors') ) { >+ $dbh->do( >+ q{ >+ CREATE TABLE `biblio_metadata_errors` ( >+ `id` int(11) NOT NULL AUTO_INCREMENT, >+ `metadata_id` int(11) NOT NULL COMMENT 'FK to biblio_metadata.id', >+ `error_type` varchar(64) NOT NULL COMMENT 'Error type identifier, e.g. nonxml_stripped', >+ `message` mediumtext DEFAULT NULL COMMENT 'Error message details', >+ `created_on` timestamp NOT NULL DEFAULT current_timestamp(), >+ PRIMARY KEY (`id`), >+ KEY `biblio_metadata_errors_fk_1` (`metadata_id`), >+ CONSTRAINT `biblio_metadata_errors_fk_1` FOREIGN KEY (`metadata_id`) REFERENCES `biblio_metadata` (`id`) ON DELETE CASCADE ON UPDATE CASCADE >+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci >+ } >+ ); >+ say $out "Added new table 'biblio_metadata_errors'"; >+ } >+ }, >+}; >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 1222ef6387c..c2fd8639601 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -1159,6 +1159,25 @@ CREATE TABLE `biblio_metadata` ( > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; > /*!40101 SET character_set_client = @saved_cs_client */; > >+-- >+-- Table structure for table `biblio_metadata_errors` >+-- >+ >+DROP TABLE IF EXISTS `biblio_metadata_errors`; >+/*!40101 SET @saved_cs_client = @@character_set_client */; >+/*!40101 SET character_set_client = utf8mb4 */; >+CREATE TABLE `biblio_metadata_errors` ( >+ `id` int(11) NOT NULL AUTO_INCREMENT, >+ `metadata_id` int(11) NOT NULL COMMENT 'FK to biblio_metadata.id', >+ `error_type` varchar(64) NOT NULL COMMENT 'Error type identifier, e.g. nonxml_stripped', >+ `message` mediumtext DEFAULT NULL COMMENT 'Error message details', >+ `created_on` timestamp NOT NULL DEFAULT current_timestamp(), >+ PRIMARY KEY (`id`), >+ KEY `biblio_metadata_errors_fk_1` (`metadata_id`), >+ CONSTRAINT `biblio_metadata_errors_fk_1` FOREIGN KEY (`metadata_id`) REFERENCES `biblio_metadata` (`id`) ON DELETE CASCADE ON UPDATE CASCADE >+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; >+/*!40101 SET character_set_client = @saved_cs_client */; >+ > -- > -- Table structure for table `biblioitems` > -- >-- >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