1 <% include( 'elements/browse.html',
2 'title' => 'Package classes',
3 'html_init' => $html_init,
4 'name' => 'package classes',
6 'disabled_statuspos' => 2,
7 'query' => { 'table' => 'pkg_class',
9 'extra_sql' => 'ORDER BY classnum',
11 'count_query' => $count_query,
20 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
23 'Package classes define groups of packages, for reporting and '.
24 'convenience purposes.<BR><BR>'.
25 qq!<A HREF="${p}edit/pkg_class.html"><I>Add a package class</I></A><BR><BR>!;
27 my $count_query = 'SELECT COUNT(*) FROM pkg_class';
29 my $link = [ $p.'edit/pkg_class.html?', 'classnum' ];
31 my $header = [ '#', 'Class' ];
32 my $fields = [ 'classnum', 'classname' ];
33 my $links = [ $link, $link ];
35 my $cat_query = 'SELECT COUNT(*) FROM pkg_class where categorynum IS NOT NULL';
36 my $sth = dbh->prepare($cat_query)
37 or die "Error preparing $cat_query: ". dbh->errstr;
39 or die "Error executing $cat_query: ". $sth->errstr;
40 if ($sth->fetchrow_arrayref->[0]) {
41 push @$header, 'Category';
42 push @$fields, 'categoryname';