@@ -, +, @@ update reserves set waitingdate = DATE_SUB(CURDATE(), INTERVAL 5 DAY); perl misc/cronjobs/holds/holds_reminder.pl -v --days 4 --- misc/cronjobs/holds/holds_reminder.pl | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) --- a/misc/cronjobs/holds/holds_reminder.pl +++ a/misc/cronjobs/holds/holds_reminder.pl @@ -50,6 +50,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 @@ -86,6 +87,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'. @@ -160,6 +168,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; @@ -173,6 +182,7 @@ GetOptions( 'v' => \$verbose, 'c|confirm' => \$confirm, 'days=s' => \$days, + 'triggered' => \$triggered, 'lettercode=s' => \$lettercode, 'library=s' => \@branchcodes, 'date=s' => \$date_input, @@ -244,8 +254,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' }); --