View | Details | Raw Unified | Return to bug 34077
Collapse All | Expand All

(-)a/misc/cronjobs/writeoff_debts.pl (-8 / +30 lines)
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 152-159 accountline must meet both conditions to be selected for writeoff. Link Here
152
You must pass at least one of the filtering options for the script to run.
171
You must pass at least one of the filtering options for the script to run.
153
This is to prevent an accidental 'writeoff all' operation.
172
This is to prevent an accidental 'writeoff all' operation.
154
173
155
=head1 OPTIONS
156
157
=over
174
=over
158
175
159
=item B<-h|--help>
176
=item B<-h|--help>
Lines 194-204 criteria. Link Here
194
211
195
This flag set the script to output logging for the actions it will perform.
212
This flag set the script to output logging for the actions it will perform.
196
213
214
The B<-v> option is mandatory if B<-c> is not supplied.
215
216
It can be repeated for increased verbosity.
217
197
=item B<-c|--confirm>
218
=item B<-c|--confirm>
198
219
199
This flag must be provided in order for the script to actually
220
This flag must be provided in order for the script to actually
200
writeoff debts.  If it is not supplied, the script will
221
writeoff debts.
201
only report on the accountline records it would have been written off.
222
223
If it is not supplied, the B<-v> option is required. The script will then only
224
report on the accountline records it would have been written off.
202
225
203
=back
226
=back
204
227
205
- 

Return to bug 34077