Bug 11431: (QA followup) Add ability to edit audio alerts
[srvgit] / admin / systempreferences.pl
index d41f2a7..01c0300 100755 (executable)
@@ -8,18 +8,18 @@
 #
 # This file is part of Koha.
 #
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
+# Koha is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
 #
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
 #
-# You should have received a copy of the GNU General Public License along
-# with Koha; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
 
 =head1 systempreferences.pl
 
@@ -43,7 +43,7 @@ ALSO :
 use strict;
 use warnings;
 
-use CGI;
+use CGI qw ( -utf8 );
 use MIME::Base64;
 use C4::Auth;
 use C4::Context;
@@ -70,14 +70,16 @@ sub StringSearch {
 
     my $strsth = "Select variable,value,explanation,type,options from systempreferences where variable in (";
     my $first = 1;
+    my @sql_bind;
     for my $name ( get_local_prefs() ) {
                 $strsth .= ',' unless $first;
-                $strsth .= "'$name'";
+                $strsth .= "?";
+                push(@sql_bind,$name);
                 $first = 0;
     }
     $strsth .= ") order by variable";
     $sth = $dbh->prepare($strsth);
-    $sth->execute();
+    $sth->execute(@sql_bind);
 
     while ( my $data = $sth->fetchrow_hashref ) {
             unless (defined $data->{value}) { $data->{value} = "";}
@@ -128,6 +130,11 @@ sub GetPrefParams {
         $data->{options} =~ /(.*)\|(.*)/;
         $params->{'cols'} = $1;
         $params->{'rows'} = $2;
+    } elsif ( $data->{'type'} eq 'Htmlarea' ) {
+        $params->{'type_htmlarea'} = 1;
+        $data->{options} =~ /(.*)\|(.*)/;
+        $params->{'cols'} = $1;
+        $params->{'rows'} = $2;
     } elsif ( $data->{'type'} eq 'Themes' ) {
         $params->{'type_choice'} = 1;
         my $type = '';
@@ -207,7 +214,7 @@ my $offset      = $input->param('offset') || 0;
 my $script_name = "/cgi-bin/koha/admin/systempreferences.pl";
 
 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
-    {   template_name   => "admin/systempreferences.tmpl",
+    {   template_name   => "admin/systempreferences.tt",
         query           => $input,
         type            => "intranet",
         authnotrequired => 0,
@@ -357,7 +364,7 @@ if ( $op eq 'add_form' ) {
             logaction( 'SYSTEMPREFERENCE', 'ADD', undef, $input->param('variable') . " | " . $value );
         }
     }
-    print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=systempreferences.pl?tab=\"></html>";
+    print $input->redirect("/cgi-bin/koha/admin/systempreferences.pl?tab=");
     exit;
 ################## DELETE_CONFIRM ##################################
     # called by default form, used to confirm deletion of data in DB