From 7cac0105f820d1f9cd0d71be3430fdfdd08acca3 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 22 May 2024 11:52:53 +0000 Subject: [PATCH] Bug 36917: (follow-up) Remove Elasticsearch warnings and tidy Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart Signed-off-by: Marcel de Rooy Signed-off-by: Katrin Fischer --- C4/Heading/MARC21.pm | 6 ++++-- t/db_dependent/Authority/Merge.t | 8 ++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/C4/Heading/MARC21.pm b/C4/Heading/MARC21.pm index 4f747d7f92..40a0d15199 100644 --- a/C4/Heading/MARC21.pm +++ b/C4/Heading/MARC21.pm @@ -401,8 +401,9 @@ sub _get_search_heading { my $field = shift; my $subfields = shift; - my $heading = ""; + my $heading = ""; return $heading unless $subfields; + my @subfields = $field->subfields(); my $first = 1; for ( my $i = 0 ; $i <= $#subfields ; $i++ ) { @@ -439,8 +440,9 @@ sub _get_display_heading { my $field = shift; my $subfields = shift; - my $heading = ""; + my $heading = ""; return $heading unless $subfields; + my @subfields = $field->subfields(); my $first = 1; for ( my $i = 0 ; $i <= $#subfields ; $i++ ) { diff --git a/t/db_dependent/Authority/Merge.t b/t/db_dependent/Authority/Merge.t index 5632141dfd..cbd4401f1f 100755 --- a/t/db_dependent/Authority/Merge.t +++ b/t/db_dependent/Authority/Merge.t @@ -28,6 +28,7 @@ BEGIN { # Optionally change marc flavour my $marcflavour; GetOptions( 'flavour:s' => \$marcflavour ); +$marcflavour //= 'MARC21'; t::lib::Mocks::mock_preference( 'marcflavour', $marcflavour ) if $marcflavour; my $schema = Koha::Database->new->schema; @@ -40,6 +41,13 @@ $heading_module->mock( return 1; } ); +my $auth_module = Test::MockModule->new('C4::AuthoritiesMarc'); +$auth_module->mock( + 'GuessAuthTypeCode', + sub { + $marcflavour eq 'MARC21' ? return 'PERSO_NAME' : return 'NP'; + } +); # Global variables, mocking and framework modifications our @linkedrecords; -- 2.39.5