From 1d394dcdcc8f354be0ff48efdcfcbc56b35263fd Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 22 May 2024 10:56:10 +0200 Subject: [PATCH] Bug 36917: Remove some warnings from t/db_dependent/Authority/Merge.t Cannot determine authority type for record: 1709 at /kohadevbox/koha/Koha/SearchEngine/Elasticsearch.pm line 589. Use of uninitialized value $subfields in pattern match (m//) at /kohadevbox/koha/C4/Heading/MARC21.pm line 412. Use of uninitialized value $subfields in pattern match (m//) at /kohadevbox/koha/C4/Heading/MARC21.pm line 448. This change removes the 2 "Use of uninitialized value $subfields in pattern match (m//)" warnings The warnings are gnerated because the subfields for headings are hardcoded variables in C4::Heading::MARC21 for any genuine authority record we should receive the correct list of subfields. The tests in this case are mocking a new authtype, and so do not find the correct subfields. Skipping the generation here silences the warnings and will prevent user defined types from throwing errors as well. NOTE: Koha allows the user to define their own authority types, however, we have various features hardcoded that will prevent them from working as expected WNC amended commit message Signed-off-by: Marcel de Rooy Signed-off-by: Nick Clemens Signed-off-by: Katrin Fischer --- C4/Heading/MARC21.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/C4/Heading/MARC21.pm b/C4/Heading/MARC21.pm index cb422d5c11..4f747d7f92 100644 --- a/C4/Heading/MARC21.pm +++ b/C4/Heading/MARC21.pm @@ -402,6 +402,7 @@ sub _get_search_heading { my $subfields = shift; my $heading = ""; + return $heading unless $subfields; my @subfields = $field->subfields(); my $first = 1; for ( my $i = 0 ; $i <= $#subfields ; $i++ ) { @@ -439,6 +440,7 @@ sub _get_display_heading { my $subfields = shift; my $heading = ""; + return $heading unless $subfields; my @subfields = $field->subfields(); my $first = 1; for ( my $i = 0 ; $i <= $#subfields ; $i++ ) { -- 2.39.5