Bug 26744: (QA follow up) Tidy
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
6401f56ac6
commit
d4c11de65d
3 changed files with 16 additions and 17 deletions
|
@ -2238,29 +2238,29 @@ sub add_extended_attribute {
|
|||
my ( $self, $attribute ) = @_;
|
||||
|
||||
my $change;
|
||||
if (C4::Context->preference("BorrowersLog")) {
|
||||
my @attribute_values_before = map { $_->attribute }
|
||||
$self->extended_attributes->search({ 'me.code' => $attribute->{code} })->as_list;
|
||||
my @attribute_values_after = sort ($attribute->{attribute}, @attribute_values_before);
|
||||
if ( C4::Context->preference("BorrowersLog") ) {
|
||||
my @attribute_values_before =
|
||||
map { $_->attribute } $self->extended_attributes->search( { 'me.code' => $attribute->{code} } )->as_list;
|
||||
my @attribute_values_after = sort ( $attribute->{attribute}, @attribute_values_before );
|
||||
$change = {
|
||||
before => \@attribute_values_before,
|
||||
after => \@attribute_values_after
|
||||
}
|
||||
after => \@attribute_values_after
|
||||
};
|
||||
}
|
||||
|
||||
my $added_attribute = Koha::Patron::Attribute->new(
|
||||
my $added_attribute = Koha::Patron::Attribute->new(
|
||||
{
|
||||
%{$attribute},
|
||||
( borrowernumber => $self->borrowernumber ),
|
||||
}
|
||||
)->store;
|
||||
|
||||
if (C4::Context->preference("BorrowersLog")) {
|
||||
if ( C4::Context->preference("BorrowersLog") ) {
|
||||
logaction(
|
||||
"MEMBERS",
|
||||
"MODIFY",
|
||||
$self->borrowernumber,
|
||||
"Patron attribute " . $attribute->{code} . ": " . to_json($change, { pretty => 1, canonical => 1 })
|
||||
"Patron attribute " . $attribute->{code} . ": " . to_json( $change, { pretty => 1, canonical => 1 } )
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -743,13 +743,13 @@ subtest 'action log tests' => sub {
|
|||
|
||||
my $attribute = {
|
||||
attribute => 'Qux',
|
||||
code => $attribute_type->code,
|
||||
code => $attribute_type->code,
|
||||
};
|
||||
$patron->add_extended_attribute($attribute);
|
||||
|
||||
$info = $get_info->(
|
||||
['Foo', 'Bar', 'Baz'],
|
||||
['Foo', 'Bar', 'Baz', 'Qux'],
|
||||
[ 'Foo', 'Bar', 'Baz' ],
|
||||
[ 'Foo', 'Bar', 'Baz', 'Qux' ],
|
||||
$attribute_type->code,
|
||||
1
|
||||
);
|
||||
|
@ -758,7 +758,7 @@ subtest 'action log tests' => sub {
|
|||
module => "MEMBERS",
|
||||
action => "MODIFY",
|
||||
object => $patron->borrowernumber,
|
||||
info => $info
|
||||
info => $info
|
||||
}
|
||||
);
|
||||
is(
|
||||
|
|
|
@ -445,16 +445,15 @@ if ( $op eq 'cud-do' ) {
|
|||
|
||||
# The attribute is disabled, we remove it for this borrower !
|
||||
if ( !$attributes->{$code}->{disabled} ) {
|
||||
push @extended_attributes, { code => $code, attribute => $_}
|
||||
for @{ $attributes->{$code}->{values} };
|
||||
push @extended_attributes, { code => $code, attribute => $_ } for @{ $attributes->{$code}->{values} };
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
$patron->extended_attributes(\@extended_attributes);
|
||||
$patron->extended_attributes( \@extended_attributes );
|
||||
} catch {
|
||||
my $message = blessed $_ ? $_->full_message() : $_;
|
||||
my $message = blessed $_ ? $_->full_message() : $_;
|
||||
push @errors, { error => $message };
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue