Lines 11-25
use Koha::DateUtils qw( dt_from_string );
Link Here
|
11 |
|
11 |
|
12 |
use Koha::Script -cron; |
12 |
use Koha::Script -cron; |
13 |
|
13 |
|
14 |
my ( $help, $verbose, @type, $before, $after, $file, $confirm ); |
14 |
my ( $help, $verbose, @type, $before, $after, @category_code, $file, $confirm ); |
15 |
GetOptions( |
15 |
GetOptions( |
16 |
'h|help' => \$help, |
16 |
'h|help' => \$help, |
17 |
'v|verbose+' => \$verbose, |
17 |
'v|verbose+' => \$verbose, |
18 |
't|type:s' => \@type, |
18 |
't|type:s' => \@type, |
19 |
'ab|added_before|added-before:s' => \$before, |
19 |
'ab|added_before|added-before:s' => \$before, |
20 |
'aa|added_after|added-after:s' => \$after, |
20 |
'aa|added_after|added-after:s' => \$after, |
21 |
'f|file:s' => \$file, |
21 |
'cc|category_code|category-code:s' => \@category_code, |
22 |
'c|confirm' => \$confirm, |
22 |
'f|file:s' => \$file, |
|
|
23 |
'c|confirm' => \$confirm, |
23 |
); |
24 |
); |
24 |
@type = split( /,/, join( ',', @type ) ); |
25 |
@type = split( /,/, join( ',', @type ) ); |
25 |
|
26 |
|
Lines 59-64
if ($after) {
Link Here
|
59 |
$where->{date}->{'>'} = $dtf->format_datetime($added_after); |
60 |
$where->{date}->{'>'} = $dtf->format_datetime($added_after); |
60 |
} |
61 |
} |
61 |
|
62 |
|
|
|
63 |
if (@category_code) { |
64 |
$where->{'patron.categorycode'}->{'-in'} = \@category_code; |
65 |
push @{$attr->{'join'}}, 'patron'; |
66 |
} |
67 |
|
62 |
my $lines = Koha::Account::Lines->search( $where, $attr ); |
68 |
my $lines = Koha::Account::Lines->search( $where, $attr ); |
63 |
if ( $verbose ) { |
69 |
if ( $verbose ) { |
64 |
print "Attempting to write off " . $lines->count . " debts"; |
70 |
print "Attempting to write off " . $lines->count . " debts"; |
Lines 168-173
Writeoff debts added after the date passed.
Link Here
|
168 |
Dates should be in ISO format, e.g., 2013-07-19, and can be generated |
174 |
Dates should be in ISO format, e.g., 2013-07-19, and can be generated |
169 |
with `date -d '-3 month' --iso-8601`. |
175 |
with `date -d '-3 month' --iso-8601`. |
170 |
|
176 |
|
|
|
177 |
=item B<--category-code> |
178 |
|
179 |
Writeoff debts for patrons belonging to the passed categories. |
180 |
|
181 |
Can be used multiple times for additional category codes. |
182 |
|
171 |
=item B<--type> |
183 |
=item B<--type> |
172 |
|
184 |
|
173 |
Writeoff debts of the passed type. Accepts a list of CREDIT_TYPE_CODEs. |
185 |
Writeoff debts of the passed type. Accepts a list of CREDIT_TYPE_CODEs. |
174 |
- |
|
|