diff --git a/Koha/Patron/Modification.pm b/Koha/Patron/Modification.pm index 63100e72bd..51f182a80b 100644 --- a/Koha/Patron/Modification.pm +++ b/Koha/Patron/Modification.pm @@ -131,17 +131,18 @@ sub approve { ); } foreach my $attr ( @{$extended_attributes} ) { + $attr->{attribute} = exists $attr->{attribute} ? $attr->{attribute} : $attr->{value}; Koha::Patron::Attribute->new( { borrowernumber => $patron->borrowernumber, code => $attr->{code}, - attribute => $attr->{value} + attribute => $attr->{attribute}, } )->store - if $attr->{value} # there's a value + if $attr->{attribute} # there's a value or - ( defined $attr->{value} # there's a value that is 0, and not - && $attr->{value} ne "" # the empty string which means delete - && $attr->{value} == 0 + ( defined $attr->{attribute} # there's a value that is 0, and not + && $attr->{attribute} ne "" # the empty string which means delete + && $attr->{attribute} == 0 ); } } diff --git a/Koha/Patron/Modifications.pm b/Koha/Patron/Modifications.pm index e29079ca2e..1ca0ab1163 100644 --- a/Koha/Patron/Modifications.pm +++ b/Koha/Patron/Modifications.pm @@ -131,7 +131,7 @@ sub pending { Koha::Patron::Attribute->new( { borrowernumber => $row->{borrowernumber}, code => $attr->{code}, - attribute => $attr->{value} + attribute => exists $attr->{attribute} ? $attr->{attribute} : $attr->{value}, } ); }