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

(-)a/C4/Letters.pm (-4 / +14 lines)
Lines 1231-1238 sub _add_attachments { Link Here
1231
  This function's parameter hash reference takes the following
1231
  This function's parameter hash reference takes the following
1232
  optional named parameters:
1232
  optional named parameters:
1233
   message_transport_type: method of message sending (e.g. email, sms, etc.)
1233
   message_transport_type: method of message sending (e.g. email, sms, etc.)
1234
                           Can be a single string, or an arrayref of strings
1234
   borrowernumber        : who the message is to be sent
1235
   borrowernumber        : who the message is to be sent
1235
   letter_code           : type of message being sent (e.g. PASSWORD_RESET)
1236
   letter_code           : type of message being sent (e.g. PASSWORD_RESET)
1237
                           Can be a single string, or an arrayref of strings
1236
   message_id            : the message_id of the message. In that case the sub will return only 1 result
1238
   message_id            : the message_id of the message. In that case the sub will return only 1 result
1237
   limit                 : maximum number of messages to send
1239
   limit                 : maximum number of messages to send
1238
1240
Lines 1263-1274 sub _get_unsent_messages { Link Here
1263
            push @query_params, $params->{'borrowernumber'};
1265
            push @query_params, $params->{'borrowernumber'};
1264
        }
1266
        }
1265
        if ( $params->{'letter_code'} ) {
1267
        if ( $params->{'letter_code'} ) {
1266
            $statement .= ' AND mq.letter_code = ? ';
1268
            my @letter_codes = ref $params->{'letter_code'} eq "ARRAY" ? @{$params->{'letter_code'}} : $params->{'letter_code'};
1267
            push @query_params, $params->{'letter_code'};
1269
            if ( @letter_codes ) {
1270
                my $q = join( ",", ("?") x @letter_codes );
1271
                $statement .= " AND mq.letter_code IN ( $q ) ";
1272
                push @query_params, @letter_codes;
1273
            }
1268
        }
1274
        }
1269
        if ( $params->{'type'} ) {
1275
        if ( $params->{'type'} ) {
1270
            $statement .= ' AND message_transport_type = ? ';
1276
            my @types = ref $params->{'type'} eq "ARRAY" ? @{$params->{'type'}} : $params->{'type'};
1271
            push @query_params, $params->{'type'};
1277
            if ( @types ) {
1278
                my $q = join( ",", ("?") x @types );
1279
                $statement .= " AND message_transport_type IN ( $q ) ";
1280
                push @query_params, @types;
1281
            }
1272
        }
1282
        }
1273
        if ( $params->{message_id} ) {
1283
        if ( $params->{message_id} ) {
1274
            $statement .= ' AND message_id = ?';
1284
            $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 93-100 if ( C4::Context->config("enable_plugins") ) { Link Here
93
                    {
93
                    {
94
                        verbose     => $verbose,
94
                        verbose     => $verbose,
95
                        limit       => $limit,
95
                        limit       => $limit,
96
                        type        => $type,
96
                        type        => \@type,
97
                        letter_code => $letter_code,
97
                        letter_code => @letter_code,
98
                    }
98
                    }
99
                );
99
                );
100
            }
100
            }
Lines 112-119 C4::Letters::SendQueuedMessages( Link Here
112
        password    => $password,
112
        password    => $password,
113
        method      => $method,
113
        method      => $method,
114
        limit       => $limit,
114
        limit       => $limit,
115
        type        => $type,
115
        type        => \@type,
116
        letter_code => $letter_code,
116
        letter_code => \@letter_code,
117
    }
117
    }
118
);
118
);
119
119
120
- 

Return to bug 27265