X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fsearch%2Finventory_item.html;h=fc690b33b751de41e57b0771f0fa74b401de2a96;hp=7049c8841ab8a5273467fc1e60d413fb6b521d5a;hb=3ce7691203a7737406bf2d4442f7fd84b81f847e;hpb=15e561850b61b10a92a46d8f3e316d53d4970087 diff --git a/httemplate/search/inventory_item.html b/httemplate/search/inventory_item.html index 7049c8841..fc690b33b 100644 --- a/httemplate/search/inventory_item.html +++ b/httemplate/search/inventory_item.html @@ -1,52 +1,53 @@ -<% - -my $classnum = $cgi->param('classnum'); -$classnum =~ /^(\d+)$/ or eidiot "illegal classnum $classnum"; -$classnum = $1; - -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_item WHERE classnum = $classnum $extra_sql"; - -my $link = sub { - my $inventory_item = shift; - if ( $inventory_item->svcnum ) { - [ "${p}view/svc_acct.cgi?", 'svcnum' ]; - } else { - ''; - } -}; -my $link_cust = sub { - my $inventory_item = shift; - if ( $inventory_item->custnum ) { - [ "${p}view/cust_main.cgi?", 'custnum' ]; - } else { - ''; - } -}; - -my $addl_from = ' LEFT JOIN cust_svc USING ( svcnum ) '. - ' LEFT JOIN part_svc USING ( svcpart ) '. - ' LEFT JOIN cust_pkg USING ( pkgnum ) '. - ' LEFT JOIN cust_main USING ( custnum ) '; - -%><%= include( 'elements/search.html', +% +% +%my $classnum = $cgi->param('classnum'); +%$classnum =~ /^(\d+)$/ or eidiot "illegal classnum $classnum"; +%$classnum = $1; +% +%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_item WHERE classnum = $classnum $extra_sql"; +% +%my $link = sub { +% my $inventory_item = shift; +% if ( $inventory_item->svcnum ) { +% [ "${p}view/svc_acct.cgi?", 'svcnum' ]; +% } else { +% ''; +% } +%}; +%my $link_cust = sub { +% my $inventory_item = shift; +% if ( $inventory_item->custnum ) { +% [ "${p}view/cust_main.cgi?", 'custnum' ]; +% } else { +% ''; +% } +%}; +% +%my $addl_from = ' LEFT JOIN cust_svc USING ( svcnum ) '. +% ' LEFT JOIN part_svc USING ( svcpart ) '. +% ' LEFT JOIN cust_pkg USING ( pkgnum ) '. +% ' LEFT JOIN cust_main USING ( custnum ) '; +% +% +<% include( 'elements/search.html', 'title' => $title,