Lines 1-6
Link Here
|
1 |
#!/usr/bin/perl |
1 |
#!/usr/bin/perl |
2 |
|
2 |
|
3 |
# Copyright 2009-2010 Kyle Hall |
3 |
# Copyright 2009-2010 Kyle Hall |
|
|
4 |
# Copyright 2020 PTFS Europe |
4 |
# |
5 |
# |
5 |
# This file is part of Koha. |
6 |
# This file is part of Koha. |
6 |
# |
7 |
# |
Lines 17-23
Link Here
|
17 |
# You should have received a copy of the GNU General Public License |
18 |
# You should have received a copy of the GNU General Public License |
18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
19 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
19 |
|
20 |
|
|
|
21 |
=head1 NAME |
22 |
|
23 |
cancel_expired_holds.pl - cron script to cancel holds as they expire |
24 |
|
25 |
=head1 SYNOPSIS |
26 |
|
27 |
./cancel_expired_holds.pl |
28 |
./cancel_expired_holds.pl --reason="EXPIRED" |
29 |
|
30 |
or, in crontab: |
31 |
|
32 |
0 1 * * * cancel_expired_holds.pl |
33 |
0 1 * * * cancel_expired_holds.pl --reason="EXPIRED" |
34 |
|
35 |
=head1 DESCRIPTION |
36 |
|
37 |
This script calls C4::Reserves::CancelExpiredReserves which will find and cancel all expired reseves in the system. |
38 |
|
39 |
=cut |
40 |
|
20 |
use Modern::Perl; |
41 |
use Modern::Perl; |
|
|
42 |
use Getopt::Long; |
43 |
use Pod::Usage; |
21 |
|
44 |
|
22 |
BEGIN { |
45 |
BEGIN { |
23 |
# find Koha's Perl modules |
46 |
# find Koha's Perl modules |
Lines 26-37
BEGIN {
Link Here
|
26 |
eval { require "$FindBin::Bin/../kohalib.pl" }; |
49 |
eval { require "$FindBin::Bin/../kohalib.pl" }; |
27 |
} |
50 |
} |
28 |
|
51 |
|
29 |
# cancel all expired hold requests |
|
|
30 |
|
31 |
use Koha::Script -cron; |
52 |
use Koha::Script -cron; |
32 |
use C4::Reserves; |
53 |
use C4::Reserves; |
33 |
use C4::Log; |
54 |
use C4::Log; |
34 |
|
55 |
|
|
|
56 |
=head1 OPTIONS |
57 |
|
58 |
=over 8 |
59 |
|
60 |
=item B<--help> |
61 |
|
62 |
Print a brief help message and exits. |
63 |
|
64 |
=item B<--reason> |
65 |
|
66 |
Optionally adds a reason for cancellation (which will trigger a notice to be sent to the patron) |
67 |
|
68 |
=back |
69 |
|
70 |
=cut |
71 |
|
72 |
my $help = 0; |
73 |
my $reason; |
74 |
|
75 |
GetOptions( |
76 |
'help|?' => \$help, |
77 |
'reason=s' => \$reason |
78 |
) or pod2usage(1); |
79 |
pod2usage(1) if $help; |
80 |
|
35 |
cronlogaction(); |
81 |
cronlogaction(); |
36 |
|
82 |
|
37 |
CancelExpiredReserves(); |
83 |
CancelExpiredReserves($reason); |