diff options
| author | Ivan Kohler <ivan@freeside.biz> | 2015-12-07 10:54:37 -0800 |
|---|---|---|
| committer | Ivan Kohler <ivan@freeside.biz> | 2015-12-07 10:54:37 -0800 |
| commit | f2f7d6f2c69951862436cea6707d54451f6c4c65 (patch) | |
| tree | 0ae75ce746eab9afa00d180e2c5b612f3bda9bde | |
| parent | 52d332b9d4ce7a9aa27ba1da57fefb03275ba9ae (diff) | |
fix customer browse in the presense of non-numeric agent_custid, RT#31388
| -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 ff13f072b..fb5988259 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"; |
