diff options
author | ivan <ivan> | 2006-03-08 12:14:04 +0000 |
---|---|---|
committer | ivan <ivan> | 2006-03-08 12:14:04 +0000 |
commit | 6d2cd8e6fc566b4fccd0075156e3e1ddd59fa042 (patch) | |
tree | 5c08fa887aca0ca1b19adb009d06e4beb85a56b6 /httemplate/search/inventory_item.html | |
parent | 600a0939e7e7e589dae4f4f5bfef3650728940b7 (diff) |
Add an option to the web interface to batch upload new entries to the
inventory_item table.
Diffstat (limited to 'httemplate/search/inventory_item.html')
-rw-r--r-- | httemplate/search/inventory_item.html | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/httemplate/search/inventory_item.html b/httemplate/search/inventory_item.html index ff7f1fadf..bd74f5619 100644 --- a/httemplate/search/inventory_item.html +++ b/httemplate/search/inventory_item.html @@ -1,15 +1,31 @@ <% my $classnum = $cgi->param('classnum'); -$classnum =~ /^(\d+)$/ or eidiot "illegal agentnum $agentnum"; +$classnum =~ /^(\d+)$/ or eidiot "illegal classnum $classnum"; $classnum = $1; -my $inventory_class = qsearchs('inventory_class', { 'classnum' => $classnum } ); + +my $inventory_class = qsearchs( { + 'table' => 'inventory_class', + 'hashref' => { 'classnum' => $classnum }, +} ); + +my $title = $inventory_class->classname. ' Inventory'; + +#little false laziness with SQL fragments in inventory_class.pm +my $extra_sql = ''; +if ( $cgi->param('avail') ) { + $extra_sql = 'AND ( svcnum IS NULL OR svcnum = 0 )'; + $title .= ' - Available'; +} elsif ( $cgi->param('used') ) { + $extra_sql = 'AND svcnum IS NOT NULL AND svcnum > 0'; + $title .= ' - In use'; +} my $count_query = - "SELECT COUNT(*) FROM inventory_class WHERE classnum = $classnum"; + "SELECT COUNT(*) FROM inventory_item WHERE classnum = $classnum $extra_sql"; %><%= include( 'elements/search.html', - 'title' => $inventory_class->classname. ' Inventory', + 'title' => $title, #less lame to use Lingua:: something to pluralize 'name' => $inventory_class->classname. 's', @@ -17,6 +33,7 @@ my $count_query = 'query' => { 'table' => 'inventory_item', 'hashref' => { 'classnum' => $classnum }, + 'extra_sql' => $extra_sql, }, 'count_query' => $count_query, |