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

(-)a/C4/Letters.pm (-4 / +14 lines)
Lines 1273-1280 sub _add_attachments { Link Here
1273
  This function's parameter hash reference takes the following
1273
  This function's parameter hash reference takes the following
1274
  optional named parameters:
1274
  optional named parameters:
1275
   message_transport_type: method of message sending (e.g. email, sms, etc.)
1275
   message_transport_type: method of message sending (e.g. email, sms, etc.)
1276
                           Can be a single string, or an arrayref of strings
1276
   borrowernumber        : who the message is to be sent
1277
   borrowernumber        : who the message is to be sent
1277
   letter_code           : type of message being sent (e.g. PASSWORD_RESET)
1278
   letter_code           : type of message being sent (e.g. PASSWORD_RESET)
1279
                           Can be a single string, or an arrayref of strings
1278
   message_id            : the message_id of the message. In that case the sub will return only 1 result
1280
   message_id            : the message_id of the message. In that case the sub will return only 1 result
1279
   limit                 : maximum number of messages to send
1281
   limit                 : maximum number of messages to send
1280
1282
Lines 1305-1316 sub _get_unsent_messages { Link Here
1305
            push @query_params, $params->{'borrowernumber'};
1307
            push @query_params, $params->{'borrowernumber'};
1306
        }
1308
        }
1307
        if ( $params->{'letter_code'} ) {
1309
        if ( $params->{'letter_code'} ) {
1308
            $statement .= ' AND mq.letter_code = ? ';
1310
            my @letter_codes = ref $params->{'letter_code'} eq "ARRAY" ? @{$params->{'letter_code'}} : $params->{'letter_code'};
1309
            push @query_params, $params->{'letter_code'};
1311
            if ( @letter_codes ) {
1312
                my $q = join( ",", ("?") x @letter_codes );
1313
                $statement .= " AND mq.letter_code IN ( $q ) ";
1314
                push @query_params, @letter_codes;
1315
            }
1310
        }
1316
        }
1311
        if ( $params->{'type'} ) {
1317
        if ( $params->{'type'} ) {
1312
            $statement .= ' AND message_transport_type = ? ';
1318
            my @types = ref $params->{'type'} eq "ARRAY" ? @{$params->{'type'}} : $params->{'type'};
1313
            push @query_params, $params->{'type'};
1319
            if ( @types ) {
1320
                my $q = join( ",", ("?") x @types );
1321
                $statement .= " AND message_transport_type IN ( $q ) ";
1322
                push @query_params, @types;
1323
            }
1314
        }
1324
        }
1315
        if ( $params->{message_id} ) {
1325
        if ( $params->{message_id} ) {
1316
            $statement .= ' AND message_id = ?';
1326
            $statement .= ' AND message_id = ?';
(-)a/misc/cronjobs/process_message_queue.pl (-11 / +10 lines)
Lines 32-39 my $limit = undef; Link Here
32
my $method = 'LOGIN';
32
my $method = 'LOGIN';
33
my $help = 0;
33
my $help = 0;
34
my $verbose = 0;
34
my $verbose = 0;
35
my $type = q{};
35
my @type;
36
my $letter_code;
36
my @letter_code;
37
37
38
GetOptions(
38
GetOptions(
39
    'u|username:s'      => \$username,
39
    'u|username:s'      => \$username,
Lines 42-49 GetOptions( Link Here
42
    'm|method:s'        => \$method,
42
    'm|method:s'        => \$method,
43
    'h|help|?'          => \$help,
43
    'h|help|?'          => \$help,
44
    'v|verbose'         => \$verbose,
44
    'v|verbose'         => \$verbose,
45
    't|type:s'          => \$type,
45
    't|type:s'          => \@type,
46
    'c|code:s'          => \$letter_code,
46
    'c|code:s'          => \@letter_code,
47
);
47
);
48
my $usage = << 'ENDUSAGE';
48
my $usage = << 'ENDUSAGE';
49
49
Lines 56-63 advance_notices.pl script. Link Here
56
This script has the following parameters :
56
This script has the following parameters :
57
    -u --username: username of mail account
57
    -u --username: username of mail account
58
    -p --password: password of mail account
58
    -p --password: password of mail account
59
    -t --type: If supplied, only processes this type of message ( email, sms )
59
    -t --type: If supplied, only processes this type of message ( email, sms ), repeatable
60
    -c --code: If supplied, only processes messages with this letter code
60
    -c --code: If supplied, only processes messages with this letter code, repeatable
61
    -l --limit: The maximum number of messages to process for this run
61
    -l --limit: The maximum number of messages to process for this run
62
    -m --method: authentication method required by SMTP server (See perldoc Sendmail.pm for supported authentication types.)
62
    -m --method: authentication method required by SMTP server (See perldoc Sendmail.pm for supported authentication types.)
63
    -h --help: this message
63
    -h --help: this message
Lines 80-87 if ( C4::Context->config("enable_plugins") ) { Link Here
80
                    {
80
                    {
81
                        verbose     => $verbose,
81
                        verbose     => $verbose,
82
                        limit       => $limit,
82
                        limit       => $limit,
83
                        type        => $type,
83
                        type        => \@type,
84
                        letter_code => $letter_code,
84
                        letter_code => @letter_code,
85
                    }
85
                    }
86
                );
86
                );
87
            }
87
            }
Lines 99-106 C4::Letters::SendQueuedMessages( Link Here
99
        password    => $password,
99
        password    => $password,
100
        method      => $method,
100
        method      => $method,
101
        limit       => $limit,
101
        limit       => $limit,
102
        type        => $type,
102
        type        => \@type,
103
        letter_code => $letter_code,
103
        letter_code => \@letter_code,
104
    }
104
    }
105
);
105
);
106
106
107
- 

Return to bug 27265