|
Lines 21-30
GetOptions(
Link Here
|
| 21 |
'cc|category_code|category-code:s' => \@category_code, |
21 |
'cc|category_code|category-code:s' => \@category_code, |
| 22 |
'f|file:s' => \$file, |
22 |
'f|file:s' => \$file, |
| 23 |
'c|confirm' => \$confirm, |
23 |
'c|confirm' => \$confirm, |
| 24 |
); |
24 |
) or pod2usage(2); |
|
|
25 |
|
| 26 |
pod2usage(1) if $help; |
| 27 |
|
| 28 |
if ( !$confirm && !$verbose ) { |
| 29 |
say STDERR "Missing required option: either --verbose or --confirm must be supplied"; |
| 30 |
pod2usage(2); |
| 31 |
} |
| 32 |
|
| 25 |
@type = split( /,/, join( ',', @type ) ); |
33 |
@type = split( /,/, join( ',', @type ) ); |
| 26 |
|
34 |
|
| 27 |
pod2usage(1) if ( $help || !$confirm && !$verbose || !$file && !@type && !$before && !$after ); |
35 |
if ( !$file && !@type && !$before && !$after ) { |
|
|
36 |
say STDERR "Missing required filter option: at least one filter option should be used"; |
| 37 |
pod2usage(2); |
| 38 |
} |
| 28 |
|
39 |
|
| 29 |
my $where = { 'amountoutstanding' => { '>' => 0 } }; |
40 |
my $where = { 'amountoutstanding' => { '>' => 0 } }; |
| 30 |
my $attr = {}; |
41 |
my $attr = {}; |
|
Lines 141-150
writeoff_debts.pl
Link Here
|
| 141 |
|
152 |
|
| 142 |
=head1 SYNOPSIS |
153 |
=head1 SYNOPSIS |
| 143 |
|
154 |
|
| 144 |
./writeoff_debts.pl --added_before DATE --type OVERDUE --file REPORT --confirm |
155 |
writeoff_debts.pl --confirm [--verbose] <filter options> |
|
|
156 |
writeoff_debts.pl --verbose <filter options> |
| 157 |
writeoff_debts.pl --help |
| 158 |
|
| 159 |
<filter options> are: |
| 160 |
[--type <type>] [--file <file>] [--added-before <date>] |
| 161 |
[--added-after <date>] [--category-code <category code>] |
| 145 |
|
162 |
|
| 146 |
This script batch waives debts. |
163 |
This script batch waives debts. |
| 147 |
|
164 |
|
|
|
165 |
=head1 OPTIONS |
| 166 |
|
| 148 |
The options to select the debt records to writeoff are cumulative. For |
167 |
The options to select the debt records to writeoff are cumulative. For |
| 149 |
example, supplying both --added_before and --type specifies that the |
168 |
example, supplying both --added_before and --type specifies that the |
| 150 |
accountline must meet both conditions to be selected for writeoff. |
169 |
accountline must meet both conditions to be selected for writeoff. |
|
Lines 154-161
This is to prevent an accidental 'writeoff all' operation. Please note that
Link Here
|
| 154 |
--category-code must be accompanied by another filter - the script will not |
173 |
--category-code must be accompanied by another filter - the script will not |
| 155 |
run if this is the only filter provided. |
174 |
run if this is the only filter provided. |
| 156 |
|
175 |
|
| 157 |
=head1 OPTIONS |
|
|
| 158 |
|
| 159 |
=over |
176 |
=over |
| 160 |
|
177 |
|
| 161 |
=item B<-h|--help> |
178 |
=item B<-h|--help> |
|
Lines 198-208
criteria.
Link Here
|
| 198 |
|
215 |
|
| 199 |
This flag set the script to output logging for the actions it will perform. |
216 |
This flag set the script to output logging for the actions it will perform. |
| 200 |
|
217 |
|
|
|
218 |
The B<-v> option is mandatory if B<-c> is not supplied. |
| 219 |
|
| 220 |
It can be repeated for increased verbosity. |
| 221 |
|
| 201 |
=item B<-c|--confirm> |
222 |
=item B<-c|--confirm> |
| 202 |
|
223 |
|
| 203 |
This flag must be provided in order for the script to actually |
224 |
This flag must be provided in order for the script to actually |
| 204 |
writeoff debts. If it is not supplied, the script will |
225 |
writeoff debts. |
| 205 |
only report on the accountline records it would have been written off. |
226 |
|
|
|
227 |
If it is not supplied, the B<-v> option is required. The script will then only |
| 228 |
report on the accountline records it would have been written off. |
| 206 |
|
229 |
|
| 207 |
=back |
230 |
=back |
| 208 |
|
231 |
|
| 209 |
- |
|
|