Merge branch 'master' of /usr/local/git/koha_base.git/
[koha_fer] / cataloguing / value_builder / marc21_field_007.pl
index e780dd1..ad3ca89 100755 (executable)
@@ -33,6 +33,7 @@ use C4::Output;
 plugin_parameters : other parameters added when the plugin is called by the dopop function
 
 =cut
+
 sub plugin_parameters {
 my ($dbh,$record,$tagslib,$i,$tabloop) = @_;
 return "";
@@ -40,7 +41,7 @@ return "";
 
 sub plugin_javascript {
 my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_;
-my $function_name= "100".(int(rand(100000))+1);
+my $function_name= $field_number;
 my $res="
 <script>
 function Focus$function_name(subfield_managed) {
@@ -52,8 +53,8 @@ function Blur$function_name(subfield_managed) {
 }
 
 function Clic$function_name(i) {
-       defaultvalue=document.forms['f'].field_value[i].value;
-       newin=window.open(\"plugin_launcher.pl?plugin_name=marc21_field_007.pl&index=\"+i+\"&result=\"+defaultvalue,\"unimarc field 100\",'width=1000,height=600,toolbar=false,scrollbars=yes');
+       defaultvalue=document.getElementById(\"$field_number\").value;
+       newin=window.open(\"plugin_launcher.pl?plugin_name=marc21_field_007.pl&index=$field_number&result=\"+defaultvalue,\"unimarc field 100\",'width=1000,height=600,toolbar=false,scrollbars=yes');
 
 }
 </script>
@@ -63,9 +64,6 @@ return ($function_name,$res);
 }
 sub plugin {
 my ($input) = @_;
-       my %env;
-
-#      my $input = new CGI;
        my $index= $input->param('index');
        my $result= $input->param('result');
 
@@ -90,7 +88,7 @@ my ($template, $loggedinuser, $cookie)
                                                        f1 => $f1,
                                                         "f1$f1" => $f1,
                                        );
-       print $input->header(-cookie => $cookie),$template->output;
+        output_html_with_http_headers $input, $cookie, $template->output;
 }
 
 1;