From ae72338e47086a71962c1b0dae8a1b486a9c36f2 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Thu, 12 Sep 2024 16:43:53 +0000 Subject: [PATCH] Bug 37398: Make sure subfield and subfield_date are defined Signed-off-by: Phil Ringnalda --- Koha/UI/Form/Builder/Item.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Koha/UI/Form/Builder/Item.pm b/Koha/UI/Form/Builder/Item.pm index 669fd27d6c..5c2dbb82ea 100644 --- a/Koha/UI/Form/Builder/Item.pm +++ b/Koha/UI/Form/Builder/Item.pm @@ -147,11 +147,11 @@ sub generate_subfield_form { } } - if ($subfield->{kohafield} =~ /items\.(replacementpricedate|dateaccessioned|datelastborrowed|onloan)/) { + if ( defined $subfield->{kohafield} && $subfield->{kohafield} =~ /items\.(replacementpricedate|dateaccessioned|datelastborrowed|onloan)/) { $subfield_data{datetype} = 'date'; } - if ($subfield->{kohafield} =~ /items\.(datelastseen|damaged_on|itemlost_on|withdrawn_on|deleted_on)/) { + if ( defined $subfield->{kohafield} && $subfield->{kohafield} =~ /items\.(datelastseen|damaged_on|itemlost_on|withdrawn_on|deleted_on)/) { $subfield_data{datetype} = 'datetime'; } @@ -319,14 +319,14 @@ sub generate_subfield_form { authtypecode => $subfield->{authtypecode}, }; } - elsif ( $subfield_data{datetype} eq 'date' ) { + elsif ( defined $subfield_data{datetype} && $subfield_data{datetype} eq 'date' ) { $subfield_data{marc_value} = { type => 'date_field', id => $subfield_data{id}, value => $value, } } - elsif ( $subfield_data{datetype} eq 'datetime' ) { + elsif ( defined $subfield_data{datetype} && $subfield_data{datetype} eq 'datetime' ) { $subfield_data{marc_value} = { type => 'datetime_field', id => $subfield_data{id}, -- 2.44.0