diff options
author | Mark Wells <mark@freeside.biz> | 2016-01-27 14:33:41 -0800 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2016-01-27 14:33:41 -0800 |
commit | 4ec1b0028bf6d4d984558acd2349acbc5f988924 (patch) | |
tree | 1c8caa36cfdbb3291eb1dbff415a677c550233dc /httemplate/search | |
parent | b9fdec44072aaf4035ca64dc5d5b66880cbf0cf1 (diff) |
make location fields available on churn report, #39988
Diffstat (limited to 'httemplate/search')
-rw-r--r-- | httemplate/search/cust_main_churn.html | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/httemplate/search/cust_main_churn.html b/httemplate/search/cust_main_churn.html index 59f92cb6f..f1ba45016 100644 --- a/httemplate/search/cust_main_churn.html +++ b/httemplate/search/cust_main_churn.html @@ -33,6 +33,16 @@ 'e_suspended', 'e_cancelled', ], + 'sort_fields' => [ + 'custnum', + FS::UI::Web::cust_sql_fields, + 's_active', + 's_suspended', + 's_cancelled', + 'e_active', + 'e_suspended', + 'e_cancelled', + ], 'color' => [ '', FS::UI::Web::cust_colors(), @@ -77,13 +87,20 @@ if ($cgi->param('agentnum') =~ /^(\d+)$/) { # can't use this directly as it doesn't have any cust_main fields. my $churn = FS::cust_main::Status->churn_sql($speriod, $eperiod); +my $select = join(',', + 'churn.*', + 'cust_main.*', + FS::UI::Web::cust_sql_fields() +); +my $addl_from = " JOIN ($churn) AS churn USING (custnum) ". + FS::UI::Web::join_cust_main('cust_main.custnum') ; my $query = { 'table' => 'cust_main', - 'select' => 'cust_main.*, churn.*', - 'addl_from' => " JOIN ($churn) AS churn USING (custnum) ", + 'select' => $select, + 'addl_from' => $addl_from, }; -my $count_query = "SELECT COUNT(*) FROM cust_main JOIN ($churn) AS churn USING (custnum)"; +my $count_query = "SELECT COUNT(*) FROM cust_main $addl_from"; my @where; my $status = $cgi->param('status'); |