Bug 35104: Add biblio_metadata_errors table for per-fault error tracking

Adds biblio_metadata_errors to record individual faults (non-XML
characters, empty datafields, ...) found and recovered when saving a
bibliographic record's MARCXML, so they can be surfaced to
cataloguers and explicitly resolved once reviewed.

Signed-off-by: Baptiste Bayche <baptiste.bayche@inlibro.com>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
Sponsored-by: OpenFifth
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Martin Renvoize 2026-07-08 12:23:42 +01:00 committed by Pedro Amorim
parent 1ffbc32ad2
commit 22b4acf8d2
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
2 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,31 @@
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',
`tag` varchar(3) DEFAULT NULL COMMENT 'MARC tag affected, if applicable',
`subfield` varchar(1) DEFAULT NULL COMMENT 'MARC subfield code affected, if applicable',
`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_success( $out, "Added new table 'biblio_metadata_errors'" );
}
},
};

View File

@ -1160,6 +1160,27 @@ 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',
`tag` varchar(3) DEFAULT NULL COMMENT 'MARC tag affected, if applicable',
`subfield` varchar(1) DEFAULT NULL COMMENT 'MARC subfield code affected, if applicable',
`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`
--