internationalization/localization, RT12515
[freeside.git] / httemplate / elements / tr-select-agent.html
1 <%doc>
2
3 Example:
4
5   include( '/elements/tr-select-agent.html',
6
7     #recommended to keep things "sticky" on errors
8     'curr_value'    => $curr_value,
9
10     ##
11     # optional
12     ##
13
14     'label'         => 'Agent for this thing',
15     'empty_label'   => 'Select agent', #override default 
16     'disable_empty' => 1,
17
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',
21
22   );
23
24 </%doc>
25 % if ( scalar(@agents) == 1 ) { 
26
27   <INPUT TYPE="hidden" NAME="<% $opt{'field'} || 'agentnum' %>" VALUE="<% $agents[0]->agentnum %>">
28
29 %# YUCK.  empty row so we don't throw g_row in edit.html off :/
30   <TR>
31   </TR>
32 % } else { 
33
34   <TR>
35     <TD ALIGN="right"><% $opt{'label'} || emt('Agent') %></TD>
36     <TD <% $colspan %>>
37       <& /elements/select-agent.html,
38                      'curr_value' => $agentnum,
39                      'agents'     => \@agents,
40                      %opt,
41       &>
42     </TD>
43   </TR>
44
45 % } 
46
47 <%init>
48
49 my %opt = @_;
50 my $agentnum = $opt{'curr_value'} || $opt{'value'};
51
52 my @agents =
53   $opt{'agents'}
54     ? @{ $opt{'agents'} }
55     : $FS::CurrentUser::CurrentUser->agents(
56         'viewall_right' => $opt{'viewall_right'},
57       );
58
59 my $colspan = $opt{'colspan'} ? 'COLSPAN="'.$opt{'colspan'}.'"' : '';
60
61 </%init>