|
Lines 9-21
use C4::Members;
Link Here
|
| 9 |
use Koha::DateUtils; |
9 |
use Koha::DateUtils; |
| 10 |
|
10 |
|
| 11 |
my ( $help, $verbose, $not_borrowered_since, $expired_before, $category_code, |
11 |
my ( $help, $verbose, $not_borrowered_since, $expired_before, $category_code, |
| 12 |
$confirm ); |
12 |
$branchcode, $confirm ); |
| 13 |
GetOptions( |
13 |
GetOptions( |
| 14 |
'h|help' => \$help, |
14 |
'h|help' => \$help, |
| 15 |
'v|verbose' => \$verbose, |
15 |
'v|verbose' => \$verbose, |
| 16 |
'not_borrowered_since:s' => \$not_borrowered_since, |
16 |
'not_borrowered_since:s' => \$not_borrowered_since, |
| 17 |
'expired_before:s' => \$expired_before, |
17 |
'expired_before:s' => \$expired_before, |
| 18 |
'category_code:s' => \$category_code, |
18 |
'category_code:s' => \$category_code, |
|
|
19 |
'branchcode:s' => \$branchcode, |
| 19 |
'c|confirm' => \$confirm, |
20 |
'c|confirm' => \$confirm, |
| 20 |
) || pod2usage(1); |
21 |
) || pod2usage(1); |
| 21 |
|
22 |
|
|
Lines 29-35
$not_borrowered_since = dt_from_string( $not_borrowered_since, 'iso' )
Link Here
|
| 29 |
$expired_before = dt_from_string( $expired_before, 'iso' ) |
30 |
$expired_before = dt_from_string( $expired_before, 'iso' ) |
| 30 |
if $expired_before; |
31 |
if $expired_before; |
| 31 |
|
32 |
|
| 32 |
unless ( $not_borrowered_since or $expired_before or $category_code ) { |
33 |
unless ( $not_borrowered_since or $expired_before or $category_code or $branchcode ) { |
| 33 |
pod2usage(q{At least one filter is mandatory}); |
34 |
pod2usage(q{At least one filter is mandatory}); |
| 34 |
exit; |
35 |
exit; |
| 35 |
} |
36 |
} |
|
Lines 39-44
my $members = GetBorrowersToExpunge(
Link Here
|
| 39 |
not_borrowered_since => $not_borrowered_since, |
40 |
not_borrowered_since => $not_borrowered_since, |
| 40 |
expired_before => $expired_before, |
41 |
expired_before => $expired_before, |
| 41 |
category_code => $category_code, |
42 |
category_code => $category_code, |
|
|
43 |
branchcode => $branchcode, |
| 42 |
} |
44 |
} |
| 43 |
); |
45 |
); |
| 44 |
|
46 |
|
|
Lines 72-78
delete_patrons - This script deletes patrons
Link Here
|
| 72 |
|
74 |
|
| 73 |
=head1 SYNOPSIS |
75 |
=head1 SYNOPSIS |
| 74 |
|
76 |
|
| 75 |
delete_patrons.pl [-h -v -c] --not_borrowered_since=2013-07-21 --expired_before=2013-07-21 --category_code=CAT |
77 |
delete_patrons.pl [-h -v -c] --not_borrowered_since=2013-07-21 --expired_before=2013-07-21 --category_code=CAT --branchcode=CPL |
| 76 |
|
78 |
|
| 77 |
dates can be generated with `date -d '-3 month' "+%Y-%m-%d"` |
79 |
dates can be generated with `date -d '-3 month' "+%Y-%m-%d"` |
| 78 |
|
80 |
|
|
Lines 98-103
Delete patrons with an account expired before this date.
Link Here
|
| 98 |
|
100 |
|
| 99 |
Delete patrons who have this category code. |
101 |
Delete patrons who have this category code. |
| 100 |
|
102 |
|
|
|
103 |
=item B<--branchcode> |
| 104 |
|
| 105 |
Delete patrons in this library. |
| 106 |
|
| 101 |
=item B<-c|--confirm> |
107 |
=item B<-c|--confirm> |
| 102 |
|
108 |
|
| 103 |
Without this flag set, this script will do nothing. |
109 |
Without this flag set, this script will do nothing. |
| 104 |
- |
|
|