X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=admin%2Fauth_tag_structure.pl;h=906f8d3e82449f0aaf3ddac7f297db26dfa84fea;hb=2c5b11620e5703810d94009eb992033231a40941;hp=b86a17ed67dd48cf7f83151411616a96d4eeb301;hpb=fe59c6c516d456e7455947b195033b3f2380180e;p=koha_fer
diff --git a/admin/auth_tag_structure.pl b/admin/auth_tag_structure.pl
index b86a17ed67..906f8d3e82 100755
--- a/admin/auth_tag_structure.pl
+++ b/admin/auth_tag_structure.pl
@@ -14,37 +14,33 @@
# 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., 59 Temple Place,
-# Suite 330, Boston, MA 02111-1307 USA
+# 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.
use strict;
+#use warnings; FIXME - Bug 2505
use CGI;
use C4::Auth;
use C4::Koha;
use C4::Context;
use C4::Output;
-use C4::Interface::CGI::Output;
-use C4::Search;
use C4::Context;
# retrieve parameters
my $input = new CGI;
-my $authtypecode = $input->param('authtypecode'); # set to select framework
-$authtypecode="" unless $authtypecode;
-my $existingauthtypecode = $input->param('existingauthtypecode'); # set when we have to create a new framework (in authtype) by copying an old one (in existingauthtype)
-$existingauthtypecode = "" unless $existingauthtypecode;
+my $authtypecode = $input->param('authtypecode') || ''; # set to select framework
+my $existingauthtypecode = $input->param('existingauthtypecode') || ''; # set when we have to create a new framework (in authtype) by copying an old one (in existingauthtype)
+
# my $authtypeinfo = getauthtypeinfo($authtype);
-my $searchfield=$input->param('searchfield');
-$searchfield=0 unless $searchfield;
-$searchfield=~ s/\,//g;
+my $searchfield = $input->param('searchfield') || 0;
+my $offset = $input->param('offset') || 0;
+my $op = $input->param('op') || '';
+$searchfield =~ s/\,//g;
-my $offset=$input->param('offset');
-my $op = $input->param('op');
-my $pagesize=20;
-my $script_name="/cgi-bin/koha/admin/auth_tag_structure.pl";
+my $script_name = "/cgi-bin/koha/admin/auth_tag_structure.pl";
my $dbh = C4::Context->dbh;
@@ -54,26 +50,24 @@ my ($template, $loggedinuser, $cookie)
query => $input,
type => "intranet",
authnotrequired => 0,
- flagsrequired => {parameters => 1},
+ flagsrequired => {parameters => 'parameters_remaining_permissions'},
debug => 1,
});
# get authtype list
-my $authtypes = getauthtypes;
-my @authtypesloop;
-foreach my $thisauthtype (keys %$authtypes) {
- my $selected = 1 if $thisauthtype eq $authtypecode;
- my %row =(value => $thisauthtype,
- selected => $selected,
- authtypetext => $authtypes->{$thisauthtype}->{'authtypetext'},
- );
- push @authtypesloop, \%row;
+my $authtypes = getauthtypes;
+my @authtypesloop = ();
+foreach my $thisauthtype ( keys %{$authtypes} ) {
+ push @authtypesloop,
+ { value => $thisauthtype,
+ selected => $thisauthtype eq $authtypecode,
+ authtypetext => $authtypes->{$thisauthtype}->{'authtypetext'},
+ };
}
my $sth;
# check that authtype framework is defined in auth_tag_structure if we are on a default action
if (!$op or $op eq 'authtype_create_confirm') {
-#warn "IN";
$sth=$dbh->prepare("select count(*) from auth_tag_structure where authtypecode=?");
$sth->execute($authtypecode);
my ($authtypeexist) = $sth->fetchrow;
@@ -88,15 +82,14 @@ if (!$op or $op eq 'authtype_create_confirm') {
}
}
}
+$template->param(script_name => $script_name);
$template->param(authtypeloop => \@authtypesloop);
if ($op && $op ne 'authtype_create_confirm') {
-$template->param(script_name => $script_name,
- $op => 1); # we show only the TMPL_VAR names $op
+ $template->param($op => 1);
} else {
-$template->param(script_name => $script_name,
- else => 1); # we show only the TMPL_VAR names $op
+ $template->param(else => 1);
}
-
+
################## ADD_FORM ##################################
# called by default. Used to create form to add or modify a record
if ($op eq 'add_form') {
@@ -106,7 +99,6 @@ if ($op eq 'add_form') {
$sth=$dbh->prepare("select tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value from auth_tag_structure where tagfield=? and authtypecode=?");
$sth->execute($searchfield,$authtypecode);
$data=$sth->fetchrow_hashref;
- $sth->finish;
}
my $sth = $dbh->prepare("select distinct category from authorised_values");
$sth->execute;
@@ -116,8 +108,10 @@ if ($op eq 'add_form') {
push @authorised_values, $category;
}
my $authorised_value = CGI::scrolling_list(-name=>'authorised_value',
+ -id=>'authorised_value',
-values=> \@authorised_values,
-size=>1,
+ -tabindex=>'',
-multiple=>0,
-default => $data->{'authorised_value'},
);
@@ -125,17 +119,17 @@ if ($op eq 'add_form') {
if ($searchfield) {
$template->param(action => "Modify tag",
searchfield => "$searchfield");
- $template->param('heading-modify-tag-p' => 1);
+ $template->param('heading_modify_tag_p' => 1);
} else {
$template->param(action => "Add tag",
searchfield => "");
- $template->param('heading-add-tag-p' => 1);
+ $template->param('heading_add_tag_p' => 1);
}
- $template->param('use-heading-flags-p' => 1);
+ $template->param('use_heading_flags_p' => 1);
$template->param(liblibrarian => $data->{'liblibrarian'},
libopac => $data->{'libopac'},
- repeatable => CGI::checkbox('repeatable',$data->{'repeatable'}?'checked':'',1,''),
- mandatory => CGI::checkbox('mandatory',$data->{'mandatory'}?'checked':'',1,''),
+ repeatable => "".$data->{'repeatable'},
+ mandatory => "".$data->{'mandatory'},
authorised_value => $authorised_value,
authtypecode => $authtypecode,
);
@@ -143,25 +137,39 @@ if ($op eq 'add_form') {
################## ADD_VALIDATE ##################################
# called by add_form, used to insert/modify data in DB
} elsif ($op eq 'add_validate') {
- $sth=$dbh->prepare("replace auth_tag_structure (tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value,authtypecode) values (?,?,?,?,?,?,?)");
- my $tagfield =$input->param('tagfield');
- my $liblibrarian = $input->param('liblibrarian');
- my $libopac =$input->param('libopac');
- my $repeatable =$input->param('repeatable');
- my $mandatory =$input->param('mandatory');
- my $authorised_value =$input->param('authorised_value');
- unless (C4::Context->config('demo') eq 1) {
- $sth->execute($tagfield,
- $liblibrarian,
- $libopac,
- $repeatable?1:0,
- $mandatory?1:0,
- $authorised_value,
- $authtypecode
- );
- }
- $sth->finish;
- print "Content-Type: text/html\n\n