View | Details | Raw Unified | Return to bug 16276
Collapse All | Expand All

(-)a/misc/cronjobs/delete_patrons.pl (-6 / +16 lines)
Lines 9-21 use C4::Members; Link Here
9
use Koha::DateUtils;
9
use Koha::DateUtils;
10
use C4::Log;
10
use C4::Log;
11
11
12
my ( $help, $verbose, $not_borrowed_since, $expired_before, $category_code,
12
my ( $help, $verbose, $not_borrowed_since, $expired_before, $last_seen,
13
    $branchcode, $confirm );
13
    $category_code, $branchcode, $confirm );
14
GetOptions(
14
GetOptions(
15
    'h|help'                 => \$help,
15
    'h|help'                 => \$help,
16
    'v|verbose'              => \$verbose,
16
    'v|verbose'              => \$verbose,
17
    'not_borrowed_since:s'   => \$not_borrowed_since,
17
    'not_borrowed_since:s'   => \$not_borrowed_since,
18
    'expired_before:s'       => \$expired_before,
18
    'expired_before:s'       => \$expired_before,
19
    'last_seen:s'            => \$last_seen,
19
    'category_code:s'        => \$category_code,
20
    'category_code:s'        => \$category_code,
20
    'library:s'              => \$branchcode,
21
    'library:s'              => \$branchcode,
21
    'c|confirm'              => \$confirm,
22
    'c|confirm'              => \$confirm,
Lines 31-39 $not_borrowed_since = dt_from_string( $not_borrowed_since, 'iso' ) Link Here
31
$expired_before = dt_from_string( $expired_before, 'iso' )
32
$expired_before = dt_from_string( $expired_before, 'iso' )
32
  if $expired_before;
33
  if $expired_before;
33
34
34
unless ( $not_borrowed_since or $expired_before or $category_code or $branchcode ) {
35
if ( $last_seen and not C4::Context->preference('TrackLastPatronActivity') ) {
36
    pod2usage(q{The --last_seen option cannot be used with TrackLastPatronActivity turned off});
37
}
38
39
unless ( $not_borrowed_since or $expired_before or $last_seen or $category_code or $branchcode ) {
35
    pod2usage(q{At least one filter is mandatory});
40
    pod2usage(q{At least one filter is mandatory});
36
    exit;
37
}
41
}
38
42
39
cronlogaction();
43
cronlogaction();
Lines 42-47 my $members = GetBorrowersToExpunge( Link Here
42
    {
46
    {
43
        not_borrowed_since => $not_borrowed_since,
47
        not_borrowed_since => $not_borrowed_since,
44
        expired_before       => $expired_before,
48
        expired_before       => $expired_before,
49
        last_seen            => $last_seen,
45
        category_code        => $category_code,
50
        category_code        => $category_code,
46
        branchcode           => $branchcode,
51
        branchcode           => $branchcode,
47
    }
52
    }
Lines 108-114 delete_patrons - This script deletes patrons Link Here
108
113
109
=head1 SYNOPSIS
114
=head1 SYNOPSIS
110
115
111
delete_patrons.pl [-h|--help] [-v|--verbose] [-c|--confirm] [--not_borrowed_since=DATE] [--expired_before=DATE] [--category_code=CAT] [--library=LIBRARY]
116
delete_patrons.pl [-h|--help] [-v|--verbose] [-c|--confirm] [--not_borrowed_since=DATE] [--expired_before=DATE] [--last-seen=DATE] [--category_code=CAT] [--library=LIBRARY]
112
117
113
Dates should be in ISO format, e.g., 2013-07-19, and can be generated
118
Dates should be in ISO format, e.g., 2013-07-19, and can be generated
114
with `date -d '-3 month' "+%Y-%m-%d"`.
119
with `date -d '-3 month' "+%Y-%m-%d"`.
Lines 133-138 Delete patrons who have not borrowed since this date. Link Here
133
138
134
Delete patrons with an account expired before this date.
139
Delete patrons with an account expired before this date.
135
140
141
=item B<--last_seen>
142
143
Delete patrons who have not been connected since this date.
144
145
The system preference TrackLastPatronActivity must be enabled to use this option.
146
136
=item B<--category_code>
147
=item B<--category_code>
137
148
138
Delete patrons who have this category code.
149
Delete patrons who have this category code.
139
- 

Return to bug 16276