3 # Copyright 2009-2010 Kyle Hall
4 # Copyright 2020 PTFS Europe
6 # This file is part of Koha.
8 # Koha is free software; you can redistribute it and/or modify it
9 # under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
13 # Koha is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with Koha; if not, see <http://www.gnu.org/licenses>.
23 cancel_expired_holds.pl - cron script to cancel holds as they expire
27 ./cancel_expired_holds.pl
28 ./cancel_expired_holds.pl --reason="EXPIRED"
32 0 1 * * * cancel_expired_holds.pl
33 0 1 * * * cancel_expired_holds.pl --reason="EXPIRED"
37 This script calls C4::Reserves::CancelExpiredReserves which will find and cancel all expired reseves in the system.
42 use Getopt::Long qw( GetOptions );
43 use Pod::Usage qw( pod2usage );
45 use Koha::Script -cron;
47 use C4::Log qw( cronlogaction );
55 Print a brief help message and exits.
59 Optionally adds a reason for cancellation (which will trigger a notice to be sent to the patron)
68 my $command_line_options = join(" ",@ARGV);
72 'reason=s' => \$reason
74 pod2usage(1) if $help;
76 cronlogaction({ info => $command_line_options });
78 C4::Reserves::CancelExpiredReserves($reason);
80 cronlogaction({ action => 'End', info => "COMPLETED" });