View | Details | Raw Unified | Return to bug 9021
Collapse All | Expand All

(-)a/C4/Letters.pm (-1 / +11 lines)
Lines 31-36 use C4::Log; Link Here
31
use C4::SMS;
31
use C4::SMS;
32
use C4::Debug;
32
use C4::Debug;
33
use Koha::DateUtils;
33
use Koha::DateUtils;
34
use Koha::SMS::Provider;
35
34
use Date::Calc qw( Add_Delta_Days );
36
use Date::Calc qw( Add_Delta_Days );
35
use Encode;
37
use Encode;
36
use Carp;
38
use Carp;
Lines 927-933 sub SendQueuedMessages { Link Here
927
            _send_message_by_email( $message, $params->{'username'}, $params->{'password'}, $params->{'method'} );
929
            _send_message_by_email( $message, $params->{'username'}, $params->{'password'}, $params->{'method'} );
928
        }
930
        }
929
        elsif ( lc( $message->{'message_transport_type'} ) eq 'sms' ) {
931
        elsif ( lc( $message->{'message_transport_type'} ) eq 'sms' ) {
930
            _send_message_by_sms( $message );
932
            if ( C4::Context->preference('SMSSendDriver') eq 'Email' ) {
933
                my $member = C4::Members::GetMember( 'borrowernumber' => $message->{'borrowernumber'} );
934
                my $sms_provider = Koha::SMS::Provider->find( $member->{'sms_provider_id'} );
935
                $message->{to_address} .= '@' . $sms_provider->domain();
936
                _send_message_by_email( $message, $params->{'username'}, $params->{'password'}, $params->{'method'} );
937
            } else {
938
                _send_message_by_sms( $message );
939
            }
931
        }
940
        }
932
    }
941
    }
933
    return scalar( @$unsent_messages );
942
    return scalar( @$unsent_messages );
Lines 1166-1171 sub _send_message_by_email { Link Here
1166
    }
1175
    }
1167
1176
1168
    _update_message_to_address($message->{'message_id'},$to_address) unless $message->{to_address}; #if initial message address was empty, coming here means that a to address was found and queue should be updated
1177
    _update_message_to_address($message->{'message_id'},$to_address) unless $message->{to_address}; #if initial message address was empty, coming here means that a to address was found and queue should be updated
1178
1169
    if ( sendmail( %sendmail_params ) ) {
1179
    if ( sendmail( %sendmail_params ) ) {
1170
        _set_message_status( { message_id => $message->{'message_id'},
1180
        _set_message_status( { message_id => $message->{'message_id'},
1171
                status     => 'sent' } );
1181
                status     => 'sent' } );
(-)a/C4/Members.pm (-1 / +6 lines)
Lines 797-804 sub ModMember { Link Here
797
            $data{password} = hash_password($data{password});
797
            $data{password} = hash_password($data{password});
798
        }
798
        }
799
    }
799
    }
800
800
    my $old_categorycode = GetBorrowerCategorycode( $data{borrowernumber} );
801
    my $old_categorycode = GetBorrowerCategorycode( $data{borrowernumber} );
801
    my $execute_success=UpdateInTable("borrowers",\%data);
802
803
    $data{'sms_provider_id'} = undef unless ( $data{'sms_provider_id'} );
804
805
    my $execute_success = UpdateInTable( "borrowers", \%data );
806
802
    if ($execute_success) { # only proceed if the update was a success
807
    if ($execute_success) { # only proceed if the update was a success
803
        # ok if its an adult (type) it may have borrowers that depend on it as a guarantor
808
        # ok if its an adult (type) it may have borrowers that depend on it as a guarantor
804
        # so when we update information for an adult we should check for guarantees and update the relevant part
809
        # so when we update information for an adult we should check for guarantees and update the relevant part
(-)a/Koha/SMS/Provider.pm (+157 lines)
Line 0 Link Here
1
package Koha::SMS::Provider;
2
3
# Copyright 2012 ByWater Solutions
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
=head1 NAME
21
22
Koha::SMS::Provider - class to manage sms providers
23
24
=head1 SYNOPSIS
25
26
Object-oriented class that encapsulates sms providers in Koha.
27
28
=head1 DESCRIPTION
29
30
SMS::Provider data.
31
32
=cut
33
34
use Modern::Perl;
35
36
use C4::Context;
37
38
use base qw(Class::Accessor);
39
40
__PACKAGE__->mk_accessors(qw( id name domain ));
41
42
=head2 new
43
44
    my $provider = Koha::SMS::Provider->new($data);
45
46
Create a new Koha::SMS::Provider object based on the provided record.
47
48
=cut
49
50
sub new {
51
    my $class = shift;
52
    my $data  = shift;
53
54
    my $self = $class->SUPER::new($data);
55
56
    bless $self, $class;
57
    return $self;
58
}
59
60
=head2 store
61
62
    Creates or updates the object in the database
63
64
=cut
65
66
sub store {
67
    my $self = shift;
68
69
    if ( $self->id ) {
70
        return C4::Context->dbh->do( "UPDATE sms_providers SET name = ?, domain = ? WHERE id = ?", undef, ( $self->name, $self->domain, $self->id ) );
71
    } else {
72
        return C4::Context->dbh->do( "INSERT INTO sms_providers ( name, domain ) VALUES ( ?, ? )", undef, ( $self->name, $self->domain ) );
73
    }
74
}
75
76
=head2 delete
77
78
=cut
79
80
sub delete {
81
    my $self = shift;
82
83
    return C4::Context->dbh->do( "DELETE FROM sms_providers WHERE id = ?", undef, ( $self->id ) );
84
}
85
86
=head2 all
87
88
    my $providers = Koha::SMS::Provider->all();
89
90
=cut
91
92
sub all {
93
    my $class = shift;
94
95
    my $query = "SELECT * FROM sms_providers ORDER BY name";
96
    my $sth   = C4::Context->dbh->prepare($query);
97
    $sth->execute();
98
99
    my @providers;
100
    while ( my $row = $sth->fetchrow_hashref() ) {
101
        my $p = Koha::SMS::Provider->new($row);
102
        push( @providers, $p );
103
    }
104
105
    return @providers;
106
}
107
108
=head2 find
109
110
  my $provider = Koha::SMS::Provider->find( $id );
111
112
=cut
113
114
sub find {
115
    my $class = shift;
116
    my $id    = shift;
117
118
    my $query = "SELECT * FROM sms_providers WHERE ID = ?";
119
    my $sth   = C4::Context->dbh->prepare($query);
120
    $sth->execute($id);
121
122
    my $row = $sth->fetchrow_hashref();
123
    my $p   = Koha::SMS::Provider->new($row);
124
125
    return $p;
126
}
127
128
=head2 search
129
130
  my @providers = Koha::SMS::Provider->search({ [name => $name], [domain => $domain] });
131
132
=cut
133
134
sub search {
135
    my $class  = shift;
136
    my $params = shift;
137
138
    my $query = "SELECT * FROM sms_providers WHERE ";
139
140
    my @params = map( $params->{$_}, keys %$params );
141
    $query .= join( " AND ", map( "$_ = ?", keys %$params ) );
142
143
    $query .= " ORDER BY name";
144
145
    my $sth = C4::Context->dbh->prepare($query);
146
    $sth->execute(@params);
147
148
    my @providers;
149
    while ( my $row = $sth->fetchrow_hashref() ) {
150
        my $p = Koha::SMS::Provider->new($row);
151
        push( @providers, $p );
152
    }
153
154
    return @providers;
155
}
156
157
1;
(-)a/admin/admin-home.pl (+4 lines)
Lines 34-37 my ($template, $loggedinuser, $cookie) Link Here
34
			     debug => 1,
34
			     debug => 1,
35
			     });
35
			     });
36
36
37
$template->param(
38
    SMSSendDriver => C4::Context->preference('SMSSendDriver'),
39
);
40
37
output_html_with_http_headers $query, $cookie, $template->output;
41
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/admin/sms_providers.pl (+59 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2012 ByWater Solutions
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use strict;
21
use warnings;
22
use CGI;
23
24
use C4::Context;
25
use C4::Auth;
26
use C4::Output;
27
28
use Koha::SMS::Provider;
29
30
my $cgi = new CGI;
31
32
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
33
    {   template_name   => "admin/sms_providers.tt",
34
        query           => $cgi,
35
        type            => "intranet",
36
        authnotrequired => 0,
37
        flagsrequired   => { parameters => 'parameters_remaining_permissions' },
38
        debug           => 1,
39
    }
40
);
41
42
my $op     = $cgi->param('op');
43
my $id     = $cgi->param('id');
44
my $name   = $cgi->param('name');
45
my $domain = $cgi->param('domain');
46
47
if ( $op eq 'add_update' ) {
48
    if ( $name && $domain ) {
49
        Koha::SMS::Provider->new( { id => $id, name => $name, domain => $domain } )->store();
50
    }
51
} elsif ( $op eq 'delete' ) {
52
    Koha::SMS::Provider->find($id)->delete();
53
}
54
55
my @providers = Koha::SMS::Provider->all();
56
57
$template->param( providers => \@providers );
58
59
output_html_with_http_headers $cgi, $cookie, $template->output;
(-)a/installer/data/mysql/kohastructure.sql (-1 / +17 lines)
Lines 264-269 CREATE TABLE `borrowers` ( -- this table includes information about your patrons Link Here
264
  `altcontactcountry` text default NULL, -- the country for the alternate contact for the patron/borrower
264
  `altcontactcountry` text default NULL, -- the country for the alternate contact for the patron/borrower
265
  `altcontactphone` varchar(50) default NULL, -- the phone number for the alternate contact for the patron/borrower
265
  `altcontactphone` varchar(50) default NULL, -- the phone number for the alternate contact for the patron/borrower
266
  `smsalertnumber` varchar(50) default NULL, -- the mobile phone number where the patron/borrower would like to receive notices (if SNS turned on)
266
  `smsalertnumber` varchar(50) default NULL, -- the mobile phone number where the patron/borrower would like to receive notices (if SNS turned on)
267
  `sms_provider_id` int(11) DEFAULT NULL, -- the provider of the mobile phone number defined in smsalertnumber
267
  `privacy` integer(11) DEFAULT '1' NOT NULL, -- patron/borrower's privacy settings related to their reading history
268
  `privacy` integer(11) DEFAULT '1' NOT NULL, -- patron/borrower's privacy settings related to their reading history
268
  UNIQUE KEY `cardnumber` (`cardnumber`),
269
  UNIQUE KEY `cardnumber` (`cardnumber`),
269
  PRIMARY KEY `borrowernumber` (`borrowernumber`),
270
  PRIMARY KEY `borrowernumber` (`borrowernumber`),
Lines 274-281 CREATE TABLE `borrowers` ( -- this table includes information about your patrons Link Here
274
  KEY `surname_idx` (`surname`(255)),
275
  KEY `surname_idx` (`surname`(255)),
275
  KEY `firstname_idx` (`firstname`(255)),
276
  KEY `firstname_idx` (`firstname`(255)),
276
  KEY `othernames_idx` (`othernames`(255)),
277
  KEY `othernames_idx` (`othernames`(255)),
278
  KEY `sms_provider_id` (`sms_provider_id`),
277
  CONSTRAINT `borrowers_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`),
279
  CONSTRAINT `borrowers_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`),
278
  CONSTRAINT `borrowers_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
280
  CONSTRAINT `borrowers_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`),
281
  CONSTRAINT `borrowers_ibfk_3` FOREIGN KEY (`sms_provider_id`) REFERENCES `sms_providers` (`id`)
279
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
282
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
280
283
281
--
284
--
Lines 1983-1988 CREATE TABLE sessions ( Link Here
1983
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1986
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1984
1987
1985
--
1988
--
1989
-- Table structure for table `sms_providers`
1990
--
1991
1992
DROP TABLE IF EXISTS sms_providers;
1993
CREATE TABLE `sms_providers` (
1994
  `id` int(11) NOT NULL AUTO_INCREMENT,
1995
  `name` varchar(255) NOT NULL,
1996
  `domain` varchar(255) NOT NULL,
1997
  PRIMARY KEY (`id`),
1998
  UNIQUE KEY `name` (`name`)
1999
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2000
2001
--
1986
-- Table structure for table `special_holidays`
2002
-- Table structure for table `special_holidays`
1987
--
2003
--
1988
2004
(-)a/installer/data/mysql/updatedatabase.pl (+19 lines)
Lines 9585-9590 if ( CheckVersion($DBversion) ) { Link Here
9585
    SetVersion ($DBversion);
9585
    SetVersion ($DBversion);
9586
}
9586
}
9587
9587
9588
$DBversion = "3.19.00.XXX";
9589
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
9590
   $dbh->do("
9591
       CREATE TABLE  sms_providers (
9592
           id INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
9593
           name VARCHAR( 255 ) NOT NULL ,
9594
           domain VARCHAR( 255 ) NOT NULL ,
9595
           UNIQUE (
9596
               name
9597
           )
9598
       ) ENGINE = INNODB CHARACTER SET utf8;
9599
   ");
9600
   $dbh->do("ALTER TABLE borrowers ADD sms_provider_id INT( 11 ) NULL DEFAULT NULL AFTER smsalertnumber, ADD INDEX ( sms_provider_id )");
9601
   $dbh->do("ALTER TABLE borrowers ADD FOREIGN KEY ( sms_provider_id ) REFERENCES  sms_providers ( id )");
9602
9603
   print "Upgrade to $DBversion done (Add SMS via Email feature)\n";
9604
   SetVersion ($DBversion);
9605
}
9606
9588
=head1 FUNCTIONS
9607
=head1 FUNCTIONS
9589
9608
9590
=head2 TableExists($table)
9609
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt (+4 lines)
Lines 104-109 Link Here
104
    <dd>Choose which plugins to use to suggest searches to patrons and staff.</dd>
104
    <dd>Choose which plugins to use to suggest searches to patrons and staff.</dd>
105
    <dt><a href="/cgi-bin/koha/admin/columns_settings.pl">Configure columns</a></dt>
105
    <dt><a href="/cgi-bin/koha/admin/columns_settings.pl">Configure columns</a></dt>
106
    <dd>Hide or show columns for tables.</dd>
106
    <dd>Hide or show columns for tables.</dd>
107
    [% IF SMSSendDriver == 'Email' %]
108
        <dt><a href="/cgi-bin/koha/admin/sms_providers.pl">SMS cellular providers</a></dt>
109
        <dd>Define a list of cellular providers for sending SMS messages via email.</dd>
110
    [% END %]
107
</dl>
111
</dl>
108
</div>
112
</div>
109
113
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/sms_providers.tt (+102 lines)
Line 0 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Administration &rsaquo; SMS cellular providers</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
</head>
5
6
<script type="text/javascript">
7
$(document).ready(function() {
8
    $('#submit_update').hide();
9
    $("#name").focus();
10
});
11
12
function edit_provider( id ) {
13
    cancel_edit();
14
15
    $("#id").val( id );
16
    $("#name").val( $("#name_" + id).text() );
17
    $("#domain").val( $("#domain_" + id).text() );
18
19
    $("#name_" + id).parent().addClass("warn");
20
21
    $("#submit_save").hide();
22
    $("#submit_update").show();
23
24
    $("#name").focus();
25
}
26
27
function cancel_edit() {
28
    $("#id").val("");
29
    $("#name").val("");
30
    $("#domain").val("");
31
32
    $("tr").removeClass("warn");
33
34
    $("#submit_update").hide();
35
    $("#submit_save").show();
36
37
}
38
39
function delete_provider( id ) {
40
    if ( confirm( _("Are you sure you want to delete ") + $("#name_" + id).html() + _("?") ) ) {
41
        $("#op").val('delete');
42
        $("#id").val( id );
43
        $("#sms_form").submit();
44
    }
45
}
46
</script>
47
<body id="admin_sms_providers" class="admin">
48
[% INCLUDE 'header.inc' %]
49
50
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; SMS cellular providers</div>
51
52
<div id="doc3" class="yui-t2">
53
    <div id="bd">
54
        <div id="yui-main">
55
     <div class="yui-b">
56
                <h2>SMS cellular providers</h2>
57
58
                <table>
59
                    <thead>
60
                        <tr>
61
                            <th>Name</th>
62
                            <th>Domain</th>
63
                            <th>&nbsp;</th>
64
                            <th>&nbsp;</th>
65
                        </tr>
66
                    </thead>
67
68
                    <tbody>
69
                        [% FOREACH p IN providers %]
70
                            <tr>
71
                                <td id="name_[% p.id %]">[% p.name %]</td>
72
                                <td id="domain_[% p.id %]">[% p.domain %]</td>
73
                                <td><a href="#" id="edit_[% p.id %]" class="edit" onclick="edit_provider( [% p.id %] );">Edit</td>
74
                                <td><a href="#" id="delete_[% p.id %]" class="delete" onclick="delete_provider( [% p.id %] );">Delete</td>
75
                            </tr>
76
                        [% END %]
77
                    </tbody>
78
79
                    <tfoot>
80
                        <form id="sms_form" action="sms_providers.pl" method="post">
81
                            <input type="hidden" id="id" name="id" value="" />
82
                            <input type="hidden" id="op" name="op" value="add_update" />
83
                            <tr>
84
                                <td><input type="text" id="name" name="name" /></td>
85
                                <td><input type="text" id="domain" name="domain" size="40"/></td>
86
                                <td>
87
                                    <input id="submit_save" type="submit" value="Add new">
88
                                    <input id="submit_update" type="submit" value="Update">
89
                                </td>
90
                                <td><a id="cancel" href="#" onclick="cancel_edit()">Cancel</a></td>
91
                            </tr>
92
                        </form>
93
                    </tfoot>
94
                </table>
95
            </div>
96
        </div>
97
        <div class="yui-b">
98
            [% INCLUDE 'admin-menu.inc' %]
99
        </div>
100
    </div>
101
</div>
102
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (+13 lines)
Lines 1382-1387 Link Here
1382
        <p><label for="SMSnumber">SMS number:</label>
1382
        <p><label for="SMSnumber">SMS number:</label>
1383
            <input type="text" id="SMSnumber" name="SMSnumber" value="[% SMSnumber %]" />
1383
            <input type="text" id="SMSnumber" name="SMSnumber" value="[% SMSnumber %]" />
1384
        </p>
1384
        </p>
1385
        <p>
1386
            <label for="sms_provider_id">SMS provider:</label>
1387
            <select id="sms_provider_id" name="sms_provider_id"/>
1388
                <option value="">Unknown</option>
1389
                [% FOREACH s IN sms_providers %]
1390
                    [% IF s.id == sms_provider_id %]
1391
                        <option value="[% s.id %]" selected="selected">[% s.name %]</option>
1392
                    [% ELSE %]
1393
                        <option value="[% s.id %]">[% s.name %]</option>
1394
                    [% END %]
1395
                [% END %]
1396
            </select>
1397
        </p>
1385
    [% END %]
1398
    [% END %]
1386
  </fieldset>
1399
  </fieldset>
1387
[% END %] [% END %]
1400
[% END %] [% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt (-3 / +24 lines)
Lines 110-118 Link Here
110
                        </table>
110
                        </table>
111
111
112
                        <fieldset class="rows">
112
                        <fieldset class="rows">
113
                        [% IF ( SMSSendDriver ) %]
113
                            [% IF ( SMSSendDriver ) %]
114
                            <ol><li><label for="SMSnumber">SMS number:</label> <input type="text" id="SMSnumber" name="SMSnumber" value="[% SMSnumber %]" /></li></ol>
114
                                <ol><li><label>Notice:</label>Some charges for text messages may be incurred when using this service. Please check with your mobile service provider if you have questions.</li></ol>
115
                        [% END %]
115
                                <ol><li>
116
                                    <label for="SMSnumber">SMS number:</label> <input type="text" id="SMSnumber" name="SMSnumber" value="[% SMSnumber %]" />
117
                                    <i>Please enter numbers only. <b>(123) 456-7890</b> would be entered as <b>1234567890</b>.</i>
118
                                </li></ol>
119
                            [% END %]
120
121
                            [% IF ( SMSSendDriver == 'Email' ) %]
122
                                <ol><li>
123
                                    <label for="sms_provider_id">SMS provider:</label>
124
                                    <select id="sms_provider_id" name="sms_provider_id"/>
125
                                        <option value="">Unknown</option>
126
                                        [% FOREACH s IN sms_providers %]
127
                                            [% IF s.id == sms_provider_id %]
128
                                                <option value="[% s.id %]" selected="selected">[% s.name %]</option>
129
                                            [% ELSE %]
130
                                                <option value="[% s.id %]">[% s.name %]</option>
131
                                            [% END %]
132
                                        [% END %]
133
                                    </select>
134
                                    <i>Please contact a library staff member if you are unsure of your mobile service provider, or you do not see your provider in this list.</i>
135
                                </li></ol>
136
                            [% END %]
116
                        </fieldset>
137
                        </fieldset>
117
138
118
                        <fieldset class="action">
139
                        <fieldset class="action">
(-)a/members/memberentry.pl (+6 lines)
Lines 47-52 use Module::Load; Link Here
47
if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) {
47
if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) {
48
    load Koha::NorwegianPatronDB, qw( NLGetSyncDataFromBorrowernumber );
48
    load Koha::NorwegianPatronDB, qw( NLGetSyncDataFromBorrowernumber );
49
}
49
}
50
use Koha::SMS::Provider;
50
51
51
use vars qw($debug);
52
use vars qw($debug);
52
53
Lines 69-74 my ($template, $loggedinuser, $cookie) Link Here
69
           debug => ($debug) ? 1 : 0,
70
           debug => ($debug) ? 1 : 0,
70
       });
71
       });
71
72
73
if ( C4::Context->preference('SMSSendDriver') eq 'Email' ) {
74
    my @providers = Koha::SMS::Provider->all();
75
    $template->param( sms_providers => \@providers );
76
}
77
72
my $guarantorid    = $input->param('guarantorid');
78
my $guarantorid    = $input->param('guarantorid');
73
my $borrowernumber = $input->param('borrowernumber');
79
my $borrowernumber = $input->param('borrowernumber');
74
my $actionType     = $input->param('actionType') || '';
80
my $actionType     = $input->param('actionType') || '';
(-)a/opac/opac-messaging.pl (-2 / +8 lines)
Lines 54-60 if ( defined $query->param('modify') && $query->param('modify') eq 'yes' ) { Link Here
54
    # If they've modified the SMS number, record it.
54
    # If they've modified the SMS number, record it.
55
    if ( ( defined $query->param('SMSnumber') ) && ( $query->param('SMSnumber') ne $borrower->{'mobile'} ) ) {
55
    if ( ( defined $query->param('SMSnumber') ) && ( $query->param('SMSnumber') ne $borrower->{'mobile'} ) ) {
56
        ModMember( borrowernumber => $borrowernumber,
56
        ModMember( borrowernumber => $borrowernumber,
57
                   smsalertnumber => $query->param('SMSnumber') );
57
                   smsalertnumber => $query->param('SMSnumber'),
58
                   sms_provider_id => $query->param('sms_provider_id')
59
                 );
58
        $borrower = GetMemberDetails( $borrowernumber );
60
        $borrower = GetMemberDetails( $borrowernumber );
59
    }
61
    }
60
62
Lines 70-73 $template->param( BORROWER_INFO => [ $borrower ], Link Here
70
                  SMSSendDriver                =>  C4::Context->preference("SMSSendDriver"),
72
                  SMSSendDriver                =>  C4::Context->preference("SMSSendDriver"),
71
                  TalkingTechItivaPhone        =>  C4::Context->preference("TalkingTechItivaPhoneNotification") );
73
                  TalkingTechItivaPhone        =>  C4::Context->preference("TalkingTechItivaPhoneNotification") );
72
74
75
if ( C4::Context->preference("SMSSendDriver") eq 'Email' ) {
76
    my @providers = Koha::SMS::Provider->all();
77
    $template->param( sms_providers => \@providers, sms_provider_id => $borrower->{'sms_provider_id'} );
78
}
79
73
output_html_with_http_headers $query, $cookie, $template->output;
80
output_html_with_http_headers $query, $cookie, $template->output;
74
- 

Return to bug 9021