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

(-)a/C4/Letters.pm (-4 / +14 lines)
Lines 1262-1269 sub _add_attachments { Link Here
1262
  This function's parameter hash reference takes the following
1262
  This function's parameter hash reference takes the following
1263
  optional named parameters:
1263
  optional named parameters:
1264
   message_transport_type: method of message sending (e.g. email, sms, etc.)
1264
   message_transport_type: method of message sending (e.g. email, sms, etc.)
1265
                           Can be a single string, or an arrayref of strings
1265
   borrowernumber        : who the message is to be sent
1266
   borrowernumber        : who the message is to be sent
1266
   letter_code           : type of message being sent (e.g. PASSWORD_RESET)
1267
   letter_code           : type of message being sent (e.g. PASSWORD_RESET)
1268
                           Can be a single string, or an arrayref of strings
1267
   limit                 : maximum number of messages to send
1269
   limit                 : maximum number of messages to send
1268
1270
1269
  This function returns an array of matching hash referenced rows from
1271
  This function returns an array of matching hash referenced rows from
Lines 1293-1304 sub _get_unsent_messages { Link Here
1293
            push @query_params, $params->{'borrowernumber'};
1295
            push @query_params, $params->{'borrowernumber'};
1294
        }
1296
        }
1295
        if ( $params->{'letter_code'} ) {
1297
        if ( $params->{'letter_code'} ) {
1296
            $statement .= ' AND mq.letter_code = ? ';
1298
            my @letter_codes = ref $params->{'letter_code'} eq "ARRAY" ? @{$params->{'letter_code'}} : $params->{'letter_code'};
1297
            push @query_params, $params->{'letter_code'};
1299
            if ( @letter_codes ) {
1300
                my $q = join( ",", "?" x @letter_codes );
1301
                $statement .= " AND mq.letter_code IN ( $q ) ";
1302
                push @query_params, @letter_codes;
1303
            }
1298
        }
1304
        }
1299
        if ( $params->{'type'} ) {
1305
        if ( $params->{'type'} ) {
1300
            $statement .= ' AND message_transport_type = ? ';
1306
            my @types = ref $params->{'type'} eq "ARRAY" ? @{$params->{'type'}} : $params->{'type'};
1301
            push @query_params, $params->{'type'};
1307
            if ( @types ) {
1308
                my $q = join( ",", "?" x @types );
1309
                $statement .= " AND message_transport_type IN ($q) ";
1310
                push @query_params, @types;
1311
            }
1302
        }
1312
        }
1303
        if ( $params->{'limit'} ) {
1313
        if ( $params->{'limit'} ) {
1304
            $statement .= ' limit ? ';
1314
            $statement .= ' limit ? ';
(-)a/misc/cronjobs/process_message_queue.pl (-9 / +8 lines)
Lines 37-44 my $limit = undef; Link Here
37
my $method = 'LOGIN';
37
my $method = 'LOGIN';
38
my $help = 0;
38
my $help = 0;
39
my $verbose = 0;
39
my $verbose = 0;
40
my $type = q{};
40
my @type;
41
my $letter_code;
41
my @letter_code;
42
42
43
GetOptions(
43
GetOptions(
44
    'u|username:s'      => \$username,
44
    'u|username:s'      => \$username,
Lines 47-54 GetOptions( Link Here
47
    'm|method:s'        => \$method,
47
    'm|method:s'        => \$method,
48
    'h|help|?'          => \$help,
48
    'h|help|?'          => \$help,
49
    'v|verbose'         => \$verbose,
49
    'v|verbose'         => \$verbose,
50
    't|type:s'          => \$type,
50
    't|type:s'          => \@type,
51
    'c|code:s'          => \$letter_code,
51
    'c|code:s'          => \@letter_code,
52
);
52
);
53
my $usage = << 'ENDUSAGE';
53
my $usage = << 'ENDUSAGE';
54
54
Lines 61-68 advance_notices.pl script. Link Here
61
This script has the following parameters :
61
This script has the following parameters :
62
    -u --username: username of mail account
62
    -u --username: username of mail account
63
    -p --password: password of mail account
63
    -p --password: password of mail account
64
    -t --type: If supplied, only processes this type of message ( email, sms )
64
    -t --type: If supplied, only processes this type of message ( email, sms ), repeatable
65
    -c --code: If supplied, only processes messages with this letter code
65
    -c --code: If supplied, only processes messages with this letter code, repeatable
66
    -l --limit: The maximum number of messages to process for this run
66
    -l --limit: The maximum number of messages to process for this run
67
    -m --method: authentication method required by SMTP server (See perldoc Sendmail.pm for supported authentication types.)
67
    -m --method: authentication method required by SMTP server (See perldoc Sendmail.pm for supported authentication types.)
68
    -h --help: this message
68
    -h --help: this message
Lines 97-104 C4::Letters::SendQueuedMessages( Link Here
97
        password    => $password,
97
        password    => $password,
98
        method      => $method,
98
        method      => $method,
99
        limit       => $limit,
99
        limit       => $limit,
100
        type        => $type,
100
        type        => \@type,
101
        letter_code => $letter_code,
101
        letter_code => \@letter_code,
102
    }
102
    }
103
);
103
);
104
104
105
- 

Return to bug 27265