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

(-)a/misc/cronjobs/holds/holds_reminder.pl (-2 / +12 lines)
Lines 50-55 holds_reminder.pl Link Here
50
   -v                             verbose
50
   -v                             verbose
51
   -c --confirm                   confirm, if not set no email will be sent
51
   -c --confirm                   confirm, if not set no email will be sent
52
   -days          <days>          days waiting to deal with
52
   -days          <days>          days waiting to deal with
53
   -t --triggered                 include only holds <days> days waiting, and not longer
53
   -lettercode   <lettercode>     predefined notice to use, default is HOLD_REMINDER
54
   -lettercode   <lettercode>     predefined notice to use, default is HOLD_REMINDER
54
   -library      <branchname>     only deal with holds from this library (repeatable : several libraries can be given)
55
   -library      <branchname>     only deal with holds from this library (repeatable : several libraries can be given)
55
   -holidays                      use the calendar to not count holidays as waiting days
56
   -holidays                      use the calendar to not count holidays as waiting days
Lines 86-91 Optional parameter, number of days an items has been 'waiting' on hold Link Here
86
to send a message for. If not included a notice will be sent to all
87
to send a message for. If not included a notice will be sent to all
87
patrons with waiting holds.
88
patrons with waiting holds.
88
89
90
=item B<-triggered>
91
92
Optional parameter, only sned notices for holds exactly <days> waiting.
93
If not included a notice will be sent to all patrons with waiting holds
94
equal to OR greater than <days>. This option is useful if the cron is
95
being run daily to avoid spamming the patrons.
96
89
=item B<-lettercode>
97
=item B<-lettercode>
90
98
91
Optional parameter, choose a notice to use. Default is 'HOLD_REMINDER'.
99
Optional parameter, choose a notice to use. Default is 'HOLD_REMINDER'.
Lines 160-165 my $man = 0; Link Here
160
my $verbose = 0;
168
my $verbose = 0;
161
my $confirm  = 0;
169
my $confirm  = 0;
162
my $days    ;
170
my $days    ;
171
my $triggered  = 0;
163
my $lettercode;
172
my $lettercode;
164
my @branchcodes; # Branch(es) passed as parameter
173
my @branchcodes; # Branch(es) passed as parameter
165
my $use_calendar = 0;
174
my $use_calendar = 0;
Lines 173-178 GetOptions( Link Here
173
    'v'              => \$verbose,
182
    'v'              => \$verbose,
174
    'c|confirm'      => \$confirm,
183
    'c|confirm'      => \$confirm,
175
    'days=s'         => \$days,
184
    'days=s'         => \$days,
185
    'triggered'      => \$triggered,
176
    'lettercode=s'   => \$lettercode,
186
    'lettercode=s'   => \$lettercode,
177
    'library=s'      => \@branchcodes,
187
    'library=s'      => \@branchcodes,
178
    'date=s'         => \$date_input,
188
    'date=s'         => \$date_input,
Lines 244-251 foreach my $branchcode (@branchcodes) { #BEGIN BRANCH LOOP Link Here
244
    # Find all the holds waiting since this date for the current branch
254
    # Find all the holds waiting since this date for the current branch
245
    my $dtf = Koha::Database->new->schema->storage->datetime_parser;
255
    my $dtf = Koha::Database->new->schema->storage->datetime_parser;
246
    my $waiting_since = $dtf->format_date( $waiting_date );
256
    my $waiting_since = $dtf->format_date( $waiting_date );
257
    my $comparator = $triggered ? '=' : '<=';
247
    my $reserves = Koha::Holds->search({
258
    my $reserves = Koha::Holds->search({
248
        waitingdate => {'<=' => $waiting_since },
259
        waitingdate => {$comparator => $waiting_since },
249
        'me.branchcode'  => $branchcode,
260
        'me.branchcode'  => $branchcode,
250
    },{ prefetch => 'patron' });
261
    },{ prefetch => 'patron' });
251
262
252
- 

Return to bug 29704