From 932a913a0098203a136b0eb2c7893a22a8840579 Mon Sep 17 00:00:00 2001 From: Fridolyn SOMERS Date: Fri, 7 Jun 2013 10:17:54 +0200 Subject: [PATCH] Bug 10428: undefined check in add additem.pl In additem.pl, in the code that generates item form you find: @values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)->subfield($subtag))); This patch adds the check of $itemrecord->field($tag) undef. I did not found a way to test it because item tag is always defined when editing an item, but it would be safer/prettier to add this check. Signed-off-by: Kyle M Hall Passed-QA-by: Marcel de Rooy Signed-off-by: Galen Charlton (cherry picked from commit e31b158245f4eff36decebf30c8a87c8cfebe472) Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 54d414ee2d16a2969c91e5a83cb8c66858fed03c) Signed-off-by: Bernardo Gonzalez Kriegel (cherry picked from commit 54d414ee2d16a2969c91e5a83cb8c66858fed03c) Signed-off-by: Chris Hall (cherry picked from commit 3390a6efc74714f6ebd577d06f344acbff001357) --- cataloguing/additem.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 95df89a8cd..4f47cd04bb 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -712,7 +712,7 @@ foreach my $tag ( keys %{$tagslib}){ next if any { /^$tag$subtag$/ } @fields; my @values = (undef); - @values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)->subfield($subtag))); + @values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)) && defined($itemrecord->field($tag)->subfield($subtag))); for my $value (@values){ my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i); push (@loop_data, $subfield_data); -- 2.39.5