Multi-bug fix - SetMarcUnicodeFlag for records coming from Koha
[koha_gimpoz] / admin / auth_subfields_structure.pl
index 295c7ae..a1c636e 100755 (executable)
@@ -1,6 +1,5 @@
 #!/usr/bin/perl
 
-
 # Copyright 2000-2002 Katipo Communications
 #
 # This file is part of Koha.
@@ -42,7 +41,6 @@ sub StringSearch  {
                $u++;
        }
        $sth->finish;
-       $dbh->disconnect;
        return ($cnt,\@results);
 }
 
@@ -151,9 +149,21 @@ if ($op eq 'add_form') {
                }
                $row_data{tab} = CGI::scrolling_list(-name=>'tab',
                                        -id=>"tab$i",
-                                       -values=>['-1','0'],
-                                       -labels => {'-1' =>'ignore','0'=>'0',
-                                                                       },
+                                        -values =>
+                                        [ '-1', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10' ],
+                                        -labels => {
+                                            '-1' => 'ignore',
+                                            '0'  => '0',
+                                            '1'  => '1',
+                                            '2'  => '2',
+                                            '3'  => '3',
+                                            '4'  => '4',
+                                            '5'  => '5',
+                                            '6'  => '6',
+                                            '7'  => '7',
+                                            '8'  => '8',
+                                            '9'  => '9',
+                                        },
                                        -default=>$data->{'tab'},
                                        -size=>1,
                                        -tabindex=>'',
@@ -189,7 +199,8 @@ if ($op eq 'add_form') {
                                        -size=>1,
                                        -multiple=>0,
                                        );
-               $row_data{tagsubfield} =$data->{'tagsubfield'}."<input type=\"hidden\" name=\"tagsubfield\" value=\"".$data->{'tagsubfield'}."\" id=\"tagsubfield\" />";
+               $row_data{tagsubfieldinput} = "<input type=\"hidden\" name=\"tagsubfield\" value=\"".$data->{'tagsubfield'}."\" id=\"tagsubfield\" />";
+               $row_data{tagsubfield} = $data->{'tagsubfield'};
                $row_data{liblibrarian} = CGI::escapeHTML($data->{'liblibrarian'});
                $row_data{libopac} = CGI::escapeHTML($data->{'libopac'});
                $row_data{seealso} = CGI::escapeHTML($data->{'seealso'});
@@ -201,7 +212,7 @@ if ($op eq 'add_form') {
                                        -multiple=>0,
                                        );
                $row_data{authorised_value}  = CGI::scrolling_list(-name=>'authorised_value',
-                                       -id=>'authorised_value',
+                                       -id=>"authorised_value$i",
                                        -values=> \@authorised_values,
                                        -default=>$data->{'authorised_value'},
                                        -size=>1,
@@ -209,7 +220,7 @@ if ($op eq 'add_form') {
                                        -multiple=>0,
                                        );
                $row_data{frameworkcode}  = CGI::scrolling_list(-name=>'frameworkcode',
-                                       -id=>'frameworkcode',
+                                       -id=>"frameworkcode$i",
                                        -values=> \@authtypes,
                                        -default=>$data->{'frameworkcode'},
                                        -size=>1,
@@ -217,7 +228,7 @@ if ($op eq 'add_form') {
                                        -multiple=>0,
                                        );
                $row_data{value_builder}  = CGI::scrolling_list(-name=>'value_builder',
-                                       -id=>'value_builder',
+                                       -id=>"value_builder$i",
                                        -values=> \@value_builder,
                                        -default=>$data->{'value_builder'},
                                        -size=>1,
@@ -249,11 +260,24 @@ if ($op eq 'add_form') {
        # add more_subfields empty lines for add if needed
        for (my $i=1;$i<=$more_subfields;$i++) {
                my %row_data;  # get a fresh hash for the row data
+        $row_data{'new_subfield'} = 1;
                $row_data{tab} = CGI::scrolling_list(-name=>'tab',
                                        -id => "tab$i",
-                                       -values=>['-1','0'],
-                                       -labels => {'-1' =>'ignore','0'=>'0',
-                                                                       },
+                                        -values =>
+                                        [ '-1', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10' ],
+                                        -labels => {
+                                            '-1' => 'ignore',
+                                            '0'  => '0',
+                                            '1'  => '1',
+                                            '2'  => '2',
+                                            '3'  => '3',
+                                            '4'  => '4',
+                                            '5'  => '5',
+                                            '6'  => '6',
+                                            '7'  => '7',
+                                            '8'  => '8',
+                                            '9'  => '9',
+                                        },
                                        -default=>"",
                                        -size=>1,
                                        -tabindex=>'',
@@ -290,7 +314,8 @@ if ($op eq 'add_form') {
                                        -size=>1,
                                        -multiple=>0,
                                        );
-               $row_data{tagsubfield} = "<input type=\"text\" name=\"tagsubfield\" value=\"".$data->{'tagsubfield'}."\" size=\"1\" id=\"tagsubfield\" maxlength=\"1\" />";
+               $row_data{tagsubfieldinput} = "<input type=\"text\" name=\"tagsubfield\" value=\"".$data->{'tagsubfield'}."\" size=\"1\" id=\"tagsubfield\" maxlength=\"1\" />";
+               $row_data{tagsubfield} = $data->{'tagsubfield'};
                $row_data{liblibrarian} = "";
                $row_data{libopac} = "";
                $row_data{seealso} = "";
@@ -347,7 +372,8 @@ if ($op eq 'add_form') {
        $template->param('use-heading-flags-p' => 1);
        $template->param('heading-edit-subfields-p' => 1);
        $template->param(action => "Edit subfields",
-                                                       tagfield => "<input type=\"hidden\" name=\"tagfield\" value=\"$tagfield\" />$tagfield",
+                                                       tagfield => $tagfield,
+                                                       tagfieldinput => "<input type=\"hidden\" name=\"tagfield\" value=\"$tagfield\" />",
                                                        loop => \@loop_data,
                                                        more_subfields => $more_subfields,
                                                        more_tag => $tagfield);
@@ -421,8 +447,7 @@ if ($op eq 'add_form') {
 } elsif ($op eq 'delete_confirm') {
        my $dbh = C4::Context->dbh;
        my $sth=$dbh->prepare("select * from auth_subfield_structure where tagfield=? and tagsubfield=? and authtypecode=?");
-       #FIXME : called with 2 bind variables when 3 are needed
-       $sth->execute($tagfield,$tagsubfield);
+       $sth->execute($tagfield,$tagsubfield,$authtypecode);
        my $data=$sth->fetchrow_hashref;
        $sth->finish;
        $template->param(liblibrarian => $data->{'liblibrarian'},
@@ -492,8 +517,4 @@ if ($op eq 'add_form') {
                $template->param(next => "<a href=\"$script_name?offset=$nextpage\">");
        }
 } #---- END $OP eq DEFAULT
-$template->param(intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
-               intranetstylesheet => C4::Context->preference("intranetstylesheet"),
-               IntranetNav => C4::Context->preference("IntranetNav"),
-               );
 output_html_with_http_headers $input, $cookie, $template->output;