#
# 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>.
#
use strict;
#use warnings; FIXME - Bug 2505
-use CGI;
+use CGI qw ( -utf8 );
use C4::Auth;
use C4::Context;
use C4::Output;
my $rule_code = $input->param('sort_rule');
my ($template, $loggedinuser, $cookie)
- = get_template_and_user({template_name => "admin/classsources.tmpl",
+ = get_template_and_user({template_name => "admin/classsources.tt",
query => $input,
type => "intranet",
authnotrequired => 0,
$rule_code);
$display_lists = 1;
} elsif ($op eq "delete_source") {
- delete_class_source_form($template);
+ delete_class_source_form($template, $source_code);
} elsif ($op eq "delete_source_confirmed") {
delete_class_source($template, $source_code);
$display_lists = 1;
sub add_class_source {
my ($template, $source_code, $description, $used, $sort_rule) = @_;
- AddClassSource($source_code, $description, $used, $sort_rule);
- $template->param(added_source => $source_code);
+ my $success = AddClassSource($source_code, $description, $used, $sort_rule);
+ if ($success > 0) {
+ $template->param(added_source => $source_code);
+ } else {
+ $template->param(failed_add_source => $source_code);
+ }
}
sub edit_class_source_form {
sub delete_class_source_form {
- my ($template) = @_;
+ my ($template, $source_code) = @_;
$template->param(
delete_class_source_form => 1,
confirm_op => "delete_source_confirmed",
sub add_class_sort_rule {
my ($template, $rule_code, $description, $sort_routine) = @_;
- AddClassSortRule($rule_code, $description, $sort_routine);
- $template->param(added_rule => $rule_code);
+ my $success = AddClassSortRule($rule_code, $description, $sort_routine);
+ if ($success > 0) {
+ $template->param(added_rule => $rule_code);
+ } else {
+ $template->param(failed_add_rule => $rule_code);
+ }
}
sub delete_sort_rule_form {