%doc>
Example:
<& /elements/tr-select-sales.html',
#recommended to keep things "sticky" on errors
'curr_value' => $curr_value,
##
# optional
##
'label' => 'Sales Person',
'empty_label' => 'Select sales person', #override default
'disable_empty' => 0, #on byd efault, pass 0 to disable
'field' => 'salesnum', #HTML element name and ID
&>
%doc>
% if ( scalar(@sales) == 0 || $opt{'fixed'} ) {
% if ( scalar(@sales) > 0 ) {
% if ( $opt{'th'} ) {
<% $opt{'label'} || emt('Sales Person') %> |
% } else {
<% $opt{'label'} || emt('Sales Person') %> |
% }
>
% my $sales = qsearchs('sales', { 'salesnum' => $salesnum });
<% $sales ? $sales->salesperson : '(none)' |h %>
|
% } else { # YUCK. empty row so we don't throw g_row in edit.html off :/
% }
%
% } else {
% if ( $opt{'th'} ) {
<% $opt{'label'} || emt('Sales Person') %> |
% } else {
<% $opt{'label'} || emt('Sales Person') %> |
% }
>
<& /elements/select-sales.html,
'curr_value' => $salesnum,
'sales' => \@sales,
%opt,
&>
|
% }
<& /elements/xmlhttp.html,
'url' => $p.'misc/sales.cgi',
'subs' => [ 'get_sales' ],
&>
<%init>
my $curuser = $FS::CurrentUser::CurrentUser;
my %opt = @_;
my $salesnum = $opt{'curr_value'} || $opt{'value'};
my $field = $opt{'element_name'} || $opt{'field'} || 'salesnum';
my $id = $opt{'id'} || $opt{'field'} || 'salesnum';
my $hashref = { disabled => '' };
$hashref->{agentnum} = $opt{agentnum} if $opt{agentnum};
my @sales = qsearch({ 'table' => 'sales',
'hashref' => $hashref,
'extra_sql' => ' AND '. $curuser->agentnums_sql,
'order_by' => 'ORDER BY salesperson',
});
my $colspan = $opt{'colspan'} ? 'COLSPAN="'.$opt{'colspan'}.'"' : '';
%init>