From 5234aadc12459b0e2b7de058445447fdfd9ff03a Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Wed, 19 Apr 2017 14:44:13 -0300 Subject: [PATCH] Bug 18339: (followup) Remove warnings on adding a patron modification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch removes warnings raised because hash values existence is not checked before comparing them. As the sub is deleting fields that are similar from the modification, I considered the following use cases - Both fields are defined, need to compare values, should delete if they match - One of the fields is defined, the other isn't, discrepancy, should not delete. - Both fields are not defined, they match, should delete. Signed-off-by: Marc VĂ©ron --- opac/opac-memberentry.pl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl index d66fb7a..63ca1ac 100755 --- a/opac/opac-memberentry.pl +++ b/opac/opac-memberentry.pl @@ -452,8 +452,11 @@ sub DelUnchangedFields { my $current_data = GetMember( borrowernumber => $borrowernumber ); foreach my $key ( keys %new_data ) { - if ( $current_data->{$key} eq $new_data{$key} ) { - delete $new_data{$key}; + if ( defined $new_data{ $key } && + defined $current_data->{$key} && + $current_data->{$key} eq $new_data{$key} ) { + + delete $new_data{ $key }; } } -- 2.7.4