X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Felements%2Fselect-agent.html;h=2bd0095dabdbbca8308520ded79fdc9e108f58fb;hp=aa480a54b08504aec11b55cac2b34806dfa83fce;hb=37e92c220a54636ebc7900cd59ec6ce56790ede8;hpb=1a033848671cad2cbe7687b37fc718b3b2a68b83 diff --git a/httemplate/elements/select-agent.html b/httemplate/elements/select-agent.html index aa480a54b..2bd0095da 100644 --- a/httemplate/elements/select-agent.html +++ b/httemplate/elements/select-agent.html @@ -1,16 +1,31 @@ -<% - my( $agentnum, %opt ) = @_; +<& /elements/select-table.html, + 'table' => 'agent', + 'name_col' => 'agent', + 'value' => $agentnum || '', + 'agent_virt' => 1, + 'empty_label' => $empty_label, + 'hashref' => { 'disabled' => '' }, + 'order_by' => ' ORDER BY agent', + 'disable_empty' => $disable_empty, + %opt, +&> +<%init> - my %select_opt = (); - $select_opt{'records'} = $opt{'agents'} - if $opt{'agents'}; +my %opt = @_; +my $agentnum = $opt{'curr_value'} || $opt{'value'}; -%><%= include( '/elements/select-table.html', - 'table' => 'agent', - 'name_col' => 'agent', - 'value' => $agentnum, - 'empty_label' => 'all', - 'hashref' => { 'disabled' => '' }, - %select_opt, - ) -%> +$opt{'records'} = delete $opt{'agents'} + if $opt{'agents'}; + +my $curuser = $FS::CurrentUser::CurrentUser; +my $empty_label = $opt{'empty_label'} ? $opt{'empty_label'} : 'all'; +my $disable_empty = 0; +if ( $opt{'agent_null_right'} ) { + if ( $curuser->access_right($opt{'agent_null_right'}) ) { + $disable_empty = 0; + } else { + $disable_empty = 1; + } +} + +