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

(-)a/C4/Reserves.pm (+2 lines)
Lines 933-938 Cancels all reserves with an expiration date from before today. Link Here
933
933
934
sub CancelExpiredReserves {
934
sub CancelExpiredReserves {
935
    my $cancellation_reason = shift;
935
    my $cancellation_reason = shift;
936
    my $notify = shift;
936
    my $today = dt_from_string();
937
    my $today = dt_from_string();
937
    my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays');
938
    my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays');
938
    my $expireWaiting = C4::Context->preference('ExpireReservesMaxPickUpDelay');
939
    my $expireWaiting = C4::Context->preference('ExpireReservesMaxPickUpDelay');
Lines 957-962 sub CancelExpiredReserves { Link Here
957
958
958
        my $cancel_params = {};
959
        my $cancel_params = {};
959
        $cancel_params->{cancellation_reason} = $cancellation_reason if defined($cancellation_reason);
960
        $cancel_params->{cancellation_reason} = $cancellation_reason if defined($cancellation_reason);
961
        $cancel_params->{notify_patron} = $notify if defined($notify);
960
        if ( defined($hold->found) && $hold->found eq 'W' ) {
962
        if ( defined($hold->found) && $hold->found eq 'W' ) {
961
            $cancel_params->{charge_cancel_fee} = 1;
963
            $cancel_params->{charge_cancel_fee} = 1;
962
        }
964
        }
(-)a/misc/cronjobs/holds/cancel_expired_holds.pl (-6 / +11 lines)
Lines 25-36 cancel_expired_holds.pl - cron script to cancel holds as they expire Link Here
25
=head1 SYNOPSIS
25
=head1 SYNOPSIS
26
26
27
  ./cancel_expired_holds.pl
27
  ./cancel_expired_holds.pl
28
  ./cancel_expired_holds.pl --reason="EXPIRED"
28
  ./cancel_expired_holds.pl --reason="EXPIRED" --notify
29
29
30
or, in crontab:
30
or, in crontab:
31
31
32
  0 1 * * * cancel_expired_holds.pl
32
  0 1 * * * cancel_expired_holds.pl
33
  0 1 * * * cancel_expired_holds.pl --reason="EXPIRED"
33
  0 1 * * * cancel_expired_holds.pl --reason="EXPIRED" --notify
34
34
35
=head1 DESCRIPTION
35
=head1 DESCRIPTION
36
36
Lines 56-80 Print a brief help message and exits. Link Here
56
56
57
=item B<--reason>
57
=item B<--reason>
58
58
59
Optionally adds a reason for cancellation (which will trigger a notice to be sent to the patron)
59
Optionally adds a reason for cancellation
60
61
=item B<--notify>
62
63
Optionally trigger a notice to be sent to the patron
60
64
61
=back
65
=back
62
66
63
=cut
67
=cut
64
68
65
my $help = 0;
69
my $help = 0;
70
my $notify = 0;
66
my $reason;
71
my $reason;
67
72
68
my $command_line_options = join(" ",@ARGV);
73
my $command_line_options = join(" ",@ARGV);
69
74
70
GetOptions(
75
GetOptions(
71
    'help|?'   => \$help,
76
    'help|?'   => \$help,
72
    'reason=s' => \$reason
77
    'notify'   => \$notify,
78
    'reason=s' => \$reason,
73
) or pod2usage(1);
79
) or pod2usage(1);
74
pod2usage(1) if $help;
80
pod2usage(1) if $help;
75
81
76
cronlogaction({ info => $command_line_options });
82
cronlogaction({ info => $command_line_options });
77
83
78
C4::Reserves::CancelExpiredReserves($reason);
84
C4::Reserves::CancelExpiredReserves($reason, $notify);
79
85
80
cronlogaction({ action => 'End', info => "COMPLETED" });
86
cronlogaction({ action => 'End', info => "COMPLETED" });
81
- 

Return to bug 26282