Bugzilla – Attachment 178841 Details for
Bug 26744
Log changes to extended patron attributes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26744: (QA follow up) Tidy
Bug-26744-QA-follow-up-Tidy.patch (text/plain), 4.08 KB, created by
Lucas Gass (lukeg)
on 2025-02-28 15:25:10 UTC
(
hide
)
Description:
Bug 26744: (QA follow up) Tidy
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2025-02-28 15:25:10 UTC
Size:
4.08 KB
patch
obsolete
>From 14317dfa8a4ca3a5f001d985ce72b8ed9d171ce8 Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Thu, 27 Feb 2025 17:12:04 +0000 >Subject: [PATCH] Bug 26744: (QA follow up) Tidy > >Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> >--- > 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 4ae67541a2e..3c4099f9839 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 487dfce9fed..c4b57e19f45 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 e6608a15bc4..df1861f5ea5 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 }; > }; > >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 26744
:
163957
|
163958
|
163959
|
164034
|
164035
|
164098
|
165212
|
165213
|
165301
|
165302
|
165303
|
165304
|
165305
|
177605
|
177652
|
178728
|
178771
|
178787
|
178788
|
178789
|
178801
|
178802
|
178803
|
178817
|
178839
|
178840
| 178841 |
178842
|
179284
|
179285
|
179286