From 1e1c5d17a268c6d493c2c71d4b456da7749655c3 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 12 Nov 2019 11:15:46 +0100 Subject: [PATCH] Bug 23846: Add a check to the data inconsistencies script This may be quite long for big catalogue, but I think it is a good one to have. Test plan: Same as first patch, then execute search_for_data_inconsistencies.pl Notice the error. Signed-off-by: Martin Renvoize Signed-off-by: Tomas Cohen Arazi Signed-off-by: Martin Renvoize --- .../search_for_data_inconsistencies.pl | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/misc/maintenance/search_for_data_inconsistencies.pl b/misc/maintenance/search_for_data_inconsistencies.pl index fa5aa20ba3..3fc6eceb20 100755 --- a/misc/maintenance/search_for_data_inconsistencies.pl +++ b/misc/maintenance/search_for_data_inconsistencies.pl @@ -19,6 +19,7 @@ use Modern::Perl; use Koha::Script; use Koha::Items; +use Koha::Biblios; use Koha::Biblioitems; use Koha::ItemTypes; use Koha::Authorities; @@ -106,6 +107,18 @@ use Koha::Authorities; new_hint("The biblioitems must have a itemtype value that is defined in the item types of Koha (Home › Administration › Item types administration)"); } } + + my @decoding_errors; + my $biblios = Koha::Biblios->search; + while ( my $biblio = $biblios->next ) { + eval{$biblio->metadata->record;}; + push @decoding_errors, $@ if $@; + } + if ( @decoding_errors ) { + new_section("Bibliographic records have invalid MARCXML"); + new_item($_) for @decoding_errors; + new_hint("The bibliographic records must have a valid MARCXML or you will face encoding issues or wrong displays"); + } } sub new_section { @@ -140,5 +153,5 @@ Catch data inconsistencies in Koha database * if item types are defined at item level (item-level_itypes=specific item), then items.itype must be set else biblioitems.itemtype must be set * Item types defined in items or biblioitems must be defined in the itemtypes table - +* Invalid MARCXML in bibliographic records =cut -- 2.39.5