3 my $classnum = $cgi->param('classnum');
4 $classnum =~ /^(\d+)$/ or eidiot "illegal classnum $classnum";
7 my $inventory_class = qsearchs( {
8 'table' => 'inventory_class',
9 'hashref' => { 'classnum' => $classnum },
12 my $title = $inventory_class->classname. ' Inventory';
14 #little false laziness with SQL fragments in inventory_class.pm
16 if ( $cgi->param('avail') ) {
17 $extra_sql = 'AND ( svcnum IS NULL OR svcnum = 0 )';
18 $title .= ' - Available';
19 } elsif ( $cgi->param('used') ) {
20 $extra_sql = 'AND svcnum IS NOT NULL AND svcnum > 0';
21 $title .= ' - In use';
25 "SELECT COUNT(*) FROM inventory_item WHERE classnum = $classnum $extra_sql";
27 %><%= include( 'elements/search.html',
30 #less lame to use Lingua:: something to pluralize
31 'name' => $inventory_class->classname. 's',
34 'table' => 'inventory_item',
35 'hashref' => { 'classnum' => $classnum },
36 'extra_sql' => $extra_sql,
39 'count_query' => $count_query,
41 # XXX proper full service/customer link ala svc_acct
42 'header' => [ '#', $inventory_class->classname, 'svcnum' ],
47 'svcnum', #XXX proper full service customer link ala svc_acct
48 # "unallocated" ? "available" ?