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

(-)a/C4/Reserves.pm (+2 lines)
Lines 999-1004 Cancels all reserves with an expiration date from before today. Link Here
999
999
1000
sub CancelExpiredReserves {
1000
sub CancelExpiredReserves {
1001
    my $cancellation_reason = shift;
1001
    my $cancellation_reason = shift;
1002
    my $notify = shift;
1002
    my $today = dt_from_string();
1003
    my $today = dt_from_string();
1003
    my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays');
1004
    my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays');
1004
    my $expireWaiting = C4::Context->preference('ExpireReservesMaxPickUpDelay');
1005
    my $expireWaiting = C4::Context->preference('ExpireReservesMaxPickUpDelay');
Lines 1023-1028 sub CancelExpiredReserves { Link Here
1023
1024
1024
        my $cancel_params = {};
1025
        my $cancel_params = {};
1025
        $cancel_params->{cancellation_reason} = $cancellation_reason if defined($cancellation_reason);
1026
        $cancel_params->{cancellation_reason} = $cancellation_reason if defined($cancellation_reason);
1027
        $cancel_params->{notify_patron} = $notify if defined($notify);
1026
        if ( defined($hold->found) && $hold->found eq 'W' ) {
1028
        if ( defined($hold->found) && $hold->found eq 'W' ) {
1027
            $cancel_params->{charge_cancel_fee} = 1;
1029
            $cancel_params->{charge_cancel_fee} = 1;
1028
        }
1030
        }
(-)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-76 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
GetOptions(
73
GetOptions(
69
    'help|?'   => \$help,
74
    'help|?'   => \$help,
70
    'reason=s' => \$reason
75
    'notify'   => \$notify,
76
    'reason=s' => \$reason,
71
) or pod2usage(1);
77
) or pod2usage(1);
72
pod2usage(1) if $help;
78
pod2usage(1) if $help;
73
79
74
cronlogaction();
80
cronlogaction();
75
81
76
C4::Reserves::CancelExpiredReserves($reason);
82
C4::Reserves::CancelExpiredReserves($reason, $notify);
77
- 

Return to bug 26282