X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fcust_main.cgi;h=fb5988259414c4d47f3ea51d9b4e458ee9c5b3c5;hb=e7bad3b31830cd1c838c607a3336413a4c5ed50c;hp=2c09c692cd03e1a000bf27d7a4721106116fc43d;hpb=f3e0ac2b009c4edd5692cb587ff709dac2223ebe;p=freeside.git diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index 2c09c692c..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"; @@ -393,6 +398,7 @@ if ( $cgi->param('browse') push @qual, FS::cust_main->cancel_sql if $cgi->param('cancelled'); push @qual, FS::cust_main->prospect_sql if $cgi->param('prospect'); + push @qual, FS::cust_main->ordered_sql if $cgi->param('ordered'); push @qual, FS::cust_main->active_sql if $cgi->param('active'); push @qual, FS::cust_main->inactive_sql if $cgi->param('inactive'); push @qual, FS::cust_main->susp_sql if $cgi->param('suspended'); @@ -470,7 +476,9 @@ if ( $cgi->param('browse') $orderby = "ORDER BY LOWER(company || ' ' || last || ' ' || first )"; push @cust_main, smart_search( 'search' => scalar($cgi->param('search_cust')), - 'no_fuzzy_on_exact' => ! $curuser->option('enable_fuzzy_on_exact'), + 'no_fuzzy_on_exact' => ! ( $curuser->option('enable_fuzzy_on_exact') + || $conf->exists('enable_fuzzy_on_exact') + ), ); }