X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=admin%2Fmarctagstructure.pl;h=b930271af59ddd6ab1f5b4c32a6840d88c2c86ad;hb=e6f3fb9591844659bb7e6ccf909ec53cf6b7116a;hp=495901f2f89cc1a0debd9662f834600d09807c8f;hpb=af996a21e8f7ab4717b863f65f30e0b312a9a527;p=koha.git
diff --git a/admin/marctagstructure.pl b/admin/marctagstructure.pl
index 495901f2f8..b930271af5 100755
--- a/admin/marctagstructure.pl
+++ b/admin/marctagstructure.pl
@@ -24,10 +24,8 @@ use C4::Auth;
use C4::Koha;
use C4::Context;
use C4::Output;
-use C4::Interface::CGI::Output;
-use C4::Search;
use C4::Context;
-use HTML::Template;
+
# retrieve parameters
my $input = new CGI;
@@ -39,9 +37,11 @@ my $frameworkinfo = getframeworkinfo($frameworkcode);
my $searchfield=$input->param('searchfield');
$searchfield=0 unless $searchfield;
$searchfield=~ s/\,//g;
+my $last_searchfield=$input->param('searchfield');
-my $offset=$input->param('offset');
-my $op = $input->param('op');
+my $offset=$input->param('offset') || 0;
+my $op = $input->param('op') || '';
+my $dspchoice = $input->param('select_display');
my $pagesize=20;
my $script_name="/cgi-bin/koha/admin/marctagstructure.pl";
@@ -50,7 +50,7 @@ my $dbh = C4::Context->dbh;
# open template
my ($template, $loggedinuser, $cookie)
- = get_template_and_user({template_name => "parameters/marctagstructure.tmpl",
+ = get_template_and_user({template_name => "admin/marctagstructure.tmpl",
query => $input,
type => "intranet",
authnotrequired => 0,
@@ -118,50 +118,73 @@ if ($op eq 'add_form') {
my $authorised_value = CGI::scrolling_list(-name=>'authorised_value',
-values=> \@authorised_values,
-size=>1,
+ -id=>"authorised_value",
-multiple=>0,
-default => $data->{'authorised_value'},
);
+ $template->param(searchfield => $searchfield) if ($searchfield);
if ($searchfield) {
- $template->param(action => "Modify tag",
- searchfield => "$searchfield");
+ $template->param(action => "Modify tag");
$template->param('heading-modify-tag-p' => 1);
} else {
- $template->param(action => "Add tag",
- searchfield => "");
+ $template->param(action => "Add tag");
$template->param('heading-add-tag-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,''),
- authorised_value => $authorised_value,
- frameworkcode => $frameworkcode,
- );
+ libopac => $data->{'libopac'},
+ repeatable => CGI::checkbox(-name=>'repeatable',
+ -checked=> $data->{'repeatable'}?'checked':'',
+ -value=> 1,
+ -label => '',
+ -id=> 'repeatable'),
+ mandatory => CGI::checkbox(-name => 'mandatory',
+ -checked => $data->{'mandatory'}?'checked':'',
+ -value => 1,
+ -label => '',
+ -id => 'mandatory'),
+ authorised_value => $authorised_value,
+ frameworkcode => $frameworkcode,
+ );
# END $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 marc_tag_structure (tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value,frameworkcode) 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,
- $frameworkcode
- );
+ if ($input->param('modif')) {
+ $sth=$dbh->prepare("UPDATE marc_tag_structure SET liblibrarian=? ,libopac=? ,repeatable=? ,mandatory=? ,authorised_value=? WHERE frameworkcode=? AND tagfield=?");
+ unless (C4::Context->config('demo') eq 1) {
+ $sth->execute( $liblibrarian,
+ $libopac,
+ $repeatable?1:0,
+ $mandatory?1:0,
+ $authorised_value,
+ $frameworkcode,
+ $tagfield
+ );
+ }
+ $sth->finish;
+ } else {
+ $sth=$dbh->prepare("INSERT INTO marc_tag_structure (tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value,frameworkcode) values (?,?,?,?,?,?,?)");
+ unless (C4::Context->config('demo') eq 1) {
+ $sth->execute($tagfield,
+ $liblibrarian,
+ $libopac,
+ $repeatable?1:0,
+ $mandatory?1:0,
+ $authorised_value,
+ $frameworkcode
+ );
+ }
+ $sth->finish;
}
- $sth->finish;
- print "Content-Type: text/html\n\n