diff options
author | Ivan Kohler <ivan@freeside.biz> | 2015-12-07 10:54:35 -0800 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2015-12-07 10:54:35 -0800 |
commit | 11d5740bd96b166b6cd4f90fde22b556f93b5caf (patch) | |
tree | efb1248d1ef7f236fc277e3594aa73f744fefead /httemplate | |
parent | 00fb90f744ceddb3b36bf2820b7279742cd3ae43 (diff) |
fix customer browse in the presense of non-numeric agent_custid, RT#31388
Diffstat (limited to 'httemplate')
-rwxr-xr-x | httemplate/search/cust_main.cgi | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index f48ea3fb0..5a574bcea 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -341,7 +341,12 @@ if ( $cgi->param('browse') if ( $query eq 'custnum' ) { if ( $conf->exists('cust_main-default_agent_custid') ) { $sortby=\*display_custnum_sort; - $orderby = "ORDER BY CASE WHEN agent_custid IS NOT NULL AND agent_custid != '' THEN CAST(agent_custid AS BIGINT) ELSE custnum END"; + $orderby = "ORDER BY CASE WHEN agent_custid IS NOT NULL + AND agent_custid != '' + AND agent_custid ". regexp_sql. " '^[0-9]+\$' + THEN CAST(agent_custid AS BIGINT) + ELSE custnum + END"; } else { $sortby=\*custnum_sort; $orderby = "ORDER BY custnum"; |