Bugzilla – Attachment 163959 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: Only log if BorrowersLog syspref is enabled
Bug-26744-Only-log-if-BorrowersLog-syspref-is-enab.patch (text/plain), 2.80 KB, created by
David Gustafsson
on 2024-03-26 20:19:14 UTC
(
hide
)
Description:
Bug 26744: Only log if BorrowersLog syspref is enabled
Filename:
MIME Type:
Creator:
David Gustafsson
Created:
2024-03-26 20:19:14 UTC
Size:
2.80 KB
patch
obsolete
>From 8d8aa8e5ede373c82aa7a26544eeca75859ab962 Mon Sep 17 00:00:00 2001 >From: David Gustafsson <david.gustafsson@ub.gu.se> >Date: Tue, 26 Mar 2024 21:18:33 +0100 >Subject: [PATCH] Bug 26744: Only log if BorrowersLog syspref is enabled > >--- > Koha/Patron/Attribute.pm | 4 ++-- > t/db_dependent/Koha/Patron/Attribute.t | 21 ++++++++++++++++++++- > 2 files changed, 22 insertions(+), 3 deletions(-) > >diff --git a/Koha/Patron/Attribute.pm b/Koha/Patron/Attribute.pm >index 34eaf4c00cf..cce32893e7f 100644 >--- a/Koha/Patron/Attribute.pm >+++ b/Koha/Patron/Attribute.pm >@@ -61,7 +61,7 @@ sub store { > unless $self->unique_ok(); > > # Only log for non-repeatable attributes >- if (!$self->type->repeatable) { >+ if (!$self->type->repeatable && C4::Context->preference("BorrowersLog")) { > my $change; > if ( exists $deleted_attributes{$self->_deleted_attribute_key} ) { > my $previous_attribute = $deleted_attributes{$self->_deleted_attribute_key}; >@@ -229,7 +229,7 @@ Overloaded I<store> method to temporarily stash deleted attribute for action log > > sub delete { > my ($self) = @_; >- if (!$self->type->repeatable) { >+ if (!$self->type->repeatable && C4::Context->preference("BorrowersLog")) { > $deleted_attributes{$self->_deleted_attribute_key} = $self; > } > $self->SUPER::delete(); >diff --git a/t/db_dependent/Koha/Patron/Attribute.t b/t/db_dependent/Koha/Patron/Attribute.t >index c97a7e79bc4..d4307f3e496 100755 >--- a/t/db_dependent/Koha/Patron/Attribute.t >+++ b/t/db_dependent/Koha/Patron/Attribute.t >@@ -23,6 +23,7 @@ use JSON qw( to_json ); > use Test::More tests => 4; > > use t::lib::TestBuilder; >+use t::lib::Mocks; > use Test::Exception; > > use Koha::Database; >@@ -408,7 +409,7 @@ subtest 'merge_and_replace_with' => sub { > }; > > subtest 'action log tests' => sub { >- plan tests => 3; >+ plan tests => 4; > my $schema = Koha::Database->new->schema; > $schema->storage->txn_begin; > >@@ -420,6 +421,7 @@ subtest 'action log tests' => sub { > } > ); > >+ t::lib::Mocks::mock_preference( 'BorrowersLog', 0 ); > my $attributes = [ > { > attribute => 'Foo', >@@ -440,6 +442,23 @@ subtest 'action log tests' => sub { > info => $info > } > ); >+ is( >+ $action_logs->count, >+ 0, >+ 'No action log entry has been created when adding patron attribute if BorrowersLog syspref disabled' >+ ); >+ $patron->extended_attributes([]); >+ >+ t::lib::Mocks::mock_preference( 'BorrowersLog', 1 ); >+ $patron->extended_attributes($attributes); >+ $action_logs = Koha::ActionLogs->search( >+ { >+ module => "MEMBERS", >+ action => "MODIFY", >+ object => $patron->borrowernumber, >+ info => $info >+ } >+ ); > is( > $action_logs->count, > 1, >-- >2.43.0
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