Bugzilla – Attachment 85277 Details for
Bug 3820
More detailed patron record changes log
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 3820: (follow-up) Address lastseen log spamming
Bug-3820-follow-up-Address-lastseen-log-spamming.patch (text/plain), 2.96 KB, created by
Martin Renvoize (ashimema)
on 2019-02-19 13:14:02 UTC
(
hide
)
Description:
Bug 3820: (follow-up) Address lastseen log spamming
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2019-02-19 13:14:02 UTC
Size:
2.96 KB
patch
obsolete
>From 7ae85da81e20e874194799843fe3492ee4eaeae9 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 19 Feb 2019 12:37:14 +0000 >Subject: [PATCH] Bug 3820: (follow-up) Address lastseen log spamming > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Patron.pm | 9 +++------ > t/db_dependent/Koha/Patrons.t | 9 +++++++-- > 2 files changed, 10 insertions(+), 8 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index c2b4738a34..8d76de2c57 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -21,7 +21,7 @@ package Koha::Patron; > use Modern::Perl; > > use Carp; >-use List::MoreUtils qw( uniq ); >+use List::MoreUtils qw( any uniq ); > use JSON qw( to_json ); > use Text::Unaccent qw( unac_string ); > >@@ -260,7 +260,9 @@ sub store { > my $info; > my $from_storage = $self_from_storage->unblessed; > my $from_object = $self->unblessed; >+ my @skip_fields = (qw/lastseen/); > for my $key ( keys %{$from_storage} ) { >+ next if any { /$key/ } @skip_fields; > if ( > ( > !defined( $from_storage->{$key} ) >@@ -294,11 +296,6 @@ sub store { > ) > ); > } >- else { >- logaction( "MEMBERS", "MODIFY", $self->borrowernumber, >- "NON-STANDARD FIELD CHANGED" ); >- >- } > } > > # Final store >diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t >index 2b8a13d3cb..8461d4357c 100644 >--- a/t/db_dependent/Koha/Patrons.t >+++ b/t/db_dependent/Koha/Patrons.t >@@ -1399,8 +1399,8 @@ $nb_of_patrons = Koha::Patrons->search->count; > $retrieved_patron_1->delete; > is( Koha::Patrons->search->count, $nb_of_patrons - 1, 'Delete should have deleted the patron' ); > >-subtest 'Log cardnumber change' => sub { >- plan tests => 3; >+subtest 'BorrowersLog tests' => sub { >+ plan tests => 4; > > t::lib::Mocks::mock_preference( 'BorrowersLog', 1 ); > my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >@@ -1414,6 +1414,11 @@ subtest 'Log cardnumber change' => sub { > is( $log_info->{cardnumber}->{after}, 'TESTCARDNUMBER', 'Got correct new cardnumber' ); > is( $log_info->{cardnumber}->{before}, $cardnumber, 'Got correct old cardnumber' ); > is( scalar @logs, 1, 'With BorrowerLogs, one detailed MODIFY action should be logged for the modification.' ); >+ >+ t::lib::Mocks::mock_preference( 'TrackLastPatronActivity', 1 ); >+ $patron->track_login(); >+ @logs = $schema->resultset('ActionLog')->search( { module => 'MEMBERS', action => 'MODIFY', object => $patron->borrowernumber } ); >+ is( scalar @logs, 1, 'With BorrowerLogs and TrackLastPatronActivity we should not spam the logs'); > }; > > $schema->storage->txn_rollback; >-- >2.20.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 3820
:
1584
|
1585
|
85100
|
85102
|
85103
|
85104
|
85161
|
85162
|
85196
|
85197
|
85243
|
85244
|
85245
|
85246
|
85256
|
85257
|
85258
|
85259
|
85260
|
85269
|
85270
|
85271
|
85272
|
85273
|
85274
|
85276
| 85277