diff options
author | jeff <jeff> | 2008-06-19 03:18:19 +0000 |
---|---|---|
committer | jeff <jeff> | 2008-06-19 03:18:19 +0000 |
commit | f13afe5e228a220311557e1ca6dacbf847c26baf (patch) | |
tree | 9cd6b6e511234d72dfa9e8dd8278a721e5ad03eb /httemplate/browse/pkg_class.html | |
parent | 795a85c10d898120a2a6341c4df32fb60b069a64 (diff) |
package categories (meta package classes) and grouping invoices by them
Diffstat (limited to 'httemplate/browse/pkg_class.html')
-rw-r--r-- | httemplate/browse/pkg_class.html | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/httemplate/browse/pkg_class.html b/httemplate/browse/pkg_class.html index 4f02ca22d..75969dbe8 100644 --- a/httemplate/browse/pkg_class.html +++ b/httemplate/browse/pkg_class.html @@ -9,9 +9,9 @@ 'extra_sql' => 'ORDER BY classnum', }, 'count_query' => $count_query, - 'header' => [ '#', 'Class', ], - 'fields' => [ 'classnum', 'classname' ], - 'links' => [ $link, $link ], + 'header' => $header, + 'fields' => $fields, + 'links' => $links, ) %> <%init> @@ -28,4 +28,19 @@ my $count_query = 'SELECT COUNT(*) FROM pkg_class'; my $link = [ $p.'edit/pkg_class.html?', 'classnum' ]; +my $header = [ '#', 'Class' ]; +my $fields = [ 'classnum', 'classname' ]; +my $links = [ $link, $link ]; + +my $cat_query = 'SELECT COUNT(*) FROM pkg_class where categorynum IS NOT NULL'; +my $sth = dbh->prepare($cat_query) + or die "Error preparing $cat_query: ". dbh->errstr; +$sth->execute + or die "Error executing $cat_query: ". $sth->errstr; +if ($sth->fetchrow_arrayref->[0]) { + push @$header, 'Category'; + push @$fields, 'categoryname'; + push @$links, $link; +} + </%init> |