diff --git a/misc/cronjobs/holds/holds_reminder.pl b/misc/cronjobs/holds/holds_reminder.pl index 49bccfdcde..9bd65fec13 100755 --- a/misc/cronjobs/holds/holds_reminder.pl +++ b/misc/cronjobs/holds/holds_reminder.pl @@ -57,6 +57,7 @@ holds_reminder.pl -v verbose -c --confirm confirm, if not set no email will be sent -days days waiting to deal with + -t --triggered include only holds days waiting, and not longer -lettercode predefined notice to use, default is HOLD_REMINDER -library only deal with holds from this library (repeatable : several libraries can be given) -holidays use the calendar to not count holidays as waiting days @@ -93,6 +94,13 @@ Optional parameter, number of days an items has been 'waiting' on hold to send a message for. If not included a notice will be sent to all patrons with waiting holds. +=item B<-triggered> + +Optional parameter, only sned notices for holds exactly waiting. +If not included a notice will be sent to all patrons with waiting holds +equal to OR greater than . This option is useful if the cron is +being run daily to avoid spamming the patrons. + =item B<-lettercode> Optional parameter, choose a notice to use. Default is 'HOLD_REMINDER'. @@ -167,6 +175,7 @@ my $man = 0; my $verbose = 0; my $confirm = 0; my $days ; +my $triggered = 0; my $lettercode; my @branchcodes; # Branch(es) passed as parameter my $use_calendar = 0; @@ -180,6 +189,7 @@ GetOptions( 'v' => \$verbose, 'c|confirm' => \$confirm, 'days=s' => \$days, + 'triggered' => \$triggered, 'lettercode=s' => \$lettercode, 'library=s' => \@branchcodes, 'date=s' => \$date_input, @@ -242,8 +252,9 @@ foreach my $branchcode (@branchcodes) { #BEGIN BRANCH LOOP # Find all the holds waiting since this date for the current branch my $dtf = Koha::Database->new->schema->storage->datetime_parser; my $waiting_since = $dtf->format_date( $waiting_date ); + my $comparator = $triggered ? '=' : '<='; my $reserves = Koha::Holds->search({ - waitingdate => {'<=' => $waiting_since }, + waitingdate => {$comparator => $waiting_since }, 'me.branchcode' => $branchcode, },{ prefetch => 'patron' });