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

(-)a/C4/SMS.pm (-1 / +15 lines)
Lines 94-112 sub send_sms { Link Here
94
    my $subpath = $driver;
94
    my $subpath = $driver;
95
    $subpath =~ s|::|/|g;
95
    $subpath =~ s|::|/|g;
96
96
97
    # Extract additional SMS::Send arguments from file
97
    my $sms_send_config = C4::Context->config('sms_send_config');
98
    my $sms_send_config = C4::Context->config('sms_send_config');
98
    my $conf_file = defined $sms_send_config
99
    my $conf_file = defined $sms_send_config
99
        ? File::Spec->catfile( $sms_send_config, $subpath )
100
        ? File::Spec->catfile( $sms_send_config, $subpath )
100
        : $subpath;
101
        : $subpath;
101
    $conf_file .= q{.yaml};
102
    $conf_file .= q{.yaml};
102
103
103
    my %args;
104
    my %args = ();
104
    if ( -f $conf_file ) {
105
    if ( -f $conf_file ) {
105
        require YAML::XS;
106
        require YAML::XS;
106
        my $conf = YAML::XS::LoadFile( $conf_file );
107
        my $conf = YAML::XS::LoadFile( $conf_file );
107
        %args = map { q{_} . $_ => $conf->{$_} } keys %$conf;
108
        %args = map { q{_} . $_ => $conf->{$_} } keys %$conf;
108
    }
109
    }
109
110
111
    # Extract additional SMS::Send arguments from the syspref
112
    # Merge with any arguments from file with syspref taking precedence
113
    my $sms_send_config_syspref = C4::Context->preference('SMSSendAdditionalOptions');
114
    if ( $sms_send_config_syspref ) {
115
        require YAML::XS;
116
117
        $sms_send_config_syspref = "$sms_send_config_syspref\n\n";
118
        my $yaml;
119
        eval { $yaml = YAML::XS::Load(Encode::encode_utf8($yaml)); };
120
        my %syspref_args = map { q{_} . $_ => $conf->{$_} } keys %$conf;
121
        %args = ( %args, %syspref_args );
122
    }
123
110
    eval {
124
    eval {
111
        # Create a sender
125
        # Create a sender
112
        $sender = SMS::Send->new(
126
        $sender = SMS::Send->new(
(-)a/installer/data/mysql/atomicupdate/bug_36051.pl (+20 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number  => "36051",
5
    description => "Add option to specify SMS::Send driver parameters in a system preference instead of a file",
6
    up          => sub {
7
        my ($args) = @_;
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
10
        # Do you stuffs here
11
        $dbh->do(
12
            q{
13
            INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
14
            ('SMSSendAdditionalOptions', '', '', 'Additional SMS::Send parameters used to send SMS messages', 'free');
15
        }
16
        );
17
18
        say $out "Added new system preference 'SMSSendAdditionalOptions'";
19
    },
20
};
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+1 lines)
Lines 709-714 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
709
('SIP2SortBinMapping','',NULL,'Use the following mappings to determine the sort_bin of a returned item. The mapping should be on the form \"branchcode:item field:item field value:sort bin number\", with one mapping per line.','free'),
709
('SIP2SortBinMapping','',NULL,'Use the following mappings to determine the sort_bin of a returned item. The mapping should be on the form \"branchcode:item field:item field value:sort bin number\", with one mapping per line.','free'),
710
('SkipHoldTrapOnNotForLoanValue','',NULL,'If set, Koha will never trap items for hold with this notforloan value','Integer'),
710
('SkipHoldTrapOnNotForLoanValue','',NULL,'If set, Koha will never trap items for hold with this notforloan value','Integer'),
711
('SlipCSS','',NULL,'Slips CSS url.','free'),
711
('SlipCSS','',NULL,'Slips CSS url.','free'),
712
('SMSSendAdditionalOptions', '', '', 'Additional SMS::Send parameters used to send SMS messages', 'free'),
712
('SMSSendDriver','','','Sets which SMS::Send driver is used to send SMS messages.','free'),
713
('SMSSendDriver','','','Sets which SMS::Send driver is used to send SMS messages.','free'),
713
('SMSSendPassword', '', '', 'Password used to send SMS messages', 'free'),
714
('SMSSendPassword', '', '', 'Password used to send SMS messages', 'free'),
714
('SMSSendUsername', '', '', 'Username/Login used to send SMS messages', 'free'),
715
('SMSSendUsername', '', '', 'Username/Login used to send SMS messages', 'free'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref (-1 / +4 lines)
Lines 238-243 Patrons: Link Here
238
         - pref: EmailSMSSendDriverFromAddress
238
         - pref: EmailSMSSendDriverFromAddress
239
           class: email
239
           class: email
240
         - "for emails sent using \"Email\" send driver."
240
         - "for emails sent using \"Email\" send driver."
241
         - "If the SMS::Send driver requires more options that just username/login and password, entire them here as YAML key/value pairs:"
242
         - pref: SMSSendAdditionalOptions
243
           type: textarea
244
           syntax: text/x-yaml
241
     -
245
     -
242
         - pref: FallbackToSMSIfNoEmail
246
         - pref: FallbackToSMSIfNoEmail
243
           choices:
247
           choices:
244
- 

Return to bug 36051