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

(-)a/misc/cronjobs/holds/holds_reminder.pl (-5 / +16 lines)
Lines 42-48 holds_reminder.pl Link Here
42
  -lettercode <notice to send>
42
  -lettercode <notice to send>
43
  [ -c ][ -v ][ -library <branchcode> ][ -library <branchcode> ... ]
43
  [ -c ][ -v ][ -library <branchcode> ][ -library <branchcode> ... ]
44
  [ -days <number of days> ][ -mtt <transport type> ... ][ -holidays ]
44
  [ -days <number of days> ][ -mtt <transport type> ... ][ -holidays ]
45
  [ -date <YYYY-MM-DD> ]
45
  [ -date <YYYY-MM-DD> ][ -o ]
46
46
47
 Options:
47
 Options:
48
   -help                          brief help message
48
   -help                          brief help message
Lines 58-63 holds_reminder.pl Link Here
58
                                  populating this will force send even if patron has not chosen to receive hold notices
58
                                  populating this will force send even if patron has not chosen to receive hold notices
59
                                  email and sms will fallback to print if borrower does not have an address/phone
59
                                  email and sms will fallback to print if borrower does not have an address/phone
60
   -date                          Send notices as would have been sent on a specific date
60
   -date                          Send notices as would have been sent on a specific date
61
   - o --open                     Do not send the message on closed days
61
62
62
=head1 OPTIONS
63
=head1 OPTIONS
63
64
Lines 120-125 If omitted the patron's messaging preferences for Hold notices will be used. Link Here
120
If supplied the notice types will be force sent even if patron has not selected hold notices
121
If supplied the notice types will be force sent even if patron has not selected hold notices
121
Email and SMS will fall back to print if there is no valid info in the patron's account
122
Email and SMS will fall back to print if there is no valid info in the patron's account
122
123
124
=item B<-o> | B<--open>
125
126
This option determines whether library holidays are skipped when sending the message. If so reminders should be sent the next open day. Must be used with holidays
123
127
124
=back
128
=back
125
129
Lines 175-180 my $use_calendar = 0; Link Here
175
my $date_input;
179
my $date_input;
176
my $opt_out = 0;
180
my $opt_out = 0;
177
my @mtts;
181
my @mtts;
182
my $open = 0;
178
183
179
my $command_line_options = join( " ", @ARGV );
184
my $command_line_options = join( " ", @ARGV );
180
cronlogaction( { info => $command_line_options } );
185
cronlogaction( { info => $command_line_options } );
Lines 190-196 GetOptions( Link Here
190
    'library=s'    => \@branchcodes,
195
    'library=s'    => \@branchcodes,
191
    'date=s'       => \$date_input,
196
    'date=s'       => \$date_input,
192
    'holidays'     => \$use_calendar,
197
    'holidays'     => \$use_calendar,
193
    'mtt=s'        => \@mtts
198
    'mtt=s'        => \@mtts,
199
    'open'         => \$open
194
);
200
);
195
pod2usage(1)               if $help;
201
pod2usage(1)               if $help;
196
pod2usage( -verbose => 2 ) if $man;
202
pod2usage( -verbose => 2 ) if $man;
Lines 243-251 foreach my $branchcode (@branchcodes) { #BEGIN BRANCH LOOP Link Here
243
    # If respecting calendar get the correct waiting since date
249
    # If respecting calendar get the correct waiting since date
244
    my $waiting_date;
250
    my $waiting_date;
245
    if ($use_calendar) {
251
    if ($use_calendar) {
252
        my $today    = $date_to_run;
246
        my $calendar = Koha::Calendar->new( branchcode => $branchcode, days_mode => 'Calendar' );
253
        my $calendar = Koha::Calendar->new( branchcode => $branchcode, days_mode => 'Calendar' );
247
        my $duration = DateTime::Duration->new( days => -$days );
254
248
        $waiting_date = $calendar->addDays( $date_to_run, $duration );    #Add negative of days
255
        #if today is a holiday skip sending the message
256
        next if $calendar->is_holiday($today);
257
        {
258
            my $duration = DateTime::Duration->new( days => -$days );
259
            $waiting_date = $calendar->addDays( $date_to_run, $duration );    #Add negative of days
260
        }
249
    } else {
261
    } else {
250
        $waiting_date = $waiting_date_static;
262
        $waiting_date = $waiting_date_static;
251
    }
263
    }
252
- 

Return to bug 35700