1 % if ( $sub eq 'custnum_search' ) {
3 % my $custnum = $cgi->param('arg');
5 % if ( $custnum <= 2147483647 ) {
6 % $cust_main = qsearchs({
7 % 'table' => 'cust_main',
8 % 'hashref' => { 'custnum' => $custnum },
9 % 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
12 % if ( ! $cust_main ) {
13 % $cust_main = qsearchs({
14 % 'table' => 'cust_main',
15 % 'hashref' => { 'agent_custid' => $custnum },
16 % 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
20 "<% $cust_main ? $cust_main->name : '' %>"
22 % } elsif ( $sub eq 'smart_search' ) {
24 % my $string = $cgi->param('arg');
25 % my @cust_main = smart_search( 'search' => $string );
26 % my $return = [ map [ $_->custnum, $_->name ], @cust_main ];
28 <% objToJson($return) %>
32 my $conf = new FS::Conf;
34 my $sub = $cgi->param('sub');