Bug 11208: If no smsalertnumber is defined, the message is marked as failed
authorJonathan Druart <jonathan.druart@biblibre.com>
Wed, 6 Nov 2013 13:54:36 +0000 (14:54 +0100)
committerGalen Charlton <gmc@esilibrary.com>
Mon, 30 Dec 2013 16:48:23 +0000 (16:48 +0000)
For DUE message (and PREDUE, etc.) there are no check before sending the
message to the message_queue table.

This check avoids to try to send again and again the same message. Now
it is marked as "failed".

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Without the patch a sms notice will remain as 'pending' forever.
With the patch applied, the status is set to 'failed'.

Passes all tests and QA script.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
C4/Letters.pm

index 7125148..c78d01e 100644 (file)
@@ -998,7 +998,12 @@ EOS
 sub _send_message_by_sms {
     my $message = shift or return;
     my $member = C4::Members::GetMember( 'borrowernumber' => $message->{'borrowernumber'} );
-    return unless $member->{'smsalertnumber'};
+
+    unless ( $member->{smsalertnumber} ) {
+        _set_message_status( { message_id => $message->{'message_id'},
+                               status     => 'failed' } );
+        return;
+    }
 
     my $success = C4::SMS->send_sms( { destination => $member->{'smsalertnumber'},
                                        message     => $message->{'content'},