Bugzilla – Attachment 178817 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: Cosolidate changes and change log format
Bug-26744-Cosolidate-changes-and-change-log-format.patch (text/plain), 3.32 KB, created by
David Gustafsson
on 2025-02-28 12:09:26 UTC
(
hide
)
Description:
Bug 26744: Cosolidate changes and change log format
Filename:
MIME Type:
Creator:
David Gustafsson
Created:
2025-02-28 12:09:26 UTC
Size:
3.32 KB
patch
obsolete
>From 2f73c12852ea18fdc7c302c9eaa69496f5d516d7 Mon Sep 17 00:00:00 2001 >From: David Gustafsson <david.gustafsson@ub.gu.se> >Date: Fri, 28 Feb 2025 13:06:15 +0100 >Subject: [PATCH] Bug 26744: Cosolidate changes and change log format > >--- > Koha/Patron.pm | 21 ++++++++++++--------- > t/db_dependent/Koha/Patron/Attribute.t | 2 +- > 2 files changed, 13 insertions(+), 10 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 3c4099f9839..bd3572d92c4 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -2256,11 +2256,12 @@ sub add_extended_attribute { > )->store; > > if ( C4::Context->preference("BorrowersLog") ) { >+ my $code = $attribute->{code}; > logaction( > "MEMBERS", > "MODIFY", > $self->borrowernumber, >- "Patron attribute " . $attribute->{code} . ": " . to_json( $change, { pretty => 1, canonical => 1 } ) >+ to_json( { "attribute.$code" => $change }, { pretty => 1, canonical => 1 } ) > ); > } > >@@ -2325,6 +2326,7 @@ sub extended_attributes { > my $schema = $self->_result->result_source->schema; > $schema->txn_do( > sub { >+ my $all_changes = {}; > while ( my ( $repeatable, $changes ) = each %attribute_changes ) { > while ( my ( $code, $change ) = each %{$changes} ) { > $change->{before} //= []; >@@ -2348,14 +2350,7 @@ sub extended_attributes { > $attribute->store() if ( $attribute->code eq $code ); > } > if ( C4::Context->preference("BorrowersLog") ) { >- logaction( >- "MEMBERS", >- "MODIFY", >- $self->borrowernumber, >- "Patron attribute " >- . $code . ": " >- . to_json( $change, { pretty => 1, canonical => 1 } ) >- ); >+ $all_changes->{"attribute.$code"} = $change; > } > } > } >@@ -2386,6 +2381,14 @@ sub extended_attributes { > type => $type, > ) if !$new_types->{$type}; > } >+ if ( %{$all_changes} ) { >+ logaction( >+ "MEMBERS", >+ "MODIFY", >+ $self->borrowernumber, >+ to_json( $all_changes, { pretty => 1, canonical => 1 } ) >+ ); >+ } > } > ); > } >diff --git a/t/db_dependent/Koha/Patron/Attribute.t b/t/db_dependent/Koha/Patron/Attribute.t >index c4b57e19f45..c561355c45e 100755 >--- a/t/db_dependent/Koha/Patron/Attribute.t >+++ b/t/db_dependent/Koha/Patron/Attribute.t >@@ -543,7 +543,7 @@ subtest 'action log tests' => sub { > } > } > } >- return "Patron attribute " . $code . ": " . to_json( $change, { pretty => 1, canonical => 1 } ); >+ return to_json( { "attribute.$code" => $change }, { pretty => 1, canonical => 1 } ); > }; > > my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >-- >2.48.1
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