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

(-)a/misc/cronjobs/holds/holds_reminder.pl (-5 / +17 lines)
Lines 31-36 use Koha::Libraries; Link Here
31
use Koha::Notice::Templates;
31
use Koha::Notice::Templates;
32
use Koha::Patrons;
32
use Koha::Patrons;
33
use Koha::Script -cron;
33
use Koha::Script -cron;
34
use Data::Dumper;
34
35
35
=head1 NAME
36
=head1 NAME
36
37
Lines 42-48 holds_reminder.pl Link Here
42
  -lettercode <notice to send>
43
  -lettercode <notice to send>
43
  [ -c ][ -v ][ -library <branchcode> ][ -library <branchcode> ... ]
44
  [ -c ][ -v ][ -library <branchcode> ][ -library <branchcode> ... ]
44
  [ -days <number of days> ][ -mtt <transport type> ... ][ -holidays ]
45
  [ -days <number of days> ][ -mtt <transport type> ... ][ -holidays ]
45
  [ -date <YYYY-MM-DD> ]
46
  [ -date <YYYY-MM-DD> ][ -o ]
46
47
47
 Options:
48
 Options:
48
   -help                          brief help message
49
   -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
59
                                  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
60
                                  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
61
   -date                          Send notices as would have been sent on a specific date
62
   - o --open                     Do not send the message on closed days
61
63
62
=head1 OPTIONS
64
=head1 OPTIONS
63
65
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
122
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
123
Email and SMS will fall back to print if there is no valid info in the patron's account
122
124
125
=item B<-o> | B<--open>
126
127
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
128
124
=back
129
=back
125
130
Lines 175-180 my $use_calendar = 0; Link Here
175
my $date_input;
180
my $date_input;
176
my $opt_out = 0;
181
my $opt_out = 0;
177
my @mtts;
182
my @mtts;
183
my $open = 0;
178
184
179
my $command_line_options = join( " ", @ARGV );
185
my $command_line_options = join( " ", @ARGV );
180
cronlogaction( { info => $command_line_options } );
186
cronlogaction( { info => $command_line_options } );
Lines 190-196 GetOptions( Link Here
190
    'library=s'    => \@branchcodes,
196
    'library=s'    => \@branchcodes,
191
    'date=s'       => \$date_input,
197
    'date=s'       => \$date_input,
192
    'holidays'     => \$use_calendar,
198
    'holidays'     => \$use_calendar,
193
    'mtt=s'        => \@mtts
199
    'mtt=s'        => \@mtts,
200
    'open'         => \$open
194
);
201
);
195
pod2usage(1)               if $help;
202
pod2usage(1)               if $help;
196
pod2usage( -verbose => 2 ) if $man;
203
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
250
    # If respecting calendar get the correct waiting since date
244
    my $waiting_date;
251
    my $waiting_date;
245
    if ($use_calendar) {
252
    if ($use_calendar) {
253
        my $today    = $date_to_run;
246
        my $calendar = Koha::Calendar->new( branchcode => $branchcode, days_mode => 'Calendar' );
254
        my $calendar = Koha::Calendar->new( branchcode => $branchcode, days_mode => 'Calendar' );
247
        my $duration = DateTime::Duration->new( days => -$days );
255
248
        $waiting_date = $calendar->addDays( $date_to_run, $duration );    #Add negative of days
256
        #if today is a holiday skip sending the message
257
        next if $calendar->is_holiday($today);
258
        {
259
            my $duration = DateTime::Duration->new( days => -$days );
260
            $waiting_date = $calendar->addDays( $date_to_run, $duration );    #Add negative of days
261
        }
249
    } else {
262
    } else {
250
        $waiting_date = $waiting_date_static;
263
        $waiting_date = $waiting_date_static;
251
    }
264
    }
252
- 

Return to bug 35700