From 9d8857f3445c4f5c63b2fac0563a9be36df289d2 Mon Sep 17 00:00:00 2001 From: hdl Date: Thu, 19 Dec 2002 15:22:18 +0000 Subject: [PATCH] Templating reports.pl This might be of no use... Since it is never called and seems obsolete. --- C4/Stats.pm | 5 ++-- C4/Stock.pm | 4 +-- .../intranet-tmpl/default/en/reports.tmpl | 8 +++++ reports.pl | 30 +++++++++++-------- 4 files changed, 31 insertions(+), 16 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/default/en/reports.tmpl 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 -- 2.20.1