Bugzilla – Attachment 55497 Details for
Bug 16276
When automatically deleting expired borrowers, make sure they didn't log in recently
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16276: Change to GetBorrowersToExpunge to take last_seen into account
Bug-16276-Change-to-GetBorrowersToExpunge-to-take-.patch (text/plain), 3.20 KB, created by
Jonathan Druart
on 2016-09-12 15:07:28 UTC
(
hide
)
Description:
Bug 16276: Change to GetBorrowersToExpunge to take last_seen into account
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-09-12 15:07:28 UTC
Size:
3.20 KB
patch
obsolete
>From 89f1dbd5c259d598c72d2f0eaf926a9d46569ead Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Sun, 24 Apr 2016 17:38:57 +0100 >Subject: [PATCH] Bug 16276: Change to GetBorrowersToExpunge to take last_seen > into account > >Sponsored-by: BULAC - http://www.bulac.fr/ >Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr> >With small change: number of tests in t/db_dependent/Members.t > >https://bugs.koha-community.org/show_bug.cgi?id=12276 > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > C4/Members.pm | 5 +++++ > t/db_dependent/Members.t | 16 ++++++++++++---- > 2 files changed, 17 insertions(+), 4 deletions(-) > >diff --git a/C4/Members.pm b/C4/Members.pm >index 6644c3a..4b2d7ff 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -1477,6 +1477,7 @@ sub GetBorrowersToExpunge { > my $params = shift; > my $filterdate = $params->{'not_borrowed_since'}; > my $filterexpiry = $params->{'expired_before'}; >+ my $filterlastseen = $params->{'last_seen'}; > my $filtercategory = $params->{'category_code'}; > my $filterbranch = $params->{'branchcode'} || > ((C4::Context->preference('IndependentBranches') >@@ -1517,6 +1518,10 @@ sub GetBorrowersToExpunge { > $query .= " AND dateexpiry < ? "; > push( @query_params, $filterexpiry ); > } >+ if ( $filterlastseen ) { >+ $query .= ' AND lastseen < ? '; >+ push @query_params, $filterlastseen; >+ } > if ( $filtercategory ) { > $query .= " AND categorycode = ? "; > push( @query_params, $filtercategory ); >diff --git a/t/db_dependent/Members.t b/t/db_dependent/Members.t >index 006207b..6974965 100755 >--- a/t/db_dependent/Members.t >+++ b/t/db_dependent/Members.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 79; >+use Test::More tests => 81; > use Test::MockModule; > use Data::Dumper; > use C4::Context; >@@ -376,9 +376,17 @@ is( scalar(@$patstodel),2,'Borrowers without issues deleted by expiration_date a > $patstodel = GetBorrowersToExpunge( {not_borrowed_since => '2016-01-02', patron_list_id => $list1->patron_list_id() } ); > is( scalar(@$patstodel),2,'Borrowers without issues deleted by last issue date'); > >- >- >- >+# Test GetBorrowersToExpunge and TrackLastPatronActivity >+$dbh->do(q|UPDATE borrowers SET lastseen=NULL|); >+$builder->build({ source => 'Borrower', value => { lastseen => '2016-01-01 01:01:01', guarantorid => undef } } ); >+$builder->build({ source => 'Borrower', value => { lastseen => '2016-02-02 02:02:02', guarantorid => undef } } ); >+$builder->build({ source => 'Borrower', value => { lastseen => '2016-03-03 03:03:03', guarantorid => undef } } ); >+$patstodel = GetBorrowersToExpunge( { last_seen => '1999-12-12' }); >+is( scalar @$patstodel, 0, 'TrackLastPatronActivity - 0 patrons must be deleted' ); >+$patstodel = GetBorrowersToExpunge( { last_seen => '2016-02-15' }); >+is( scalar @$patstodel, 2, 'TrackLastPatronActivity - 2 patrons must be deleted' ); >+$patstodel = GetBorrowersToExpunge( { last_seen => '2016-04-04' }); >+is( scalar @$patstodel, 3, 'TrackLastPatronActivity - 3 patrons must be deleted' ); > > # Regression tests for BZ13502 > ## Remove all entries with userid='' (should be only 1 max) >-- >2.8.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 16276
:
50615
|
50616
|
50617
|
50618
|
50619
|
50620
|
51191
|
51407
|
51408
|
51409
|
51410
|
51411
|
51412
|
54588
|
54589
|
54590
|
54591
|
54592
|
54612
|
54613
|
54614
|
54615
|
54616
|
54617
|
54618
|
54619
|
54620
|
54621
|
54622
|
54623
|
54624
|
54625
|
55495
|
55496
| 55497 |
55498
|
55499
|
55500
|
55501