|
Lines 12-25
use Koha::Patrons;
Link Here
|
| 12 |
use C4::Log; |
12 |
use C4::Log; |
| 13 |
|
13 |
|
| 14 |
my ( $help, $verbose, $not_borrowed_since, $expired_before, $last_seen, |
14 |
my ( $help, $verbose, $not_borrowed_since, $expired_before, $last_seen, |
| 15 |
$category_code, $branchcode, $file, $confirm ); |
15 |
@category_code, $branchcode, $file, $confirm ); |
|
|
16 |
|
| 16 |
GetOptions( |
17 |
GetOptions( |
| 17 |
'h|help' => \$help, |
18 |
'h|help' => \$help, |
| 18 |
'v|verbose' => \$verbose, |
19 |
'v|verbose' => \$verbose, |
| 19 |
'not_borrowed_since:s' => \$not_borrowed_since, |
20 |
'not_borrowed_since:s' => \$not_borrowed_since, |
| 20 |
'expired_before:s' => \$expired_before, |
21 |
'expired_before:s' => \$expired_before, |
| 21 |
'last_seen:s' => \$last_seen, |
22 |
'last_seen:s' => \$last_seen, |
| 22 |
'category_code:s' => \$category_code, |
23 |
'category_code:s' => \@category_code, |
| 23 |
'library:s' => \$branchcode, |
24 |
'library:s' => \$branchcode, |
| 24 |
'file:s' => \$file, |
25 |
'file:s' => \$file, |
| 25 |
'c|confirm' => \$confirm, |
26 |
'c|confirm' => \$confirm, |
|
Lines 39-45
if ( $last_seen and not C4::Context->preference('TrackLastPatronActivity') ) {
Link Here
|
| 39 |
pod2usage(q{The --last_seen option cannot be used with TrackLastPatronActivity turned off}); |
40 |
pod2usage(q{The --last_seen option cannot be used with TrackLastPatronActivity turned off}); |
| 40 |
} |
41 |
} |
| 41 |
|
42 |
|
| 42 |
unless ( $not_borrowed_since or $expired_before or $last_seen or $category_code or $branchcode or $file ) { |
43 |
unless ( $not_borrowed_since or $expired_before or $last_seen or @category_code or $branchcode or $file ) { |
| 43 |
pod2usage(q{At least one filter is mandatory}); |
44 |
pod2usage(q{At least one filter is mandatory}); |
| 44 |
} |
45 |
} |
| 45 |
|
46 |
|
|
Lines 58-70
if ($file) {
Link Here
|
| 58 |
} |
59 |
} |
| 59 |
|
60 |
|
| 60 |
my $members; |
61 |
my $members; |
| 61 |
if ( $not_borrowed_since or $expired_before or $last_seen or $category_code or $branchcode ) { |
62 |
if ( $not_borrowed_since or $expired_before or $last_seen or @category_code or $branchcode ) { |
| 62 |
$members = GetBorrowersToExpunge( |
63 |
$members = GetBorrowersToExpunge( |
| 63 |
{ |
64 |
{ |
| 64 |
not_borrowed_since => $not_borrowed_since, |
65 |
not_borrowed_since => $not_borrowed_since, |
| 65 |
expired_before => $expired_before, |
66 |
expired_before => $expired_before, |
| 66 |
last_seen => $last_seen, |
67 |
last_seen => $last_seen, |
| 67 |
category_code => $category_code, |
68 |
category_code => \@category_code, |
| 68 |
branchcode => $branchcode, |
69 |
branchcode => $branchcode, |
| 69 |
} |
70 |
} |
| 70 |
); |
71 |
); |
|
Lines 143-149
delete_patrons - This script deletes patrons
Link Here
|
| 143 |
|
144 |
|
| 144 |
=head1 SYNOPSIS |
145 |
=head1 SYNOPSIS |
| 145 |
|
146 |
|
| 146 |
delete_patrons.pl [-h|--help] [-v|--verbose] [-c|--confirm] [--not_borrowed_since=DATE] [--expired_before=DATE] [--last-seen=DATE] [--category_code=CAT] [--library=LIBRARY] [--file=FILE] |
147 |
delete_patrons.pl [-h|--help] [-v|--verbose] [-c|--confirm] [--not_borrowed_since=DATE] [--expired_before=DATE] [--last-seen=DATE] [--category_code=CAT] [--category_code=CAT ...] [--library=LIBRARY] [--file=FILE] |
| 147 |
|
148 |
|
| 148 |
Dates should be in ISO format, e.g., 2013-07-19, and can be generated |
149 |
Dates should be in ISO format, e.g., 2013-07-19, and can be generated |
| 149 |
with `date -d '-3 month' --iso-8601`. |
150 |
with `date -d '-3 month' --iso-8601`. |
|
Lines 178-183
The system preference TrackLastPatronActivity must be enabled to use this option
Link Here
|
| 178 |
|
179 |
|
| 179 |
Delete patrons who have this category code. |
180 |
Delete patrons who have this category code. |
| 180 |
|
181 |
|
|
|
182 |
Can be used multiple times for additional category codes. |
| 183 |
|
| 181 |
=item B<--library> |
184 |
=item B<--library> |
| 182 |
|
185 |
|
| 183 |
Delete patrons in this library. |
186 |
Delete patrons in this library. |