Bug 37920: Add cronjob loggging to writeoff_debts.pl

This patch adds the same logging as other cronjobs have

To test:
1 - Enable system preference CronjobLog
2 - perl misc/cronjobs/writeoff_debts.pl -v -c --added-after 2025-01-01
3 - Check the logs - no entries
4 - Apply patch
5 - Repeat 2
6 - Check the logs, two entries - one for the start and one for the end

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Tested on top of bug 39236. Works as advertised.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Nick Clemens 2025-03-04 14:01:45 +00:00 committed by Katrin Fischer
parent 93e2a0953d
commit de9c1a8ff2
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 7 additions and 0 deletions

View File

@ -6,11 +6,16 @@ use feature 'say';
use Getopt::Long qw( GetOptions );
use Pod::Usage qw( pod2usage );
use C4::Log qw( cronlogaction );
use Koha::Account::Lines;
use Koha::DateUtils qw( dt_from_string );
use Koha::Script -cron;
my $command_line_options = join( " ", @ARGV );
cronlogaction( { info => $command_line_options } );
my ( $help, $verbose, @type, $before, $after, @category_code, $file, $confirm );
GetOptions(
'h|help' => \$help,
@ -137,6 +142,8 @@ while ( my $line = $lines->next ) {
}
}
cronlogaction( { action => 'End', info => "COMPLETED" } );
exit(0);
__END__