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

(-)a/C4/Letters.pm (-4 / +14 lines)
Lines 1232-1239 sub _add_attachments { Link Here
1232
  This function's parameter hash reference takes the following
1232
  This function's parameter hash reference takes the following
1233
  optional named parameters:
1233
  optional named parameters:
1234
   message_transport_type: method of message sending (e.g. email, sms, etc.)
1234
   message_transport_type: method of message sending (e.g. email, sms, etc.)
1235
                           Can be a single string, or an arrayref of strings
1235
   borrowernumber        : who the message is to be sent
1236
   borrowernumber        : who the message is to be sent
1236
   letter_code           : type of message being sent (e.g. PASSWORD_RESET)
1237
   letter_code           : type of message being sent (e.g. PASSWORD_RESET)
1238
                           Can be a single string, or an arrayref of strings
1237
   message_id            : the message_id of the message. In that case the sub will return only 1 result
1239
   message_id            : the message_id of the message. In that case the sub will return only 1 result
1238
   limit                 : maximum number of messages to send
1240
   limit                 : maximum number of messages to send
1239
1241
Lines 1264-1275 sub _get_unsent_messages { Link Here
1264
            push @query_params, $params->{'borrowernumber'};
1266
            push @query_params, $params->{'borrowernumber'};
1265
        }
1267
        }
1266
        if ( $params->{'letter_code'} ) {
1268
        if ( $params->{'letter_code'} ) {
1267
            $statement .= ' AND mq.letter_code = ? ';
1269
            my @letter_codes = ref $params->{'letter_code'} eq "ARRAY" ? @{$params->{'letter_code'}} : $params->{'letter_code'};
1268
            push @query_params, $params->{'letter_code'};
1270
            if ( @letter_codes ) {
1271
                my $q = join( ",", ("?") x @letter_codes );
1272
                $statement .= " AND mq.letter_code IN ( $q ) ";
1273
                push @query_params, @letter_codes;
1274
            }
1269
        }
1275
        }
1270
        if ( $params->{'type'} ) {
1276
        if ( $params->{'type'} ) {
1271
            $statement .= ' AND message_transport_type = ? ';
1277
            my @types = ref $params->{'type'} eq "ARRAY" ? @{$params->{'type'}} : $params->{'type'};
1272
            push @query_params, $params->{'type'};
1278
            if ( @types ) {
1279
                my $q = join( ",", ("?") x @types );
1280
                $statement .= " AND message_transport_type IN ( $q ) ";
1281
                push @query_params, @types;
1282
            }
1273
        }
1283
        }
1274
        if ( $params->{message_id} ) {
1284
        if ( $params->{message_id} ) {
1275
            $statement .= ' AND message_id = ?';
1285
            $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
my $command_line_options = join(" ",@ARGV);
38
my $command_line_options = join(" ",@ARGV);
39
39
Lines 44-51 GetOptions( Link Here
44
    'm|method:s'        => \$method,
44
    'm|method:s'        => \$method,
45
    'h|help|?'          => \$help,
45
    'h|help|?'          => \$help,
46
    'v|verbose'         => \$verbose,
46
    'v|verbose'         => \$verbose,
47
    't|type:s'          => \$type,
47
    't|type:s'          => \@type,
48
    'c|code:s'          => \$letter_code,
48
    'c|code:s'          => \@letter_code,
49
);
49
);
50
my $usage = << 'ENDUSAGE';
50
my $usage = << 'ENDUSAGE';
51
51
Lines 58-65 advance_notices.pl script. Link Here
58
This script has the following parameters :
58
This script has the following parameters :
59
    -u --username: username of mail account
59
    -u --username: username of mail account
60
    -p --password: password of mail account
60
    -p --password: password of mail account
61
    -t --type: If supplied, only processes this type of message ( email, sms )
61
    -t --type: If supplied, only processes this type of message ( email, sms ), repeatable
62
    -c --code: If supplied, only processes messages with this letter code
62
    -c --code: If supplied, only processes messages with this letter code, repeatable
63
    -l --limit: The maximum number of messages to process for this run
63
    -l --limit: The maximum number of messages to process for this run
64
    -m --method: authentication method required by SMTP server (See perldoc Sendmail.pm for supported authentication types.)
64
    -m --method: authentication method required by SMTP server (See perldoc Sendmail.pm for supported authentication types.)
65
    -h --help: this message
65
    -h --help: this message
Lines 95-102 if ( C4::Context->config("enable_plugins") ) { Link Here
95
                    {
95
                    {
96
                        verbose     => $verbose,
96
                        verbose     => $verbose,
97
                        limit       => $limit,
97
                        limit       => $limit,
98
                        type        => $type,
98
                        type        => \@type,
99
                        letter_code => $letter_code,
99
                        letter_code => @letter_code,
100
                    }
100
                    }
101
                );
101
                );
102
            }
102
            }
Lines 114-121 C4::Letters::SendQueuedMessages( Link Here
114
        password    => $password,
114
        password    => $password,
115
        method      => $method,
115
        method      => $method,
116
        limit       => $limit,
116
        limit       => $limit,
117
        type        => $type,
117
        type        => \@type,
118
        letter_code => $letter_code,
118
        letter_code => \@letter_code,
119
    }
119
    }
120
);
120
);
121
121
122
- 

Return to bug 27265