5 include( '/elements/tr-select-agent.html',
7 #recommended to keep things "sticky" on errors
8 'curr_value' => $curr_value,
14 'label' => 'Agent for this thing',
15 'empty_label' => 'Select agent', #override default
18 #set to 'None' or something to override default of showing all agents
19 #for employees w/ 'View customers of all agents' right
20 viewall_right => 'None',
26 % $required = '<FONT COLOR="red">*</FONT>' if $opt{'required'};
28 % if ( scalar(@agents) == 1 || $opt{'fixed'} ) {
30 <INPUT TYPE = "hidden"
31 NAME = "<% $opt{'field'} || 'agentnum' %>"
32 ID = "<% $opt{'field'} || 'agentnum' %>"
33 VALUE = "<% $agents[0]->agentnum %>"
36 % if ( scalar(@agents) != 1 ) {
38 <TH ALIGN="right"><% $required %> <% $opt{'label'} || emt('Agent') %></TD>
39 <TD BGCOLOR="#dddddd" <% $colspan %>>
40 % my $agent = qsearchs('agent', { 'agentnum' => $agentnum });
41 <% $agent ? $agent->agent : '(all)' |h %>
45 % } else { # YUCK. empty row so we don't throw g_row in edit.html off :/
53 <TH ALIGN="right"><% $required %> <% $opt{'label'} || emt('Agent') %></TD>
55 <& /elements/select-agent.html,
56 'curr_value' => $agentnum,
68 my $agentnum = $opt{'curr_value'} || $opt{'value'};
74 : $FS::CurrentUser::CurrentUser->agents(
75 'viewall_right' => $opt{'viewall_right'},
78 my $colspan = $opt{'colspan'} ? 'COLSPAN="'.$opt{'colspan'}.'"' : '';