Bugzilla – Attachment 54620 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: Make delete_patrons.pl deal with --last_seen
Bug-16276-Make-deletepatronspl-deal-with---lastsee.patch (text/plain), 3.60 KB, created by
Marcel de Rooy
on 2016-08-19 11:11:49 UTC
(
hide
)
Description:
Bug 16276: Make delete_patrons.pl deal with --last_seen
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2016-08-19 11:11:49 UTC
Size:
3.60 KB
patch
obsolete
>From f12de8abc4c8daf4ca935225b6e5e3f8724d7af8 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Sun, 24 Apr 2016 17:39:13 +0100 >Subject: [PATCH] Bug 16276: Make delete_patrons.pl deal with --last_seen >Content-Type: text/plain; charset=utf-8 > >This patch modify the delete_patrons.pl cronjob to deal with the >last_seen option. > >To test it, you just have to use the --last_seen option and pass a valid >date (iso format) > >Example: > perl misc/cronjobs/delete_patrons.pl --last_seen="1984-02-04" --confirm >will delete all the patrons who do not have been active since this date. > >Sponsored-by: BULAC - http://www.bulac.fr/ >Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr> > >https://bugs.koha-community.org/show_bug.cgi?id=12276 > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > misc/cronjobs/delete_patrons.pl | 21 ++++++++++++++++----- > 1 file changed, 16 insertions(+), 5 deletions(-) > >diff --git a/misc/cronjobs/delete_patrons.pl b/misc/cronjobs/delete_patrons.pl >index a76d1dd..58b2311 100755 >--- a/misc/cronjobs/delete_patrons.pl >+++ b/misc/cronjobs/delete_patrons.pl >@@ -9,13 +9,14 @@ use C4::Members; > use Koha::DateUtils; > use C4::Log; > >-my ( $help, $verbose, $not_borrowed_since, $expired_before, $category_code, >- $branchcode, $confirm ); >+my ( $help, $verbose, $not_borrowed_since, $expired_before, $last_seen, >+ $category_code, $branchcode, $confirm ); > GetOptions( > 'h|help' => \$help, > 'v|verbose' => \$verbose, > 'not_borrowed_since:s' => \$not_borrowed_since, > 'expired_before:s' => \$expired_before, >+ 'last_seen:s' => \$last_seen, > 'category_code:s' => \$category_code, > 'library:s' => \$branchcode, > 'c|confirm' => \$confirm, >@@ -31,9 +32,12 @@ $not_borrowed_since = dt_from_string( $not_borrowed_since, 'iso' ) > $expired_before = dt_from_string( $expired_before, 'iso' ) > if $expired_before; > >-unless ( $not_borrowed_since or $expired_before or $category_code or $branchcode ) { >+if ( $last_seen and not C4::Context->preference('TrackLastPatronActivity') ) { >+ pod2usage(q{The --last_seen option cannot be used with TrackLastPatronActivity turned off}); >+} >+ >+unless ( $not_borrowed_since or $expired_before or $last_seen or $category_code or $branchcode ) { > pod2usage(q{At least one filter is mandatory}); >- exit; > } > > cronlogaction(); >@@ -42,6 +46,7 @@ my $members = GetBorrowersToExpunge( > { > not_borrowed_since => $not_borrowed_since, > expired_before => $expired_before, >+ last_seen => $last_seen, > category_code => $category_code, > branchcode => $branchcode, > } >@@ -108,7 +113,7 @@ delete_patrons - This script deletes patrons > > =head1 SYNOPSIS > >-delete_patrons.pl [-h|--help] [-v|--verbose] [-c|--confirm] [--not_borrowed_since=DATE] [--expired_before=DATE] [--category_code=CAT] [--library=LIBRARY] >+delete_patrons.pl [-h|--help] [-v|--verbose] [-c|--confirm] [--not_borrowed_since=DATE] [--expired_before=DATE] [--last-seen=DATE] [--category_code=CAT] [--library=LIBRARY] > > Dates should be in ISO format, e.g., 2013-07-19, and can be generated > with `date -d '-3 month' "+%Y-%m-%d"`. >@@ -133,6 +138,12 @@ Delete patrons who have not borrowed since this date. > > Delete patrons with an account expired before this date. > >+=item B<--last_seen> >+ >+Delete patrons who have not been connected since this date. >+ >+The system preference TrackLastPatronActivity must be enabled to use this option. >+ > =item B<--category_code> > > Delete patrons who have this category code. >-- >1.7.10.4
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