X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Ftr-select-agent.html;h=321bd6b32de3e09fe8b7da5e13b2d0b70a3b204f;hb=7516e3da0f17eeecba27219ef96a8b5f46af2083;hp=fcfa9f300074bb9ec820c34066d6a0d28cf5b3c5;hpb=40a7b3dc653e099f7bd0bd762b649b04c4432db2;p=freeside.git
diff --git a/httemplate/elements/tr-select-agent.html b/httemplate/elements/tr-select-agent.html
index fcfa9f300..321bd6b32 100644
--- a/httemplate/elements/tr-select-agent.html
+++ b/httemplate/elements/tr-select-agent.html
@@ -1,21 +1,59 @@
-% if ( scalar(@agents) == 1 ) {
+<%doc>
-
+Example:
-%# YUCK. empty row so we don't throw g_row in edit.html off :/
-
-
+ include( '/elements/tr-select-agent.html',
+
+ #recommended to keep things "sticky" on errors
+ 'curr_value' => $curr_value,
+
+ ##
+ # optional
+ ##
+
+ 'label' => 'Agent for this thing',
+ 'empty_label' => 'Select agent', #override default
+ 'disable_empty' => 1,
+
+ #set to 'None' or something to override default of showing all agents
+ #for employees w/ 'View customers of all agents' right
+ viewall_right => 'None',
+
+ );
+
+%doc>
+% if ( scalar(@agents) == 1 || $opt{'fixed'} ) {
+
+
+
+% if ( scalar(@agents) != 1 ) {
+
+ <% $opt{'label'} || emt('Agent') %> |
+ >
+% my $agent = qsearchs('agent', { 'agentnum' => $agentnum });
+ <% $agent ? $agent->agent : '(all)' |h %>
+ |
+
+
+% } else { # YUCK. empty row so we don't throw g_row in edit.html off :/
+
+
+% }
+%
% } else {
- <% $opt{'label'} || 'Agent' %> |
-
- <% include( '/elements/select-agent.html',
+ | <% $opt{'label'} || emt('Agent') %> |
+ >
+ <& /elements/select-agent.html,
'curr_value' => $agentnum,
'agents' => \@agents,
%opt,
- )
- %>
+ &>
|
@@ -26,8 +64,13 @@
my %opt = @_;
my $agentnum = $opt{'curr_value'} || $opt{'value'};
-my @agents = $opt{'agents'}
- ? @{ $opt{'agents'} }
- : $FS::CurrentUser::CurrentUser->agents;
+my @agents =
+ $opt{'agents'}
+ ? @{ $opt{'agents'} }
+ : $FS::CurrentUser::CurrentUser->agents(
+ 'viewall_right' => $opt{'viewall_right'},
+ );
+
+my $colspan = $opt{'colspan'} ? 'COLSPAN="'.$opt{'colspan'}.'"' : '';
%init>