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',
8 'addl_from' => ' LEFT JOIN pkg_category USING (categorynum)',
10 'order_by' => 'ORDER BY classnum',
12 'count_query' => $count_query,
21 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
23 local($FS::Record::qsearch_qualify_columns) = 1;
25 my $conf = new FS::Conf;
28 'Package classes define groups of packages, for taxation, ordering '.
29 'convenience and reporting.<BR><BR>'.
30 qq!<A HREF="${p}edit/pkg_class.html"><I>Add a package class</I></A><BR><BR>!;
32 my $count_query = 'SELECT COUNT(*) FROM pkg_class';
34 my $link = [ $p.'edit/pkg_class.html?', 'classnum' ];
36 my $header = [ '#', 'Class' ];
37 my $fields = [ 'classnum', 'classname' ];
38 my $links = [ $link, $link ];
40 if($conf->exists('cust_main-require_censustract')) {
41 push @{$fields}, 'fcc_ds0s';
42 push @{$header}, 'FCC form 477 voice-grade equivalents';
46 my $cat_query = 'SELECT COUNT(*) FROM pkg_class where categorynum IS NOT NULL';
47 my $sth = dbh->prepare($cat_query)
48 or die "Error preparing $cat_query: ". dbh->errstr;
50 or die "Error executing $cat_query: ". $sth->errstr;
51 if ($sth->fetchrow_arrayref->[0]) {
52 push @$header, 'Category';
53 push @$fields, 'categoryname';
54 push @$links, [ $p.'edit/pkg_category.html?', 'categorynum' ]