Portuguese updates
[koha.git] / admin / marctagstructure.pl
index b98d965..b930271 100755 (executable)
@@ -37,6 +37,7 @@ 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') || 0;
 my $op = $input->param('op') || '';
@@ -117,15 +118,14 @@ if ($op eq 'add_form') {
        my $authorised_value  = CGI::scrolling_list(-name=>'authorised_value',
                        -values=> \@authorised_values,
                        -size=>1,
-                       -tabindex=>'',
                        -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");
@@ -137,13 +137,11 @@ if ($op eq 'add_form') {
                        repeatable => CGI::checkbox(-name=>'repeatable',
                                                -checked=> $data->{'repeatable'}?'checked':'',
                                                -value=> 1,
-                                               -tabindex=>'',
                                                -label => '',
                                                -id=> 'repeatable'),
                        mandatory => CGI::checkbox(-name => 'mandatory',
                                                -checked => $data->{'mandatory'}?'checked':'',
                                                -value => 1,
-                                               -tabindex=>'',
                                                -label => '',
                                                -id => 'mandatory'),
                        authorised_value => $authorised_value,
@@ -153,15 +151,15 @@ if ($op eq 'add_form') {
 ################## ADD_VALIDATE ##################################
 # called by add_form, used to insert/modify data in DB
 } elsif ($op eq 'add_validate') {
+       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');
     if ($input->param('modif')) {
         $sth=$dbh->prepare("UPDATE marc_tag_structure SET liblibrarian=? ,libopac=? ,repeatable=? ,mandatory=? ,authorised_value=? WHERE frameworkcode=? AND tagfield=?");
-        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) {
+         unless (C4::Context->config('demo') eq 1) {
             $sth->execute(  $liblibrarian,
                             $libopac,
                             $repeatable?1:0,
@@ -174,12 +172,6 @@ if ($op eq 'add_form') {
         $sth->finish;
        } else {
         $sth=$dbh->prepare("INSERT INTO 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,
@@ -192,7 +184,7 @@ if ($op eq 'add_form') {
         }
         $sth->finish;
        }
-       print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=marctagstructure.pl?searchfield=$tagfield&frameworkcode=$frameworkcode\"></html>";
+    print $input->redirect("/cgi-bin/koha/admin/marctagstructure.pl?searchfield=$tagfield&frameworkcode=$frameworkcode");
        exit;
                                                                                                        # END $OP eq ADD_VALIDATE
 ################## DELETE_CONFIRM ##################################
@@ -214,6 +206,9 @@ if ($op eq 'add_form') {
                $dbh->do("delete from marc_tag_structure where tagfield='$searchfield' and frameworkcode='$frameworkcode'");
                $dbh->do("delete from marc_subfield_structure where tagfield='$searchfield' and frameworkcode='$frameworkcode'");
        }
+       $template->param(searchfield => $searchfield,
+                                                       frameworkcode => $frameworkcode,
+                                                       );
                                                                                                        # END $OP eq DELETE_CONFIRMED
 ################## ITEMTYPE_CREATE ##################################
 # called automatically if an unexisting  frameworkis selected