add package def option to show $0 recurring on invoices, RT#9777
[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"
28          NAME  = "<% $opt{'field'} || 'agentnum' %>"
29          ID    = "<% $opt{'field'} || 'agentnum' %>"
30          VALUE = "<% $agents[0]->agentnum %>"
31   >
32
33 %# YUCK.  empty row so we don't throw g_row in edit.html off :/
34   <TR>
35   </TR>
36 % } else { 
37
38   <TR>
39     <TD ALIGN="right"><% $opt{'label'} || emt('Agent') %></TD>
40     <TD <% $colspan %>>
41       <& /elements/select-agent.html,
42                      'curr_value' => $agentnum,
43                      'agents'     => \@agents,
44                      %opt,
45       &>
46     </TD>
47   </TR>
48
49 % } 
50
51 <%init>
52
53 my %opt = @_;
54 my $agentnum = $opt{'curr_value'} || $opt{'value'};
55
56 my @agents =
57   $opt{'agents'}
58     ? @{ $opt{'agents'} }
59     : $FS::CurrentUser::CurrentUser->agents(
60         'viewall_right' => $opt{'viewall_right'},
61       );
62
63 my $colspan = $opt{'colspan'} ? 'COLSPAN="'.$opt{'colspan'}.'"' : '';
64
65 </%init>