<%doc> Example: include( '/elements/search-cust_main.html, 'field' => 'custnum', #slightly deprecated old synonym for field#'field_name'=>'custnum', 'find_button' => 1, #add a "find" button to the field 'curr_value' => 54, #current value 'value => 32, #deprecated synonym for curr_value ); % if ( $opt{'find_button'} ) { % } <% include('/elements/xmlhttp.html', 'url' => $p. 'misc/xmlhttp-cust_main-search.cgi', 'subs' => [ 'smart_search' ], ) %> <%init> my( %opt ) = @_; my $field = $opt{'field'} || $opt{'field_name'} || 'custnum'; my $value = $opt{'curr_value'} || $opt{'value'}; my $cust_main = ''; if ( $value ) { $cust_main = qsearchs({ 'table' => 'cust_main', 'hashref' => { 'custnum' => $value }, 'extra_sql' => " AND ". $FS::CurrentUser::CurrentUser->agentnums_sql, }); }