Lines 1023-1029
ENDSQL
Link Here
|
1023 |
|
1023 |
|
1024 |
=head2 SendQueuedMessages ([$hashref]) |
1024 |
=head2 SendQueuedMessages ([$hashref]) |
1025 |
|
1025 |
|
1026 |
my $sent = SendQueuedMessages({ verbose => 1, limit => 50 }); |
1026 |
my $sent = SendQueuedMessages({ verbose => 1, limit => 50, type => 'sms' }); |
1027 |
|
1027 |
|
1028 |
Sends all of the 'pending' items in the message queue, unless the optional |
1028 |
Sends all of the 'pending' items in the message queue, unless the optional |
1029 |
limit parameter is passed too. The verbose parameter is also optional. |
1029 |
limit parameter is passed too. The verbose parameter is also optional. |
Lines 1035-1041
Returns number of messages sent.
Link Here
|
1035 |
sub SendQueuedMessages { |
1035 |
sub SendQueuedMessages { |
1036 |
my $params = shift; |
1036 |
my $params = shift; |
1037 |
|
1037 |
|
1038 |
my $unsent_messages = _get_unsent_messages( { limit => $params->{limit} } ); |
1038 |
my $unsent_messages = _get_unsent_messages( { limit => $params->{limit}, type => $params->{type} } ); |
1039 |
MESSAGE: foreach my $message ( @$unsent_messages ) { |
1039 |
MESSAGE: foreach my $message ( @$unsent_messages ) { |
1040 |
# warn Data::Dumper->Dump( [ $message ], [ 'message' ] ); |
1040 |
# warn Data::Dumper->Dump( [ $message ], [ 'message' ] ); |
1041 |
warn sprintf( 'sending %s message to patron: %s', |
1041 |
warn sprintf( 'sending %s message to patron: %s', |
Lines 1286-1291
sub _get_unsent_messages {
Link Here
|
1286 |
$statement .= ' AND borrowernumber = ? '; |
1286 |
$statement .= ' AND borrowernumber = ? '; |
1287 |
push @query_params, $params->{'borrowernumber'}; |
1287 |
push @query_params, $params->{'borrowernumber'}; |
1288 |
} |
1288 |
} |
|
|
1289 |
if ( $params->{'type'} ) { |
1290 |
$statement .= ' AND message_transport_type = ? '; |
1291 |
push @query_params, $params->{'type'}; |
1292 |
} |
1289 |
if ( $params->{'limit'} ) { |
1293 |
if ( $params->{'limit'} ) { |
1290 |
$statement .= ' limit ? '; |
1294 |
$statement .= ' limit ? '; |
1291 |
push @query_params, $params->{'limit'}; |
1295 |
push @query_params, $params->{'limit'}; |