This commit was generated by cvs2svn to compensate for changes in r6252,
[freeside.git] / httemplate / elements / tr-select-agent.html
1 % if ( scalar(@agents) == 1 ) { 
2
3   <INPUT TYPE="hidden" NAME="<% $opt{'field'} || 'agentnum' %>" VALUE="<% $agents[0]->agentnum %>">
4
5 % } else { 
6
7   <TR>
8     <TD ALIGN="right"><% $opt{'label'} || 'Agent' %></TD>
9     <TD>
10       <% include( '/elements/select-agent.html',
11                      'curr_value' => $agentnum,
12                      'agents'     => \@agents,
13                      %opt,
14                  )
15       %>
16     </TD>
17   </TR>
18
19 % } 
20
21 <%init>
22
23 my %opt = @_;
24 my $agentnum = $opt{'curr_value'} || $opt{'value'};
25
26 my @agents;
27 if ( $opt{'agents'} ) {
28   #@agents = @{ $opt{'agents'} };
29   #here is the agent virtualization
30   my $agentnums_href = $FS::CurrentUser::CurrentUser->agentnums_href;
31   @agents = grep $agentnums_href->{$_->agentnum}, @{ $opt{'agents'} };
32   delete $opt{'agents'};
33 } else {
34   @agents = $FS::CurrentUser::CurrentUser->agents;
35 }
36
37 </%init>