From 031dd035ab7c7f8a4b05f5f139942e4dceb7aeb7 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 12 Apr 2021 11:08:01 +0200 Subject: [PATCH] Bug 27857: Fix Pseudonymization.t t/db_dependent/Koha/Pseudonymization.t .. 2/3 # Failed test 'Attribute 1 should be retrieved correctly' # at t/db_dependent/Koha/Pseudonymization.t line 198. # Structures begin differing at: # $got->{borrowernumber} = Does not exist # $expected->{borrowernumber} = '58' # Failed test 'Attribute 2 should be retrieved correctly' # at t/db_dependent/Koha/Pseudonymization.t line 204. # Structures begin differing at: # $got->{borrowernumber} = Does not exist # $expected->{borrowernumber} = '58' # Looks like you failed 2 tests of 3. t/db_dependent/Koha/Pseudonymization.t .. 3/3 Highlighted by commit 7b40ee22035210e3fbdfe75785d68ca314285409 Bug 27857: Make Koha::Patron->extended_attributes validate data Koha::Patron->add_extended_attributes should not modify the $attribute hashref parameter we passed. Signed-off-by: Jonathan Druart --- Koha/Patron.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Koha/Patron.pm b/Koha/Patron.pm index 7630ce72a5..a538533726 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -1539,8 +1539,14 @@ sub generate_userid { sub add_extended_attribute { my ($self, $attribute) = @_; - $attribute->{borrowernumber} = $self->borrowernumber; - return Koha::Patron::Attribute->new($attribute)->store; + + return Koha::Patron::Attribute->new( + { + %$attribute, + ( borrowernumber => $self->borrowernumber ), + } + )->store; + } =head3 extended_attributes -- 2.39.5