Browse Source

Bug 24651: Add maxdays option to fines cronjob

This patch adds an optional maxdays parameter to the fines.pl cronjob.
The new parameter allows system administrators to set a maximum number
of days for the job to process overdues.  This can improve performance.

Signed-off-by: Sally Healey <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
20.05.x
Martin Renvoize 4 years ago
parent
commit
71d0775cc7
Signed by: martin.renvoize GPG Key ID: 422B469130441A0F
  1. 7
      misc/cronjobs/fines.pl

7
misc/cronjobs/fines.pl

@ -45,12 +45,14 @@ my $help;
my $verbose;
my $output_dir;
my $log;
my $maxdays;
GetOptions(
'h|help' => \$help,
'v|verbose' => \$verbose,
'l|log' => \$log,
'o|out:s' => \$output_dir,
'm|maxdays:i' => \$maxdays,
);
my $usage = << 'ENDUSAGE';
@ -64,6 +66,7 @@ This script has the following parameters :
-l --log: log the output to a file (optional if the -o parameter is given)
-o --out: ouput directory for logs (defaults to env or /tmp if !exist)
-v --verbose
-m --maxdays: how many days back of overdues to process
ENDUSAGE
@ -97,7 +100,9 @@ if ($filename) {
print {$fh} "\n";
}
my $counted = 0;
my $overdues = Getoverdues();
my $params;
$params->{maximumdays} = $maxdays if $maxdays;
my $overdues = Getoverdues($params);
for my $overdue ( @{$overdues} ) {
next if $overdue->{itemlost};

Loading…
Cancel
Save