From d4c11de65d4fe41c8406e6629426370f88e8ee3d Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Thu, 27 Feb 2025 17:12:04 +0000 Subject: [PATCH] Bug 26744: (QA follow up) Tidy Signed-off-by: Lucas Gass Signed-off-by: Katrin Fischer --- Koha/Patron.pm | 18 +++++++++--------- t/db_dependent/Koha/Patron/Attribute.t | 8 ++++---- tools/modborrowers.pl | 7 +++---- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/Koha/Patron.pm b/Koha/Patron.pm index 4ae67541a2..3c4099f983 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -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 } ) ); } diff --git a/t/db_dependent/Koha/Patron/Attribute.t b/t/db_dependent/Koha/Patron/Attribute.t index 487dfce9fe..c4b57e19f4 100755 --- a/t/db_dependent/Koha/Patron/Attribute.t +++ b/t/db_dependent/Koha/Patron/Attribute.t @@ -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( diff --git a/tools/modborrowers.pl b/tools/modborrowers.pl index e6608a15bc..df1861f5ea 100755 --- a/tools/modborrowers.pl +++ b/tools/modborrowers.pl @@ -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 }; };