X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fmisc%2Fxmlhttp-cust_main-search.cgi;h=26e68b5d87d9808581a46517bb4f772304165f2f;hp=20707dab895e3b4caf4d7dad3b56bbc6257f432a;hb=8032977c915b42634c70feee045b4ec42c3db98f;hpb=4eea4e8c5dc178ccd3b478b80361896da027e481 diff --git a/httemplate/misc/xmlhttp-cust_main-search.cgi b/httemplate/misc/xmlhttp-cust_main-search.cgi index 20707dab8..26e68b5d8 100644 --- a/httemplate/misc/xmlhttp-cust_main-search.cgi +++ b/httemplate/misc/xmlhttp-cust_main-search.cgi @@ -1,11 +1,21 @@ % if ( $sub eq 'custnum_search' ) { % % my $custnum = $cgi->param('arg'); -% my $cust_main = qsearchs({ -% 'table' => 'cust_main', -% 'hashref' => { 'custnum' => $custnum }, -% 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, -% }); +% my $cust_main = ''; +% if ( $custnum <= 2147483647 ) { +% $cust_main = qsearchs({ +% 'table' => 'cust_main', +% 'hashref' => { 'custnum' => $custnum }, +% 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, +% }); +% } +% if ( ! $cust_main ) { +% $cust_main = qsearchs({ +% 'table' => 'cust_main', +% 'hashref' => { 'agent_custid' => $custnum }, +% 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, +% }); +% } % "<% $cust_main ? $cust_main->name : '' %>" % @@ -19,6 +29,8 @@ % } <%init> +my $conf = new FS::Conf; + my $sub = $cgi->param('sub');