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

(-)a/C4/Letters.pm (-4 / +14 lines)
Lines 1269-1276 sub _add_attachments { Link Here
1269
  This function's parameter hash reference takes the following
1269
  This function's parameter hash reference takes the following
1270
  optional named parameters:
1270
  optional named parameters:
1271
   message_transport_type: method of message sending (e.g. email, sms, etc.)
1271
   message_transport_type: method of message sending (e.g. email, sms, etc.)
1272
                           Can be a single string, or an arrayref of strings
1272
   borrowernumber        : who the message is to be sent
1273
   borrowernumber        : who the message is to be sent
1273
   letter_code           : type of message being sent (e.g. PASSWORD_RESET)
1274
   letter_code           : type of message being sent (e.g. PASSWORD_RESET)
1275
                           Can be a single string, or an arrayref of strings
1274
   message_id            : the message_id of the message. In that case the sub will return only 1 result
1276
   message_id            : the message_id of the message. In that case the sub will return only 1 result
1275
   limit                 : maximum number of messages to send
1277
   limit                 : maximum number of messages to send
1276
1278
Lines 1301-1312 sub _get_unsent_messages { Link Here
1301
            push @query_params, $params->{'borrowernumber'};
1303
            push @query_params, $params->{'borrowernumber'};
1302
        }
1304
        }
1303
        if ( $params->{'letter_code'} ) {
1305
        if ( $params->{'letter_code'} ) {
1304
            $statement .= ' AND mq.letter_code = ? ';
1306
            my @letter_codes = ref $params->{'letter_code'} eq "ARRAY" ? @{$params->{'letter_code'}} : $params->{'letter_code'};
1305
            push @query_params, $params->{'letter_code'};
1307
            if ( @letter_codes ) {
1308
                my $q = join( ",", ("?") x @letter_codes );
1309
                $statement .= " AND mq.letter_code IN ( $q ) ";
1310
                push @query_params, @letter_codes;
1311
            }
1306
        }
1312
        }
1307
        if ( $params->{'type'} ) {
1313
        if ( $params->{'type'} ) {
1308
            $statement .= ' AND message_transport_type = ? ';
1314
            my @types = ref $params->{'type'} eq "ARRAY" ? @{$params->{'type'}} : $params->{'type'};
1309
            push @query_params, $params->{'type'};
1315
            if ( @types ) {
1316
                my $q = join( ",", ("?") x @types );
1317
                $statement .= " AND message_transport_type IN ( $q ) ";
1318
                push @query_params, @types;
1319
            }
1310
        }
1320
        }
1311
        if ( $params->{message_id} ) {
1321
        if ( $params->{message_id} ) {
1312
            $statement .= ' AND message_id = ?';
1322
            $statement .= ' AND message_id = ?';
(-)a/misc/cronjobs/process_message_queue.pl (-9 / +8 lines)
Lines 38-45 my $limit = undef; Link Here
38
my $method = 'LOGIN';
38
my $method = 'LOGIN';
39
my $help = 0;
39
my $help = 0;
40
my $verbose = 0;
40
my $verbose = 0;
41
my $type = q{};
41
my @type;
42
my $letter_code;
42
my @letter_code;
43
43
44
GetOptions(
44
GetOptions(
45
    'u|username:s'      => \$username,
45
    'u|username:s'      => \$username,
Lines 48-55 GetOptions( Link Here
48
    'm|method:s'        => \$method,
48
    'm|method:s'        => \$method,
49
    'h|help|?'          => \$help,
49
    'h|help|?'          => \$help,
50
    'v|verbose'         => \$verbose,
50
    'v|verbose'         => \$verbose,
51
    't|type:s'          => \$type,
51
    't|type:s'          => \@type,
52
    'c|code:s'          => \$letter_code,
52
    'c|code:s'          => \@letter_code,
53
);
53
);
54
my $usage = << 'ENDUSAGE';
54
my $usage = << 'ENDUSAGE';
55
55
Lines 62-69 advance_notices.pl script. Link Here
62
This script has the following parameters :
62
This script has the following parameters :
63
    -u --username: username of mail account
63
    -u --username: username of mail account
64
    -p --password: password of mail account
64
    -p --password: password of mail account
65
    -t --type: If supplied, only processes this type of message ( email, sms )
65
    -t --type: If supplied, only processes this type of message ( email, sms ), repeatable
66
    -c --code: If supplied, only processes messages with this letter code
66
    -c --code: If supplied, only processes messages with this letter code, repeatable
67
    -l --limit: The maximum number of messages to process for this run
67
    -l --limit: The maximum number of messages to process for this run
68
    -m --method: authentication method required by SMTP server (See perldoc Sendmail.pm for supported authentication types.)
68
    -m --method: authentication method required by SMTP server (See perldoc Sendmail.pm for supported authentication types.)
69
    -h --help: this message
69
    -h --help: this message
Lines 98-105 C4::Letters::SendQueuedMessages( Link Here
98
        password    => $password,
98
        password    => $password,
99
        method      => $method,
99
        method      => $method,
100
        limit       => $limit,
100
        limit       => $limit,
101
        type        => $type,
101
        type        => \@type,
102
        letter_code => $letter_code,
102
        letter_code => \@letter_code,
103
    }
103
    }
104
);
104
);
105
105
106
- 

Return to bug 27265