summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/UI/Web/small_custview.pm6
-rw-r--r--FS/FS/access_user.pm16
2 files changed, 21 insertions, 1 deletions
diff --git a/FS/FS/UI/Web/small_custview.pm b/FS/FS/UI/Web/small_custview.pm
index a1173f7da..e82e3326f 100644
--- a/FS/FS/UI/Web/small_custview.pm
+++ b/FS/FS/UI/Web/small_custview.pm
@@ -95,8 +95,12 @@ sub small_custview {
$html = qq!<A HREF="$url?! . $cust_main->custnum . '">'
if $url;
+ if ( $FS::CurrentUser::CurrentUser->num_agents ) {
+ $html .= encode_entities($cust_main->agent->agent). ' ';
+ }
+
$html .= 'Customer #<B>'. $cust_main->display_custnum.
- ': '. encode_entities($cust_main->name). '</B></A>';
+ '</B>: <B>'. encode_entities($cust_main->name). '</B></A>'.
' - <B><FONT COLOR="#'. $cust_main->statuscolor. '">'.
$cust_main->status_label. '</FONT></B>';
diff --git a/FS/FS/access_user.pm b/FS/FS/access_user.pm
index 68d2deaba..a3f55bc76 100644
--- a/FS/FS/access_user.pm
+++ b/FS/FS/access_user.pm
@@ -283,6 +283,22 @@ sub report_sales {
Returns links to the the groups this user is a part of, as FS::access_usergroup
objects (see L<FS::access_usergroup>).
+=item num_agents
+
+Returns the number of agents this user can view (via group membership).
+
+=cut
+
+sub num_agents {
+ my $self = shift;
+ $self->scalar_sql(
+ 'SELECT COUNT(DISTINCT agentnum) FROM access_usergroup
+ JOIN access_groupagent USING ( groupnum )
+ WHERE usernum = ?',
+ $self->usernum,
+ );
+}
+
=item agentnums
Returns a list of agentnums this user can view (via group membership).