Make sure the total number of matching itemtypes is counted correctly;
[koha_gimpoz] / admin / aqbookfund.pl
index 217c2f8..63335ab 100755 (executable)
 
 use strict;
 use CGI;
+use C4::Auth;
 use C4::Context;
 use C4::Output;
+use C4::Interface::CGI::Output;
 use C4::Search;
 use HTML::Template;
 
@@ -50,14 +52,14 @@ sub StringSearch  {
        $searchstring=~ s/\'/\\\'/g;
        my @data=split(' ',$searchstring);
        my $count=@data;
-       my $query="select bookfundid,bookfundname,bookfundgroup from aqbookfund where bookfundid and (bookfundid like \"$data[0]%\") order by bookfundid";
+       my $query="select bookfundid,bookfundname,bookfundgroup from aqbookfund where (bookfundid like \"$data[0]%\") order by bookfundid";
        my $sth=$dbh->prepare($query);
        $sth->execute;
        my @results;
        my $cnt=0;
        while (my $data=$sth->fetchrow_hashref){
-       push(@results,$data);
-       $cnt ++;
+               push(@results,$data);
+               $cnt ++;
        }
        #  $sth->execute;
        $sth->finish;
@@ -73,7 +75,15 @@ my $pagesize=20;
 my $op = $input->param('op');
 $searchfield=~ s/\,//g;
 
-my $template = gettemplate("parameters/aqbookfund.tmpl",0);
+my ($template, $borrowernumber, $cookie)
+    = get_template_and_user({template_name => "parameters/aqbookfund.tmpl",
+                            query => $input,
+                            type => "intranet",
+                            authnotrequired => 0,
+                            flagsrequired => {parameters => 1},
+                            debug => 1,
+                            });
+
 if ($op) {
 $template->param(script_name => $script_name,
                                                $op              => 1); # we show only the TMPL_VAR names $op
@@ -184,7 +194,7 @@ if ($op eq 'add_form') {
                } else {
                        $toggle="white";
                }
-       while (@toggle and @bookfundid and @bookfundname and @bookfundgroup) { 
+       while (@toggle and @bookfundid and @bookfundname and @bookfundgroup) {
           my %row_data;
           $row_data{toggle} = shift @toggle;
           $row_data{bookfundid} = shift @bookfundid;
@@ -196,6 +206,4 @@ if ($op eq 'add_form') {
        $template->param(bookfund => \@loop_data);
 } #---- END $OP eq DEFAULT
 
-
-
-print "Content-Type: text/html\n\n", $template->output;
+output_html_with_http_headers $input, $cookie, $template->output;