Bugzilla – Attachment 32013 Details for
Bug 13029
Allow to pass additional parameters to SMS::Send drivers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13029: Allow to pass additional parameters to SMS::Send drivers
Bug-13029-Allow-to-pass-additional-parameters-to-S.patch (text/plain), 2.25 KB, created by
Julian Maurice
on 2014-10-06 14:01:06 UTC
(
hide
)
Description:
Bug 13029: Allow to pass additional parameters to SMS::Send drivers
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2014-10-06 14:01:06 UTC
Size:
2.25 KB
patch
obsolete
>From e2fa569cfa89b77e0470d1e37c0f7cf48910da15 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Mon, 6 Oct 2014 15:04:12 +0200 >Subject: [PATCH] Bug 13029: Allow to pass additional parameters to SMS::Send > drivers > >C4::SMS::send_sms now reads a YAML file and pass all parameters in the >file to SMS::Send::new. > >The config file is read in <installdir>/etc/sms/driver/<driver>.yaml. >For instance, if the driver used is SMS::Send::UK::Kapow, the config >file has to be in <installdir>/etc/sms/driver/UK/Kapow.yaml > >A underscore character is prepended to all parameter names so they are >treated as driver-specific options (leading underscore must not appear >in config file). >--- > C4/SMS.pm | 30 +++++++++++++++++++++++------- > 1 file changed, 23 insertions(+), 7 deletions(-) > >diff --git a/C4/SMS.pm b/C4/SMS.pm >index 24580d6..6785e92 100644 >--- a/C4/SMS.pm >+++ b/C4/SMS.pm >@@ -36,6 +36,7 @@ use strict; > use warnings; > > use C4::Context; >+use File::Spec; > > use vars qw( $VERSION ); > >@@ -74,14 +75,29 @@ sub send_sms { > my $driver = exists $params->{'driver'} ? $params->{'driver'} : $self->driver(); > return unless $driver; > >- # warn "using driver: $driver to send message to $params->{'destination'}"; >- >+ >+ my $subpath = $driver; >+ $subpath =~ s|::|/|; >+ >+ my $conf_file = File::Spec->catfile( >+ C4::Context->config('installdir'), >+ 'etc', 'sms', 'driver', $subpath >+ ) . q{.yaml}; >+ my %args; >+ if ( -f $conf_file ) { >+ require YAML; >+ my $conf = YAML::LoadFile( $conf_file ); >+ %args = map { q{_} . $_ => $conf->{$_} } keys %$conf; >+ } >+ > # Create a sender >- my $sender = SMS::Send->new( $driver, >- _login => C4::Context->preference('SMSSendUsername'), >- _password => C4::Context->preference('SMSSendPassword'), >- ); >- >+ my $sender = SMS::Send->new( >+ $driver, >+ _login => C4::Context->preference('SMSSendUsername'), >+ _password => C4::Context->preference('SMSSendPassword'), >+ %args, >+ ); >+ > # Send a message > my $sent = $sender->send_sms( to => $params->{'destination'}, > text => $params->{'message'}, >-- >1.9.1
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 13029
:
32011
|
32013
|
34403
|
55942
|
55943
|
56102
|
56103
|
56104
|
56111
|
56112
|
56113
|
56116
|
58170
|
58172