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