X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Fcust_main%2Fmisc.html;h=2cfe0263f8c2d9333d16521c0c79536dd5d84743;hb=7b125e587a4d1ee0aca692e23ea7897f671855ae;hp=d383e4aa4a25b0897d4314ac1ad8e85c87cd09ee;hpb=5fc27d11b1f5cf689cf83e35c8fc6bfffd4ffe8e;p=freeside.git
diff --git a/httemplate/view/cust_main/misc.html b/httemplate/view/cust_main/misc.html
index d383e4aa4..2cfe0263f 100644
--- a/httemplate/view/cust_main/misc.html
+++ b/httemplate/view/cust_main/misc.html
@@ -10,9 +10,12 @@
<% ucfirst($cust_main->status) %> |
-%unless ( scalar(@agentnums) == 1
-% && !$curuser->access_right('View customers of all agents') ) {
-% my $agent = qsearchs('agent',{ 'agentnum' => $cust_main->agentnum } );
+%my $agent;
+%if ( $num_agents == 1 ) {
+% my @agents = qsearchs( 'agent', {} );
+% $agent = $agents[0];
+%} else {
+% $agent = qsearchs('agent',{ 'agentnum' => $cust_main->agentnum } );
Agent |
<% $agent->agentnum %>: <% $agent->agent %> |
@@ -116,8 +119,8 @@ my( $cust_main ) = @_;
my $conf = new FS::Conf;
my $date_format = ($conf->config('date_format') || "%m/%d/%Y");
-my $curuser = $FS::CurrentUser::CurrentUser;
-
-my @agentnums = $curuser->agentnums;
+my $sth = dbh->prepare('SELECT COUNT(*) FROM agent') or die dbh->errstr;
+$sth->execute or die $sth->errstr;
+my $num_agents = $sth->fetchrow_arrayref->[0];
%init>