X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fsqlradius_usage.html;h=561476e0b03b47053cf49272b3aa09f7590714a9;hb=cd4651d982b36a8ac8f9e57ef1b9c34734259cdc;hp=fcf6c100eece87d5614eadc27acfc09c378c32b4;hpb=267fab684da71cbe17dcd78d16283cb9b0f8064f;p=freeside.git diff --git a/httemplate/search/sqlradius_usage.html b/httemplate/search/sqlradius_usage.html index fcf6c100e..561476e0b 100644 --- a/httemplate/search/sqlradius_usage.html +++ b/httemplate/search/sqlradius_usage.html @@ -39,6 +39,7 @@ @svc_fields, @svc_usage, ], + 'order_by_sql' => $order_by_sql, 'links' => [ #( map { $_ ne 'Cust. Status' ? $link_cust : '' } # FS::UI::Web::cust_header() ), $link_cust, @@ -256,4 +257,24 @@ sub bytes_to_gb { $_[0] ? sprintf('%.3f', $_[0] / (1024*1024*1024.0)) : ''; } + +my $conf = new FS::Conf; +my $order_by_sql = { + 'name' => "CASE WHEN cust_main.company IS NOT NULL + AND cust_main.company != '' + THEN CONCAT(cust_main.company,' (',cust_main.last,', ',cust_main.first,')') + ELSE CONCAT(cust_main.last,', ',cust_main.first) + END", + 'display_custnum' => $conf->exists('cust_main-default_agent_custid') + ? "CASE WHEN cust_main.agent_custid IS NOT NULL + AND cust_main.agent_custid != '' + AND cust_main.agent_custid ". regexp_sql. " '^[0-9]+\$' + THEN CAST(cust_main.agent_custid AS BIGINT) + ELSE cust_main.custnum + END" + : "custnum", +}; + +#warn Dumper \%usage_by_username; +