Lines 8-22
use Getopt::Long;
Link Here
|
8 |
use C4::Members; |
8 |
use C4::Members; |
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_borrowed_since, $expired_before, $category_code, |
12 |
$branchcode, $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_borrowed_since:s' => \$not_borrowed_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 |
'library:s' => \$branchcode, |
20 |
'c|confirm' => \$confirm, |
20 |
'c|confirm' => \$confirm, |
21 |
) || pod2usage(1); |
21 |
) || pod2usage(1); |
22 |
|
22 |
|
Lines 24-43
if ($help) {
Link Here
|
24 |
pod2usage(1); |
24 |
pod2usage(1); |
25 |
} |
25 |
} |
26 |
|
26 |
|
27 |
$not_borrowered_since = dt_from_string( $not_borrowered_since, 'iso' ) |
27 |
$not_borrowed_since = dt_from_string( $not_borrowed_since, 'iso' ) |
28 |
if $not_borrowered_since; |
28 |
if $not_borrowed_since; |
29 |
|
29 |
|
30 |
$expired_before = dt_from_string( $expired_before, 'iso' ) |
30 |
$expired_before = dt_from_string( $expired_before, 'iso' ) |
31 |
if $expired_before; |
31 |
if $expired_before; |
32 |
|
32 |
|
33 |
unless ( $not_borrowered_since or $expired_before or $category_code or $branchcode ) { |
33 |
unless ( $not_borrowed_since or $expired_before or $category_code or $branchcode ) { |
34 |
pod2usage(q{At least one filter is mandatory}); |
34 |
pod2usage(q{At least one filter is mandatory}); |
35 |
exit; |
35 |
exit; |
36 |
} |
36 |
} |
37 |
|
37 |
|
38 |
my $members = GetBorrowersToExpunge( |
38 |
my $members = GetBorrowersToExpunge( |
39 |
{ |
39 |
{ |
40 |
not_borrowered_since => $not_borrowered_since, |
40 |
not_borrowered_since => $not_borrowed_since, |
41 |
expired_before => $expired_before, |
41 |
expired_before => $expired_before, |
42 |
category_code => $category_code, |
42 |
category_code => $category_code, |
43 |
branchcode => $branchcode, |
43 |
branchcode => $branchcode, |
Lines 74-80
delete_patrons - This script deletes patrons
Link Here
|
74 |
|
74 |
|
75 |
=head1 SYNOPSIS |
75 |
=head1 SYNOPSIS |
76 |
|
76 |
|
77 |
delete_patrons.pl [-h -v -c] --not_borrowered_since=2013-07-21 --expired_before=2013-07-21 --category_code=CAT --branchcode=CPL |
77 |
delete_patrons.pl [-h -v -c] --not_borrowed_since=2013-07-21 --expired_before=2013-07-21 --category_code=CAT --branchcode=CPL |
78 |
|
78 |
|
79 |
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"` |
80 |
|
80 |
|
Lines 88-96
Options are cumulatives.
Link Here
|
88 |
|
88 |
|
89 |
Print a brief help message |
89 |
Print a brief help message |
90 |
|
90 |
|
91 |
=item B<--not_borrowered_since> |
91 |
=item B<--not_borrowed_since> |
92 |
|
92 |
|
93 |
Delete patrons who have not borrowered since this date. |
93 |
Delete patrons who have not borrowed since this date. |
94 |
|
94 |
|
95 |
=item B<--expired_date> |
95 |
=item B<--expired_date> |
96 |
|
96 |
|
97 |
- |
|
|