projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix customer browse in the presense of non-numeric agent_custid, RT#31388
[freeside.git]
/
httemplate
/
search
/
cust_main.cgi
diff --git
a/httemplate/search/cust_main.cgi
b/httemplate/search/cust_main.cgi
index
f48ea3f
..
5a574bc
100755
(executable)
--- 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;
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";
} else {
$sortby=\*custnum_sort;
$orderby = "ORDER BY custnum";