From da04cc1fac3ac1d18b690945aac4f95bf743a20c Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 10 Aug 2022 11:12:06 +0200 Subject: [PATCH] Bug 31239: Fix incorrect AV linked to a mapped biblio column If an AV is linked to a MARC field mapped with a biblio column, the search_for_data_inconsistencies.pl script might explode with The method Koha::Biblioitem->title is not covered by tests! Trace begun at /kohadevbox/koha/Koha/Object.pm line 875 Koha::Object::AUTOLOAD('Koha::Biblioitem=HASH(0x556b67fa7168)') called at misc/maintenance/search_for_data_inconsistencies.pl line 246 Test plan: For a given framework, pick a biblio using it Link 245$a with an authorised value category Run the script => Notice that with this script applied you will see the warning => Without this patch you got the error Signed-off-by: David Nind Signed-off-by: Marcel de Rooy Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 54711942f1b34fc9d94a61f42734525a03db893a) Signed-off-by: Lucas Gass (cherry picked from commit 2e363d0d0c7d20e9b386473a7e77e2478ba4c015) Signed-off-by: Arthur Suzuki --- misc/maintenance/search_for_data_inconsistencies.pl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/misc/maintenance/search_for_data_inconsistencies.pl b/misc/maintenance/search_for_data_inconsistencies.pl index 22b0889549..d2c32784d5 100755 --- a/misc/maintenance/search_for_data_inconsistencies.pl +++ b/misc/maintenance/search_for_data_inconsistencies.pl @@ -193,7 +193,10 @@ use C4::Biblio qw( GetMarcFromKohaField ); my $kohafield = $v->{kohafield}; my ( $table, $column ) = split '\.', $kohafield; while ( my $i = $items->next ) { - my $value = $table eq 'items' ? $i->$column : $i->biblioitem->$column; + my $value = + $table eq 'items' ? $i->$column + : $table eq 'biblio' ? $i->biblio->$column + : $i->biblioitem->$column; $output .= " {" . $i->itemnumber . " => " . $value . "}"; } new_item( -- 2.20.1