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:
Lucas Gass 2025-02-27 17:12:04 +00:00 committed by Katrin Fischer
parent 6401f56ac6
commit d4c11de65d
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834
3 changed files with 16 additions and 17 deletions

View file

@ -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 } )
);
}

View file

@ -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(

View file

@ -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 };
};