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 977-983 sub SendQueuedMessages { Link Here
977
            _send_message_by_email( $message, $params->{'username'}, $params->{'password'}, $params->{'method'} );
979
            _send_message_by_email( $message, $params->{'username'}, $params->{'password'}, $params->{'method'} );
978
        }
980
        }
979
        elsif ( lc( $message->{'message_transport_type'} ) eq 'sms' ) {
981
        elsif ( lc( $message->{'message_transport_type'} ) eq 'sms' ) {
980
            _send_message_by_sms( $message );
982
            if ( C4::Context->preference('SMSSendDriver') eq 'Email' ) {
983
                my $member = C4::Members::GetMember( 'borrowernumber' => $message->{'borrowernumber'} );
984
                my $sms_provider = Koha::SMS::Provider->find( $member->{'sms_provider_id'} );
985
                $message->{to_address} .= '@' . $sms_provider->domain();
986
                _send_message_by_email( $message, $params->{'username'}, $params->{'password'}, $params->{'method'} );
987
            } else {
988
                _send_message_by_sms( $message );
989
            }
981
        }
990
        }
982
    }
991
    }
983
    return scalar( @$unsent_messages );
992
    return scalar( @$unsent_messages );
Lines 1216-1221 sub _send_message_by_email { Link Here
1216
    }
1225
    }
1217
1226
1218
    _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
1227
    _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
1228
1219
    if ( sendmail( %sendmail_params ) ) {
1229
    if ( sendmail( %sendmail_params ) ) {
1220
        _set_message_status( { message_id => $message->{'message_id'},
1230
        _set_message_status( { message_id => $message->{'message_id'},
1221
                status     => 'sent' } );
1231
                status     => 'sent' } );
(-)a/C4/Members.pm (-4 / +9 lines)
Lines 656-661 sub ModMember { Link Here
656
            $data{password} = hash_password($data{password});
656
            $data{password} = hash_password($data{password});
657
        }
657
        }
658
    }
658
    }
659
659
    my $old_categorycode = GetBorrowerCategorycode( $data{borrowernumber} );
660
    my $old_categorycode = GetBorrowerCategorycode( $data{borrowernumber} );
660
661
661
    # get only the columns of a borrower
662
    # get only the columns of a borrower
Lines 664-678 sub ModMember { Link Here
664
    my $new_borrower = { map { join(' ', @columns) =~ /$_/ ? ( $_ => $data{$_} ) : () } keys(%data) };
665
    my $new_borrower = { map { join(' ', @columns) =~ /$_/ ? ( $_ => $data{$_} ) : () } keys(%data) };
665
    delete $new_borrower->{flags};
666
    delete $new_borrower->{flags};
666
667
667
    $new_borrower->{dateofbirth}  ||= undef if exists $new_borrower->{dateofbirth};
668
    $new_borrower->{dateofbirth}     ||= undef if exists $new_borrower->{dateofbirth};
668
    $new_borrower->{dateenrolled} ||= undef if exists $new_borrower->{dateenrolled};
669
    $new_borrower->{dateenrolled}    ||= undef if exists $new_borrower->{dateenrolled};
669
    $new_borrower->{dateexpiry}   ||= undef if exists $new_borrower->{dateexpiry};
670
    $new_borrower->{dateexpiry}      ||= undef if exists $new_borrower->{dateexpiry};
670
    $new_borrower->{debarred}     ||= undef if exists $new_borrower->{debarred};
671
    $new_borrower->{debarred}        ||= undef if exists $new_borrower->{debarred};
672
    $new_borrower->{sms_provider_id} ||= undef if exists $new_borrower->{sms_provider_id};
673
671
    my $rs = $schema->resultset('Borrower')->search({
674
    my $rs = $schema->resultset('Borrower')->search({
672
        borrowernumber => $new_borrower->{borrowernumber},
675
        borrowernumber => $new_borrower->{borrowernumber},
673
     });
676
     });
677
674
    my $execute_success = $rs->update($new_borrower);
678
    my $execute_success = $rs->update($new_borrower);
675
    if ($execute_success ne '0E0') { # only proceed if the update was a success
679
    if ($execute_success ne '0E0') { # only proceed if the update was a success
680
676
        # ok if its an adult (type) it may have borrowers that depend on it as a guarantor
681
        # ok if its an adult (type) it may have borrowers that depend on it as a guarantor
677
        # so when we update information for an adult we should check for guarantees and update the relevant part
682
        # so when we update information for an adult we should check for guarantees and update the relevant part
678
        # of their records, ie addresses and phone numbers
683
        # of their records, ie addresses and phone numbers
(-)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/atomicupdate/bug_9021.sql (+12 lines)
Line 0 Link Here
1
CREATE TABLE  sms_providers (
2
   id INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
3
   name VARCHAR( 255 ) NOT NULL ,
4
   domain VARCHAR( 255 ) NOT NULL ,
5
   UNIQUE (
6
       name
7
   )
8
) ENGINE = INNODB CHARACTER SET utf8;
9
10
ALTER TABLE borrowers ADD sms_provider_id INT( 11 ) NULL DEFAULT NULL AFTER smsalertnumber, ADD INDEX ( sms_provider_id );
11
12
ALTER TABLE borrowers ADD FOREIGN KEY ( sms_provider_id ) REFERENCES  sms_providers ( id );
(-)a/installer/data/mysql/kohastructure.sql (+16 lines)
Lines 263-268 CREATE TABLE `borrowers` ( -- this table includes information about your patrons Link Here
263
  `altcontactcountry` text default NULL, -- the country for the alternate contact for the patron/borrower
263
  `altcontactcountry` text default NULL, -- the country for the alternate contact for the patron/borrower
264
  `altcontactphone` varchar(50) default NULL, -- the phone number for the alternate contact for the patron/borrower
264
  `altcontactphone` varchar(50) default NULL, -- the phone number for the alternate contact for the patron/borrower
265
  `smsalertnumber` varchar(50) default NULL, -- the mobile phone number where the patron/borrower would like to receive notices (if SNS turned on)
265
  `smsalertnumber` varchar(50) default NULL, -- the mobile phone number where the patron/borrower would like to receive notices (if SNS turned on)
266
  `sms_provider_id` int(11) DEFAULT NULL, -- the provider of the mobile phone number defined in smsalertnumber
266
  `privacy` integer(11) DEFAULT '1' NOT NULL, -- patron/borrower's privacy settings related to their reading history
267
  `privacy` integer(11) DEFAULT '1' NOT NULL, -- patron/borrower's privacy settings related to their reading history
267
  UNIQUE KEY `cardnumber` (`cardnumber`),
268
  UNIQUE KEY `cardnumber` (`cardnumber`),
268
  PRIMARY KEY `borrowernumber` (`borrowernumber`),
269
  PRIMARY KEY `borrowernumber` (`borrowernumber`),
Lines 273-280 CREATE TABLE `borrowers` ( -- this table includes information about your patrons Link Here
273
  KEY `surname_idx` (`surname`(255)),
274
  KEY `surname_idx` (`surname`(255)),
274
  KEY `firstname_idx` (`firstname`(255)),
275
  KEY `firstname_idx` (`firstname`(255)),
275
  KEY `othernames_idx` (`othernames`(255)),
276
  KEY `othernames_idx` (`othernames`(255)),
277
  KEY `sms_provider_id` (`sms_provider_id`),
276
  CONSTRAINT `borrowers_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`),
278
  CONSTRAINT `borrowers_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`),
277
  CONSTRAINT `borrowers_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
279
  CONSTRAINT `borrowers_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
280
  CONSTRAINT `borrowers_ibfk_3` FOREIGN KEY (`sms_provider_id`) REFERENCES `sms_providers` (`id`)
278
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
281
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
279
282
280
--
283
--
Lines 1960-1965 CREATE TABLE sessions ( Link Here
1960
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
1963
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
1961
1964
1962
--
1965
--
1966
-- Table structure for table `sms_providers`
1967
--
1968
1969
DROP TABLE IF EXISTS sms_providers;
1970
CREATE TABLE `sms_providers` (
1971
  `id` int(11) NOT NULL AUTO_INCREMENT,
1972
  `name` varchar(255) NOT NULL,
1973
  `domain` varchar(255) NOT NULL,
1974
  PRIMARY KEY (`id`),
1975
  UNIQUE KEY `name` (`name`)
1976
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1977
1978
--
1963
-- Table structure for table `special_holidays`
1979
-- Table structure for table `special_holidays`
1964
--
1980
--
1965
1981
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt (+4 lines)
Lines 113-118 Link Here
113
    <dd>Hide or show columns for tables.</dd>
113
    <dd>Hide or show columns for tables.</dd>
114
    <dt><a href="/cgi-bin/koha/admin/audio_alerts.pl">Audio alerts</a></dt>
114
    <dt><a href="/cgi-bin/koha/admin/audio_alerts.pl">Audio alerts</a></dt>
115
    <dd>Define which events trigger which sounds</dd>
115
    <dd>Define which events trigger which sounds</dd>
116
    [% IF SMSSendDriver == 'Email' %]
117
        <dt><a href="/cgi-bin/koha/admin/sms_providers.pl">SMS cellular providers</a></dt>
118
        <dd>Define a list of cellular providers for sending SMS messages via email.</dd>
119
    [% END %]
116
</dl>
120
</dl>
117
</div>
121
</div>
118
122
(-)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 1096-1101 Link Here
1096
        <p><label for="SMSnumber">SMS number:</label>
1096
        <p><label for="SMSnumber">SMS number:</label>
1097
            <input type="text" id="SMSnumber" name="SMSnumber" value="[% SMSnumber %]" />
1097
            <input type="text" id="SMSnumber" name="SMSnumber" value="[% SMSnumber %]" />
1098
        </p>
1098
        </p>
1099
        <p>
1100
            <label for="sms_provider_id">SMS provider:</label>
1101
            <select id="sms_provider_id" name="sms_provider_id"/>
1102
                <option value="">Unknown</option>
1103
                [% FOREACH s IN sms_providers %]
1104
                    [% IF s.id == sms_provider_id %]
1105
                        <option value="[% s.id %]" selected="selected">[% s.name %]</option>
1106
                    [% ELSE %]
1107
                        <option value="[% s.id %]">[% s.name %]</option>
1108
                    [% END %]
1109
                [% END %]
1110
            </select>
1111
        </p>
1099
    [% END %]
1112
    [% END %]
1100
  </fieldset>
1113
  </fieldset>
1101
[% END %] [% END %]
1114
[% END %] [% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt (-3 / +24 lines)
Lines 119-127 Link Here
119
                        </table>
119
                        </table>
120
120
121
                        <fieldset class="rows">
121
                        <fieldset class="rows">
122
                        [% IF ( SMSSendDriver ) %]
122
                            [% IF ( SMSSendDriver ) %]
123
                            <ol><li><label for="SMSnumber">SMS number:</label> <input type="text" id="SMSnumber" name="SMSnumber" value="[% SMSnumber %]" /></li></ol>
123
                                <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>
124
                        [% END %]
124
                                <ol><li>
125
                                    <label for="SMSnumber">SMS number:</label> <input type="text" id="SMSnumber" name="SMSnumber" value="[% SMSnumber %]" />
126
                                    <i>Please enter numbers only. <b>(123) 456-7890</b> would be entered as <b>1234567890</b>.</i>
127
                                </li></ol>
128
                            [% END %]
129
130
                            [% IF ( SMSSendDriver == 'Email' ) %]
131
                                <ol><li>
132
                                    <label for="sms_provider_id">SMS provider:</label>
133
                                    <select id="sms_provider_id" name="sms_provider_id"/>
134
                                        <option value="">Unknown</option>
135
                                        [% FOREACH s IN sms_providers %]
136
                                            [% IF s.id == sms_provider_id %]
137
                                                <option value="[% s.id %]" selected="selected">[% s.name %]</option>
138
                                            [% ELSE %]
139
                                                <option value="[% s.id %]">[% s.name %]</option>
140
                                            [% END %]
141
                                        [% END %]
142
                                    </select>
143
                                    <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>
144
                                </li></ol>
145
                            [% END %]
125
                        </fieldset>
146
                        </fieldset>
126
147
127
                        <fieldset class="action">
148
                        <fieldset class="action">
(-)a/members/memberentry.pl (+6 lines)
Lines 46-51 use Module::Load; Link Here
46
if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) {
46
if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) {
47
    load Koha::NorwegianPatronDB, qw( NLGetSyncDataFromBorrowernumber );
47
    load Koha::NorwegianPatronDB, qw( NLGetSyncDataFromBorrowernumber );
48
}
48
}
49
use Koha::SMS::Provider;
49
50
50
use vars qw($debug);
51
use vars qw($debug);
51
52
Lines 68-73 my ($template, $loggedinuser, $cookie) Link Here
68
           debug => ($debug) ? 1 : 0,
69
           debug => ($debug) ? 1 : 0,
69
       });
70
       });
70
71
72
if ( C4::Context->preference('SMSSendDriver') eq 'Email' ) {
73
    my @providers = Koha::SMS::Provider->all();
74
    $template->param( sms_providers => \@providers );
75
}
76
71
my $guarantorid    = $input->param('guarantorid');
77
my $guarantorid    = $input->param('guarantorid');
72
my $borrowernumber = $input->param('borrowernumber');
78
my $borrowernumber = $input->param('borrowernumber');
73
my $actionType     = $input->param('actionType') || '';
79
my $actionType     = $input->param('actionType') || '';
(-)a/opac/opac-messaging.pl (-3 / +10 lines)
Lines 50-57 my $messaging_options = C4::Members::Messaging::GetMessagingOptions(); Link Here
50
if ( defined $query->param('modify') && $query->param('modify') eq 'yes' ) {
50
if ( defined $query->param('modify') && $query->param('modify') eq 'yes' ) {
51
    my $sms = $query->param('SMSnumber');
51
    my $sms = $query->param('SMSnumber');
52
    if ( defined $sms && ( $borrower->{'smsalertnumber'} // '' ) ne $sms ) {
52
    if ( defined $sms && ( $borrower->{'smsalertnumber'} // '' ) ne $sms ) {
53
        ModMember( borrowernumber => $borrowernumber,
53
        ModMember(
54
                   smsalertnumber => $sms );
54
            borrowernumber  => $borrowernumber,
55
            smsalertnumber  => $sms,
56
            sms_provider_id => $query->param('sms_provider_id'),
57
        );
55
        $borrower = GetMemberDetails( $borrowernumber );
58
        $borrower = GetMemberDetails( $borrowernumber );
56
    }
59
    }
57
60
Lines 66-69 $template->param( BORROWER_INFO => [ $borrower ], Link Here
66
                  SMSSendDriver                =>  C4::Context->preference("SMSSendDriver"),
69
                  SMSSendDriver                =>  C4::Context->preference("SMSSendDriver"),
67
                  TalkingTechItivaPhone        =>  C4::Context->preference("TalkingTechItivaPhoneNotification") );
70
                  TalkingTechItivaPhone        =>  C4::Context->preference("TalkingTechItivaPhoneNotification") );
68
71
72
if ( C4::Context->preference("SMSSendDriver") eq 'Email' ) {
73
    my @providers = Koha::SMS::Provider->all();
74
    $template->param( sms_providers => \@providers, sms_provider_id => $borrower->{'sms_provider_id'} );
75
}
76
69
output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };
77
output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };
70
- 

Return to bug 9021