diff --git a/C4/Stats.pm b/C4/Stats.pm index 9828b21f43..ea3a1d53db 100644 --- a/C4/Stats.pm +++ b/C4/Stats.pm @@ -123,8 +123,9 @@ sub circrep { my $i=0; my @results; while (my $data=$sth->fetchrow_hashref){ - $results[$i]="$data->{'datetime'}\t$data->{'branch'}"; - $i++; + my %tempvalue; + $tempvalue->{'value'}="$data->{'datetime'}\t$data->{'branch'}"; + push(@results, \%tempvalue); } $sth->finish; # print $query; diff --git a/C4/Stock.pm b/C4/Stock.pm index da3fef7912..98f6f2ec2f 100644 --- a/C4/Stock.pm +++ b/C4/Stock.pm @@ -40,13 +40,13 @@ sub stockreport { my $sth=$dbh->prepare($query); $sth->execute; my $count=$sth->fetchrow_hashref; - $results[0]="$count->{'count'}\t Levin"; + $results[0]->{'value'}="$count->{'count'}\t Levin"; $sth->finish; $query="Select count(*) from items where homebranch='F'"; $sth=$dbh->prepare($query); $sth->execute; $count=$sth->fetchrow_hashref; - $results[1]="$count->{'count'}\t Foxton"; + $results[1]->{'value'}="$count->{'count'}\t Foxton"; $sth->finish; return(@results); } diff --git a/koha-tmpl/intranet-tmpl/default/en/reports.tmpl b/koha-tmpl/intranet-tmpl/default/en/reports.tmpl new file mode 100644 index 0000000000..b21ceabda6 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/default/en/reports.tmpl @@ -0,0 +1,8 @@ + + +

reports

+ + + + + diff --git a/reports.pl b/reports.pl index 2276b22d99..d6f8c82634 100755 --- a/reports.pl +++ b/reports.pl @@ -28,25 +28,31 @@ use CGI; use C4::Output; use C4::Stats; use C4::Stock; +use HTML::Template; my $input = new CGI; -print $input->header; my $type=$input->param('type'); -print startpage(); -print startmenu('issue'); -my @data; +# 2002/12/19 hdl@ifrance.com templating +my $template=gettemplate("reports.tmpl"); +#print startpage(); +#print startmenu('issue'); +# 2002/12/19 hdl@ifrance.com templating end + +my @dataloop; if ($type eq 'search'){ - @data=statsreport('search','something'); + @dataloop=statsreport('search','something'); } if ($type eq 'issue'){ - @data=statsreport('issue','today'); + @dataloop=statsreport('issue','today'); } if ($type eq 'stock'){ - @data=stockreport(); + @dataloop=stockreport(); } -print mkheadr(1,"$type reports"); -print @data; - -print endmenu('issue'); -print endpage(); +# 2002/12/19 hdl@ifrance.com templating +$template->param( type => $type, + dataloop => \@dataloop); +#print endmenu('issue'); +#print endpage(); +print "Content-Type: text/html\n\n", $template->output; +# 2002/12/19 hdl@ifrance.com templating