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

(-)a/C4/Reserves.pm (+2 lines)
Lines 917-922 Cancels all reserves with an expiration date from before today. Link Here
917
917
918
sub CancelExpiredReserves {
918
sub CancelExpiredReserves {
919
    my $cancellation_reason = shift;
919
    my $cancellation_reason = shift;
920
    my $notify = shift;
920
    my $today = dt_from_string();
921
    my $today = dt_from_string();
921
    my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays');
922
    my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays');
922
    my $expireWaiting = C4::Context->preference('ExpireReservesMaxPickUpDelay');
923
    my $expireWaiting = C4::Context->preference('ExpireReservesMaxPickUpDelay');
Lines 935-940 sub CancelExpiredReserves { Link Here
935
936
936
        my $cancel_params = {};
937
        my $cancel_params = {};
937
        $cancel_params->{cancellation_reason} = $cancellation_reason if defined($cancellation_reason);
938
        $cancel_params->{cancellation_reason} = $cancellation_reason if defined($cancellation_reason);
939
        $cancel_params->{notify_patron} = $notify if defined($notify);
938
        if ( defined($hold->found) && $hold->found eq 'W' ) {
940
        if ( defined($hold->found) && $hold->found eq 'W' ) {
939
            $cancel_params->{charge_cancel_fee} = 1;
941
            $cancel_params->{charge_cancel_fee} = 1;
940
        }
942
        }
(-)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