@@ -, +, @@ cancel_expired_holds --- C4/Reserves.pm | 2 ++ misc/cronjobs/holds/cancel_expired_holds.pl | 16 +++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) --- a/C4/Reserves.pm +++ a/C4/Reserves.pm @@ -914,6 +914,7 @@ Cancels all reserves with an expiration date from before today. sub CancelExpiredReserves { my $cancellation_reason = shift; + my $notify = shift; my $today = dt_from_string(); my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays'); my $expireWaiting = C4::Context->preference('ExpireReservesMaxPickUpDelay'); @@ -932,6 +933,7 @@ sub CancelExpiredReserves { my $cancel_params = {}; $cancel_params->{cancellation_reason} = $cancellation_reason if defined($cancellation_reason); + $cancel_params->{notify_patron} = $notify if defined($notify); if ( defined($hold->found) && $hold->found eq 'W' ) { $cancel_params->{charge_cancel_fee} = 1; } --- a/misc/cronjobs/holds/cancel_expired_holds.pl +++ a/misc/cronjobs/holds/cancel_expired_holds.pl @@ -25,12 +25,12 @@ cancel_expired_holds.pl - cron script to cancel holds as they expire =head1 SYNOPSIS ./cancel_expired_holds.pl - ./cancel_expired_holds.pl --reason="EXPIRED" + ./cancel_expired_holds.pl --reason="EXPIRED" --notify or, in crontab: 0 1 * * * cancel_expired_holds.pl - 0 1 * * * cancel_expired_holds.pl --reason="EXPIRED" + 0 1 * * * cancel_expired_holds.pl --reason="EXPIRED" --notify =head1 DESCRIPTION @@ -63,21 +63,27 @@ Print a brief help message and exits. =item B<--reason> -Optionally adds a reason for cancellation (which will trigger a notice to be sent to the patron) +Optionally adds a reason for cancellation + +=item B<--notify> + +Optionally trigger a notice to be sent to the patron =back =cut my $help = 0; +my $notify = 0; my $reason; GetOptions( 'help|?' => \$help, - 'reason=s' => \$reason + 'notify' => \$notify, + 'reason=s' => \$reason, ) or pod2usage(1); pod2usage(1) if $help; cronlogaction(); -CancelExpiredReserves($reason); +CancelExpiredReserves($reason, $notify); --