summaryrefslogtreecommitdiff
path: root/httemplate/misc/xmlhttp-cust_main-search.cgi
blob: 8dbd5a4f20d98c53e5c858d0201be7716f1d710f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<%
   my $sub = $cgi->param('sub');
 
   if ( $sub eq 'custnum_search' ) {
 
     my $custnum = $cgi->param('arg');
     my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } );

     %>"<%= $cust_main ? $cust_main->name : '' %>"

<% } elsif ( $sub eq 'smart_search' ) {

     my $string = $cgi->param('arg');
     my @cust_main = smart_search( 'search' => $string );
     my $return = [ map [ $_->custnum, $_->name ], @cust_main ];

     %><%= objToJson($return) %>

<% } %>