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 ( $self, $attribute ) = @_;
|
||||||
|
|
||||||
my $change;
|
my $change;
|
||||||
if (C4::Context->preference("BorrowersLog")) {
|
if ( C4::Context->preference("BorrowersLog") ) {
|
||||||
my @attribute_values_before = map { $_->attribute }
|
my @attribute_values_before =
|
||||||
$self->extended_attributes->search({ 'me.code' => $attribute->{code} })->as_list;
|
map { $_->attribute } $self->extended_attributes->search( { 'me.code' => $attribute->{code} } )->as_list;
|
||||||
my @attribute_values_after = sort ($attribute->{attribute}, @attribute_values_before);
|
my @attribute_values_after = sort ( $attribute->{attribute}, @attribute_values_before );
|
||||||
$change = {
|
$change = {
|
||||||
before => \@attribute_values_before,
|
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},
|
%{$attribute},
|
||||||
( borrowernumber => $self->borrowernumber ),
|
( borrowernumber => $self->borrowernumber ),
|
||||||
}
|
}
|
||||||
)->store;
|
)->store;
|
||||||
|
|
||||||
if (C4::Context->preference("BorrowersLog")) {
|
if ( C4::Context->preference("BorrowersLog") ) {
|
||||||
logaction(
|
logaction(
|
||||||
"MEMBERS",
|
"MEMBERS",
|
||||||
"MODIFY",
|
"MODIFY",
|
||||||
$self->borrowernumber,
|
$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 = {
|
my $attribute = {
|
||||||
attribute => 'Qux',
|
attribute => 'Qux',
|
||||||
code => $attribute_type->code,
|
code => $attribute_type->code,
|
||||||
};
|
};
|
||||||
$patron->add_extended_attribute($attribute);
|
$patron->add_extended_attribute($attribute);
|
||||||
|
|
||||||
$info = $get_info->(
|
$info = $get_info->(
|
||||||
['Foo', 'Bar', 'Baz'],
|
[ 'Foo', 'Bar', 'Baz' ],
|
||||||
['Foo', 'Bar', 'Baz', 'Qux'],
|
[ 'Foo', 'Bar', 'Baz', 'Qux' ],
|
||||||
$attribute_type->code,
|
$attribute_type->code,
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
|
@ -758,7 +758,7 @@ subtest 'action log tests' => sub {
|
||||||
module => "MEMBERS",
|
module => "MEMBERS",
|
||||||
action => "MODIFY",
|
action => "MODIFY",
|
||||||
object => $patron->borrowernumber,
|
object => $patron->borrowernumber,
|
||||||
info => $info
|
info => $info
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
is(
|
is(
|
||||||
|
|
|
@ -445,16 +445,15 @@ if ( $op eq 'cud-do' ) {
|
||||||
|
|
||||||
# The attribute is disabled, we remove it for this borrower !
|
# The attribute is disabled, we remove it for this borrower !
|
||||||
if ( !$attributes->{$code}->{disabled} ) {
|
if ( !$attributes->{$code}->{disabled} ) {
|
||||||
push @extended_attributes, { code => $code, attribute => $_}
|
push @extended_attributes, { code => $code, attribute => $_ } for @{ $attributes->{$code}->{values} };
|
||||||
for @{ $attributes->{$code}->{values} };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$patron->extended_attributes(\@extended_attributes);
|
$patron->extended_attributes( \@extended_attributes );
|
||||||
} catch {
|
} catch {
|
||||||
my $message = blessed $_ ? $_->full_message() : $_;
|
my $message = blessed $_ ? $_->full_message() : $_;
|
||||||
push @errors, { error => $message };
|
push @errors, { error => $message };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue