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

(-)a/C4/Reserves.pm (+2 lines)
Lines 938-943 Cancels all reserves with an expiration date from before today. Link Here
938
938
939
sub CancelExpiredReserves {
939
sub CancelExpiredReserves {
940
    my $cancellation_reason = shift;
940
    my $cancellation_reason = shift;
941
    my $notify = shift;
941
    my $today = dt_from_string();
942
    my $today = dt_from_string();
942
    my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays');
943
    my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays');
943
    my $expireWaiting = C4::Context->preference('ExpireReservesMaxPickUpDelay');
944
    my $expireWaiting = C4::Context->preference('ExpireReservesMaxPickUpDelay');
Lines 956-961 sub CancelExpiredReserves { Link Here
956
957
957
        my $cancel_params = {};
958
        my $cancel_params = {};
958
        $cancel_params->{cancellation_reason} = $cancellation_reason if defined($cancellation_reason);
959
        $cancel_params->{cancellation_reason} = $cancellation_reason if defined($cancellation_reason);
960
        $cancel_params->{notify_patron} = $notify if defined($notify);
959
        if ( defined($hold->found) && $hold->found eq 'W' ) {
961
        if ( defined($hold->found) && $hold->found eq 'W' ) {
960
            $cancel_params->{charge_cancel_fee} = 1;
962
            $cancel_params->{charge_cancel_fee} = 1;
961
        }
963
        }
(-)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 63-83 Print a brief help message and exits. Link Here
63
63
64
=item B<--reason>
64
=item B<--reason>
65
65
66
Optionally adds a reason for cancellation (which will trigger a notice to be sent to the patron)
66
Optionally adds a reason for cancellation
67
68
=item B<--notify>
69
70
Optionally trigger a notice to be sent to the patron
67
71
68
=back
72
=back
69
73
70
=cut
74
=cut
71
75
72
my $help = 0;
76
my $help = 0;
77
my $notify = 0;
73
my $reason;
78
my $reason;
74
79
75
GetOptions(
80
GetOptions(
76
    'help|?'   => \$help,
81
    'help|?'   => \$help,
77
    'reason=s' => \$reason
82
    'notify'   => \$notify,
83
    'reason=s' => \$reason,
78
) or pod2usage(1);
84
) or pod2usage(1);
79
pod2usage(1) if $help;
85
pod2usage(1) if $help;
80
86
81
cronlogaction();
87
cronlogaction();
82
88
83
CancelExpiredReserves($reason);
89
CancelExpiredReserves($reason, $notify);
84
- 

Return to bug 26282