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:34:36 -0800 |
commit | cc0b50aa2d0952e3fe06c9a44c6637ad2fcb5588 (patch) | |
tree | 8f01a8f5ba602c579ff99e15a940c7e8c5cb9c3d /httemplate/search/cust_main_churn.html | |
parent | 08e9b7ea8e912dfa70de6d08eb7849d3bd9c68b5 (diff) |
make location fields available on churn report, #39988
Diffstat (limited to 'httemplate/search/cust_main_churn.html')
-rwxr-xr-x | 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 100755 --- 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'); |