Merge remote-tracking branch 'kc/new/bug_6351' into kcmaster
[koha_gimpoz] / cataloguing / value_builder / labs_theses.pl
index f24b8c4..d486649 100755 (executable)
@@ -51,7 +51,7 @@ function Blur$function_name(subfield_managed) {
 
 function Clic$function_name(i) {
        defaultvalue=document.f.field_value[i].value;
-       newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=labs_theses.pl&cat_auth=LABTHE&index=\"+i+\"&result=\"+defaultvalue,\"unimarc field 328\",'width=700,height=700,toolbar=false,scrollbars=yes');
+       newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=labs_theses.pl&cat_auth=LABTHE&index=\"+i+\"&result=\"+defaultvalue,\"tag_editor\",'width=700,height=700,toolbar=false,scrollbars=yes');
 
 }
 //]]>
@@ -73,24 +73,22 @@ sub plugin {
        my ($template, $loggedinuser, $cookie);
        my $resultsperpage;
        my $search = $query->param('search');
-       
+
        if ($op eq "do_search") {
-       
+
                $resultsperpage= $query->param('resultsperpage');
                $resultsperpage = 19 if(!defined $resultsperpage);
 #              my $upperlimit=$startfrom+$resultsperpage;
                # builds tag and subfield arrays
                my $strquery = "SELECT authorised_value, lib from authorised_values where category = ? and lib like ?";
 #              $strquery .= " LIMIT $startfrom,$upperlimit";
-               
-               warn 'category : '.$cat_auth.' recherche :'.$search;
-               warn "$strquery";
+
                $search=~s/\*/%/g;
                my $sth = $dbh->prepare($strquery);
                $sth->execute($cat_auth,$search);
                $search=~s/%/\*/g;
-               
-               
+
+
                my @results;
                my $total;
                while (my $data = $sth->fetchrow_hashref){
@@ -101,28 +99,28 @@ sub plugin {
                        push @results, {'libjs'=>$libjs,
                                                        'lib'=>$data->{'lib'},
                                                        'authjs'=>$authjs,
-                                                       'auth_value'=>$data->{'authorised_value'}} 
+                                                       'auth_value'=>$data->{'authorised_value'}}
                                                        unless (($total<$startfrom) or ($total>$startfrom+$resultsperpage));
                        $total++;
                }
-               
+
                ($template, $loggedinuser, $cookie)
                        = get_template_and_user({template_name => "value_builder/labs_theses.tmpl",
                                        query => $query,
                                        type => 'intranet',
-                                       authnotrequired => 1,
+                                       authnotrequired => 0,
                                        debug => 1,
                                        });
-       
+
                # multi page display gestion
                my $displaynext=0;
                my $displayprev=$startfrom;
                if(($total - (($startfrom+1)*($resultsperpage))) > 0 ){
                        $displaynext = 1;
                }
-       
+
                my @numbers = ();
-       
+
                if ($total>$resultsperpage)
                {
                        for (my $i=1; (($i<$total/$resultsperpage+1) && ($i<16)); $i++)
@@ -135,10 +133,10 @@ sub plugin {
                                                startfrom => $resultsperpage*($i-1)};
                        }
                }
-       
+
                my $from = $startfrom+1;
                my $to;
-       
+
                if($total < (($startfrom+1)*$resultsperpage))
                {
                        $to = $total;
@@ -161,26 +159,25 @@ sub plugin {
                                                                numbers=>\@numbers,
                                                                resultlist=>1
                                                                );
-       
+
        } else {
                ($template, $loggedinuser, $cookie)
                        = get_template_and_user({template_name => "value_builder/labs_theses.tmpl",
                                                query => $query,
                                                type => "intranet",
-                                               authnotrequired => 1,
+                                               authnotrequired => 0,
                                        });
-               
+
                $template->param(
                                                'search'=>$query->param('search'),
                );
                $template->param(
                                                'index'=>''.$query->param('index')
                ) if ($query->param('index'));
-               warn 'index : '.$query->param('index');
                $template->param(
                                                'cat_auth'=>$cat_auth
                ) if ($cat_auth);
-       }       
+       }
        output_html_with_http_headers $query, $cookie, $template->output ;
 }