Bug 20443: Fix patron modification approval
There was a mismatch between "value" and "attribute". Before this patchset, "value" was sometimes used, but then it comes "attribute" to match the DB column's name. We must keep both here, when an upgrade is done we could have "value" that is still in the borrower_modifications.extended_attributes JSON Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
994ea386c3
commit
ea5e9f25e9
|
|
@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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},
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue