diff options
author | Ivan Kohler <ivan@freeside.biz> | 2017-04-19 17:16:23 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2017-04-19 17:16:23 -0700 |
commit | f75a63a2fdf3fa154b5865f62387380bea1b134f (patch) | |
tree | e64d421b358d930c53b2c108a24f3d3ba6c1a018 /httemplate/browse/cust_class.html | |
parent | 27faccf1f8017a07bc6b527258448a723eb904b2 (diff) |
customer links on customer class browse
Diffstat (limited to 'httemplate/browse/cust_class.html')
-rw-r--r-- | httemplate/browse/cust_class.html | 56 |
1 files changed, 53 insertions, 3 deletions
diff --git a/httemplate/browse/cust_class.html b/httemplate/browse/cust_class.html index 70a279a05..a35c045cf 100644 --- a/httemplate/browse/cust_class.html +++ b/httemplate/browse/cust_class.html @@ -23,12 +23,62 @@ my $html_init = 'Customer classes define groups of customer for reporting.<BR><BR>'. qq!<A HREF="${p}edit/cust_class.html"><I>Add a customer class</I></A><BR><BR>!; +#cust_class-disable_counts? or just migrate this to one config probably +#my $disable_counts = $conf->exists('agent-disable_counts'); +my $disable_counts = 0; + +my $customers_sub = sub { + my $cust_class = shift; + + my $cust_main_link = $p. 'search/cust_main.html?'. + 'classnum='. $cust_class->classnum; + + #false laziness w/agent.cgi + my $OUT = '<TABLE CLASS="inv" CELLSPACING=0 CELLPADDING=0>'; + + my @cust_status = + qw( prospect inactive ordered active suspended cancelled ); + my %PL = ( 'prospect' => 'prospects', ); + #my %link = ( 'cancelled' => 'showcancelledcustomers=1&cancelled' ); + my $statuscolor = FS::cust_main->statuscolors; + + foreach my $status ( @cust_status ) { + my $meth = 'num_'. $status; + #my $link = exists($link{$status}) ? $link{$status} : $status; + + $OUT .= '<TR>'; + my $num = 0; + unless ( $disable_counts ) { + $num = $cust_class->$meth(); + $OUT .= '<TH ALIGN="right" WIDTH="40%">'. + '<FONT COLOR="#'. $statuscolor->{$status}. '">'. + $num. ' </FONT></TH>'; + } + $OUT .= '<TD>'; + + if ( $num || $disable_counts ) { + $OUT .= '<A HREF="'. $cust_main_link. "&status=$status". '">'; + } + $OUT .= exists($PL{$status}) ? $PL{$status} : $status; + if ($num || $disable_counts ) { + $OUT .= '</A>'; + } + + $OUT .= '</TD></TR>'; + + } + + $OUT .= '</TABLE>'; + + $OUT; + +}; + my $count_query = 'SELECT COUNT(*) FROM cust_class'; my $link = [ $p.'edit/cust_class.html?', 'classnum' ]; - -my $header = [ '#', 'Class' ]; -my $fields = [ 'classnum', 'classname' ]; +my $header = [ '#', 'Class', 'Customers' ]; +my $fields = [ 'classnum', 'classname', $customers_sub, ]; my $links = [ $link, $link ]; my $cat_query = 'SELECT COUNT(*) FROM cust_class where categorynum IS NOT NULL'; |