Bugzilla – Attachment 167330 Details for
Bug 31481
Pass message_id to SMS drivers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31481: Pass message_id to SMS drivers
Bug-31481-Pass-messageid-to-SMS-drivers.patch (text/plain), 3.11 KB, created by
David Nind
on 2024-06-02 23:52:33 UTC
(
hide
)
Description:
Bug 31481: Pass message_id to SMS drivers
Filename:
MIME Type:
Creator:
David Nind
Created:
2024-06-02 23:52:33 UTC
Size:
3.11 KB
patch
obsolete
>From 9d840fc7a675690514b1577583b1b67a5f1c6618 Mon Sep 17 00:00:00 2001 >From: Johanna Raisa <johanna.raisa@gmail.com> >Date: Fri, 20 May 2022 10:16:10 +0300 >Subject: [PATCH] Bug 31481: Pass message_id to SMS drivers > >This patch adds message_id to _send_message_by_sms and sms_send >so the driver could be build to catch SMS gateways delivery report. > >Test plan: >1) Apply the patch >2) prove t/SMS.t > >Sponsored-by: Koha-Suomi Oy >Signed-off-by: matthias le gac <matthias.le-gac@inlibro.com> >Signed-off-by: David Nind <david@davidnind.com> >--- > C4/Letters.pm | 1 + > C4/SMS.pm | 3 ++- > t/SMS.t | 12 +++++++++++- > 3 files changed, 14 insertions(+), 2 deletions(-) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index dfb7b78694..4a643bd349 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -1620,6 +1620,7 @@ sub _send_message_by_sms { > { > destination => $patron->smsalertnumber, > message => $message->{'content'}, >+ message_id => $message->{'message_id'}, > } > ); > >diff --git a/C4/SMS.pm b/C4/SMS.pm >index eba203154c..ada384252f 100644 >--- a/C4/SMS.pm >+++ b/C4/SMS.pm >@@ -78,7 +78,7 @@ sub send_sms { > my $self = shift; > my $params= shift; > >- foreach my $required_parameter ( qw( message destination ) ) { >+ foreach my $required_parameter ( qw( message destination message_id ) ) { > # Should I warn in some way? > return unless defined $params->{ $required_parameter }; > } >@@ -132,6 +132,7 @@ sub send_sms { > $sent = $sender->send_sms( > to => $params->{destination}, > text => $params->{message}, >+ _message_id => $params->{'message_id'}, > ); > }; > >diff --git a/t/SMS.t b/t/SMS.t >index 763251a713..4f1be77020 100755 >--- a/t/SMS.t >+++ b/t/SMS.t >@@ -19,7 +19,7 @@ use Modern::Perl; > > use t::lib::Mocks; > >-use Test::More tests => 8; >+use Test::More tests => 9; > > BEGIN { > use_ok( 'C4::SMS', qw( driver send_sms ) ); >@@ -38,6 +38,7 @@ is( $send_sms, undef, 'send_sms without arguments returns undef' ); > ($send_sms) = C4::SMS->send_sms( > { > destination => 'my destination', >+ message_id => 1, > } > ); > is( $send_sms, undef, 'send_sms without message returns undef' ); >@@ -45,14 +46,22 @@ is( $send_sms, undef, 'send_sms without message returns undef' ); > ($send_sms) = C4::SMS->send_sms( > { > message => 'my message', >+ message_id => 1, > } > ); > is( $send_sms, undef, 'send_sms without destination returns undef' ); > >+$send_sms = C4::SMS->send_sms({ >+ destination => 'my destination', >+ message => 'my message', >+}); >+is( $send_sms, undef, 'send_sms without message_id returns undef' ); >+ > ( $send_sms, $error ) = C4::SMS->send_sms( > { > destination => 'my destination', > message => 'my message', >+ message_id => 1, > driver => '', > } > ); >@@ -64,6 +73,7 @@ is( $error, 'SMS_SEND_DRIVER_MISSING', 'Error code returned is SMS_SEND_DRIVE > destination => '+33123456789', > message => 'my message', > driver => 'Test', >+ message_id => 1, > } > ); > is( $send_sms, 1, 'send_sms returns 1' ); >-- >2.39.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 31481
:
139938
|
140507
|
158114
|
160986
|
167206
| 167330