X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Fselect-agent.html;h=897c98248da65be72bd7d026bd90b33245884806;hb=0b1c458214a23b0ae3d8b8926989341e69468ff3;hp=009cc6e0638d88cfc05c83ebdd6683d2191b0a51;hpb=e47e9758f480c664bfc3917d798cd69c7d354999;p=freeside.git diff --git a/httemplate/elements/select-agent.html b/httemplate/elements/select-agent.html index 009cc6e06..897c98248 100644 --- a/httemplate/elements/select-agent.html +++ b/httemplate/elements/select-agent.html @@ -1,18 +1,31 @@ -<% - my( $agentnum, %opt ) = @_; - - $opt{'records'} = delete $opt{'agents'} - if $opt{'agents'}; - -%><%= include( '/elements/select-table.html', - 'table' => 'agent', - 'name_col' => 'agent', - 'value' => $agentnum, - 'empty_label' => 'all', - 'hashref' => { 'disabled' => '' }, - 'extra_sql' => ' AND '. - $FS::CurrentUser::CurrentUser->agentnums_sql. - ' ORDER BY agent', +<% include( '/elements/select-table.html', + 'table' => 'agent', + 'name_col' => 'agent', + 'value' => $agentnum || '', + 'agent_virt' => 1, + 'empty_label' => 'all', + 'hashref' => { 'disabled' => '' }, + 'order_by' => ' ORDER BY agent', + 'disable_empty' => $disable_empty, %opt, ) %> +<%init> + +my %opt = @_; +my $agentnum = $opt{'curr_value'} || $opt{'value'}; + +$opt{'records'} = delete $opt{'agents'} + if $opt{'agents'}; + +my $curuser = $FS::CurrentUser::CurrentUser; +my $disable_empty = 0; +if ( $opt{'agent_null_right'} ) { + if ( $curuser->access_right($opt{'agent_null_right'}) ) { + $disable_empty = 0; + } else { + $disable_empty = 1; + } +} + +