X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=httemplate%2Felements%2Ftr-select-agent.html;h=37b1c1e88658ca101d67fc8fd96f760cd05fb9e7;hb=9b55529944da1d3b8dd09d7148d888493960a5ea;hp=2227262b6cc389a0d53382a55ed3e8579be28da7;hpb=386ec52836abbe32ce2fbf575e851a75f6e112f8;p=freeside.git diff --git a/httemplate/elements/tr-select-agent.html b/httemplate/elements/tr-select-agent.html index 2227262b6..37b1c1e88 100644 --- a/httemplate/elements/tr-select-agent.html +++ b/httemplate/elements/tr-select-agent.html @@ -1,29 +1,34 @@ -<% - my( $agentnum, %opt ) = @_; +% +% my( $agentnum, %opt ) = @_; +% +% 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 ) { - my @agents; - if ( $opt{'agents'} ) { - @agents = @{ $opt{'agents'} }; - } else { - @agents = qsearch( 'agent', { disabled=>'' } ); - } -%> + +% } else { -<% if ( scalar(@agents) == 1 ) { %> - - - -<% } else { %> - <%= $opt{'label'} || 'Agent: ' %> + <% $opt{'label'} || 'Agent' %> - <%= include( '/elements/select-agent.html', $agentnum, + <% include( '/elements/select-agent.html', $agentnum, 'agents' => \@agents, + %opt, ) %> +% } -<% } %>