X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Ftr-select-agent.html;h=fcfa9f300074bb9ec820c34066d6a0d28cf5b3c5;hb=196adec5da84e3932aa6b2654b6f1532d833616b;hp=6158f6f478570b812ac0a5080a299b3cee323c0a;hpb=e47e9758f480c664bfc3917d798cd69c7d354999;p=freeside.git diff --git a/httemplate/elements/tr-select-agent.html b/httemplate/elements/tr-select-agent.html index 6158f6f47..fcfa9f300 100644 --- a/httemplate/elements/tr-select-agent.html +++ b/httemplate/elements/tr-select-agent.html @@ -1,34 +1,33 @@ -<% - my( $agentnum, %opt ) = @_; +% if ( scalar(@agents) == 1 ) { - my @agents; - if ( $opt{'agents'} ) { - #@agents = @{ $opt{'agents'} }; - #here is the agent virtualization - my $agentnums_href = $FS::CurrentUser::CurrentUser->agentnums_href; - @agents = grep $agentnums_href->{$_->agentnum}, @{ $opt{'agents'} }; - delete $opt{'agents'}; - } else { - @agents = $FS::CurrentUser::CurrentUser->agents; - } + -%> - -<% if ( scalar(@agents) == 1 ) { %> - - - -<% } else { %> +%# YUCK. empty row so we don't throw g_row in edit.html off :/ + + +% } else { - <%= $opt{'label'} || 'Agent' %> + <% $opt{'label'} || 'Agent' %> - <%= include( '/elements/select-agent.html', $agentnum, - 'agents' => \@agents, + <% include( '/elements/select-agent.html', + 'curr_value' => $agentnum, + 'agents' => \@agents, %opt, ) %> -<% } %> +% } + +<%init> + +my %opt = @_; +my $agentnum = $opt{'curr_value'} || $opt{'value'}; + +my @agents = $opt{'agents'} + ? @{ $opt{'agents'} } + : $FS::CurrentUser::CurrentUser->agents; + +