From 259921ee5e89a68fc79b2a358643c558ebb4fdaa Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 17 Jun 2010 01:17:45 +0000 Subject: [PATCH] better agent virt --- httemplate/view/cust_main/misc.html | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/httemplate/view/cust_main/misc.html b/httemplate/view/cust_main/misc.html index 2cfe0263f..b98e9dc3e 100644 --- a/httemplate/view/cust_main/misc.html +++ b/httemplate/view/cust_main/misc.html @@ -10,12 +10,8 @@ <% ucfirst($cust_main->status) %> -%my $agent; -%if ( $num_agents == 1 ) { -% my @agents = qsearchs( 'agent', {} ); -% $agent = $agents[0]; -%} else { -% $agent = qsearchs('agent',{ 'agentnum' => $cust_main->agentnum } ); +%unless ( scalar(@agentnums) == 1 ) { +% my $agent = qsearchs('agent',{ 'agentnum' => $cust_main->agentnum } ); Agent <% $agent->agentnum %>: <% $agent->agent %> @@ -119,8 +115,6 @@ my( $cust_main ) = @_; my $conf = new FS::Conf; my $date_format = ($conf->config('date_format') || "%m/%d/%Y"); -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]; +my @agentnums = $FS::CurrentUser::CurrentUser->agentnums; -- 2.11.0