X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Ftr-select-agent.html;h=fcfa9f300074bb9ec820c34066d6a0d28cf5b3c5;hb=7a7bcda9d75c951df9c911ce60d5b0551765daf2;hp=83c8d1758aff37d621f6ce7fa14aea9845323f82;hpb=c0e8da2f1e89729efa1032241e4239765a296514;p=freeside.git diff --git a/httemplate/elements/tr-select-agent.html b/httemplate/elements/tr-select-agent.html index 83c8d1758..fcfa9f300 100644 --- a/httemplate/elements/tr-select-agent.html +++ b/httemplate/elements/tr-select-agent.html @@ -1,36 +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'} }; - } else { - @agents = qsearch( { - 'table' => 'agent', - 'hashref' => { disabled=>'' }, - 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, - }); - } + -%> - -<% 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; + +