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

(-)a/misc/cronjobs/membership_expiry.pl (-10 / +31 lines)
Lines 34-40 Options: Link Here
34
   --man                    full documentation
34
   --man                    full documentation
35
   --where <conditions>     where clause to add to the query
35
   --where <conditions>     where clause to add to the query
36
   -v -verbose              verbose mode
36
   -v -verbose              verbose mode
37
   -n --nomail              if supplied messages will be output to STDOUT and not sent
37
   -n --nomail              if supplied, messages will be output to STDOUT and no email or sms will be sent
38
   -c --confirm             commit changes to db, no action will be taken unless this switch is included
38
   -c --confirm             commit changes to db, no action will be taken unless this switch is included
39
   -b --branch <branchname> only deal with patrons from this library/branch
39
   -b --branch <branchname> only deal with patrons from this library/branch
40
   --before=X               include patrons expiring a number of days BEFORE the date set by the preference
40
   --before=X               include patrons expiring a number of days BEFORE the date set by the preference
Lines 43-49 Options: Link Here
43
43
44
=head1 DESCRIPTION
44
=head1 DESCRIPTION
45
45
46
This script sends membership expiry reminder notices to patrons.
46
This script sends membership expiry reminder notices to patrons, by email and sms.
47
It queues them in the message queue, which is processed by
47
It queues them in the message queue, which is processed by
48
the process_message_queue.pl cronjob.
48
the process_message_queue.pl cronjob.
49
49
Lines 218-230 while ( my $recent = $upcoming_mem_expires->next ) { Link Here
218
    last if !$letter; # Letters.pm already warned, just exit
218
    last if !$letter; # Letters.pm already warned, just exit
219
    if( $nomail ) {
219
    if( $nomail ) {
220
        print $letter->{'content'}."\n";
220
        print $letter->{'content'}."\n";
221
    } else {
221
        next;
222
        C4::Letters::EnqueueLetter({
222
    }
223
            letter                 => $letter,
223
224
            borrowernumber         =>  $recent->borrowernumber,
224
    C4::Letters::EnqueueLetter({
225
            from_address           => $from_address,
225
        letter                 => $letter,
226
            message_transport_type => 'email',
226
        borrowernumber         =>  $recent->borrowernumber,
227
        });
227
        from_address           => $from_address,
228
        message_transport_type => 'email',
229
    });
230
231
    if ($recent->smsalertnumber) {
232
        my $smsletter = C4::Letters::GetPreparedLetter(
233
            module      => 'members',
234
            letter_code => $letter_type,
235
            branchcode  => $recent->branchcode,
236
            lang        => $recent->lang,
237
            tables      => {
238
                borrowers => $recent->borrowernumber,
239
                branches  => $recent->branchcode,
240
            },
241
            message_transport_type => 'sms',
242
        );
243
        if ($smsletter) {
244
            C4::Letters::EnqueueLetter({
245
                letter                 => $smsletter,
246
                borrowernumber         => $recent->borrowernumber,
247
                message_transport_type => 'sms',
248
            });
249
        }
228
    }
250
    }
229
}
251
}
230
252
231
- 

Return to bug 23773