From 4bcb5a0d885a308ef9e0992706c5db2db720df7a Mon Sep 17 00:00:00 2001 From: Srdjan Date: Fri, 1 Nov 2013 21:24:11 +1300 Subject: [PATCH] Bug 11184: correct attribute cloning for the patron editor This patch fixes Perl warnings logged when setting up the patron attribute form in the patron editor. To test - Patron details entry page: * Have ExtendedPatronAttributes enabled. Check that "Additional attributes and identifiers" section behaves. * Verify that editing and saving a patron record does not result in the following sorts of entries in the Apache log: se of uninitialized value $_ in hash element at memberentry.pl line 798 Use of uninitialized value in anonymous hash ({}) at memberentry.pl line 798 Signed-off-by: Jonathan Druart Signed-off-by: Katrin Fischer Tested with different types of patron attributes: - repeatable - linked to an authorized value - free text Tested editing, adding, removing one of multiple, adding multiple, etc. No regressions found. Passes all tests and QA script. Signed-off-by: Galen Charlton (cherry picked from commit 3334f03d779dc41bac3fe6e25a0d08733fc030ca) Signed-off-by: Fridolin Somers --- members/memberentry.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/members/memberentry.pl b/members/memberentry.pl index 0bb6220ac6..b79398bccc 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -797,7 +797,7 @@ sub patron_attributes_form { }; if (exists $attr_hash{$attr_type->code()}) { foreach my $attr (@{ $attr_hash{$attr_type->code()} }) { - my $newentry = { map { $_ => $entry->{$_} } %$entry }; + my $newentry = { %$entry }; $newentry->{value} = $attr->{value}; $newentry->{password} = $attr->{password}; $newentry->{use_dropdown} = 0; @@ -811,7 +811,7 @@ sub patron_attributes_form { } } else { $i++; - my $newentry = { map { $_ => $entry->{$_} } %$entry }; + my $newentry = { %$entry }; if ($attr_type->authorised_value_category()) { $newentry->{use_dropdown} = 1; $newentry->{auth_val_loop} = GetAuthorisedValues($attr_type->authorised_value_category()); -- 2.39.5