summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2014-06-23 15:39:34 -0700
committerIvan Kohler <ivan@freeside.biz>2014-06-23 15:39:34 -0700
commit7e2ab49f83c119aeeaf7142e369b93bef9fdafd0 (patch)
tree9d9690642b6e9ab2d2d4a2d9af4bce8e1bd0d965
parent3cd31aafeee3516bbea80e4b426dd1f3282bacf6 (diff)
option to disable customer/package counts on agent browser, RT#29748
-rw-r--r--FS/FS/Conf.pm7
-rw-r--r--FS/FS/agent.pm22
-rw-r--r--FS/FS/cust_pkg.pm7
-rwxr-xr-xhttemplate/browse/agent.cgi304
4 files changed, 153 insertions, 187 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 9404c0691..f4027374a 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -5755,6 +5755,13 @@ and customer address. Include units.',
'type' => 'checkbox',
},
+ {
+ 'key' => 'agent-disable_counts',
+ 'section' => 'UI',
+ 'description' => 'On the agent browse page, disable the customer and package counts. Typically used for very large databases when this page takes too long to render.',
+ 'type' => 'checkbox',
+ },
+
{ key => "apacheroot", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
{ key => "apachemachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
{ key => "apachemachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
diff --git a/FS/FS/agent.pm b/FS/FS/agent.pm
index 721749956..2c06a0576 100644
--- a/FS/FS/agent.pm
+++ b/FS/FS/agent.pm
@@ -618,6 +618,28 @@ sub num_cancel_cust_pkg {
shift->num_pkg_sql(FS::cust_pkg->cancel_sql);
}
+=item num_on_hold_cust_pkg
+
+Returns the number of inactive customer packages (one-time packages otherwise
+unsuspended/uncancelled) for this agent.
+
+=cut
+
+sub num_on_hold_cust_pkg {
+ shift->num_pkg_sql(FS::cust_pkg->on_hold_sql);
+}
+
+=item num_not_yet_billed_cust_pkg
+
+Returns the number of inactive customer packages (one-time packages otherwise
+unsuspended/uncancelled) for this agent.
+
+=cut
+
+sub num_not_yet_billed_cust_pkg {
+ shift->num_pkg_sql(FS::cust_pkg->not_yet_billed_sql);
+}
+
=item generate_reg_codes NUM PKGPART_ARRAYREF
Generates the specified number of registration codes, allowing purchase of the
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index bf423cd77..af1bd835e 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -3163,7 +3163,7 @@ Class method that returns the list of possible status strings for packages
tie my %statuscolor, 'Tie::IxHash',
'on hold' => '7E0079', #purple!
'not yet billed' => '009999', #teal? cyan?
- 'one-time charge' => '000000',
+ 'one-time charge' => '0000CC', #blue #'000000',
'active' => '00CC00',
'suspended' => 'FF9900',
'cancelled' => 'FF0000',
@@ -3176,6 +3176,11 @@ sub statuses {
keys %statuscolor;
}
+sub statuscolors {
+ #my $self = shift;
+ \%statuscolor;
+}
+
=item statuscolor
Returns a hex triplet color string for this package's status.
diff --git a/httemplate/browse/agent.cgi b/httemplate/browse/agent.cgi
index 25524323d..3fe68c15d 100755
--- a/httemplate/browse/agent.cgi
+++ b/httemplate/browse/agent.cgi
@@ -66,10 +66,16 @@ full offerings (via their type).<BR><BR>
<TR>
+% ##
+% # agentnum
+% ##
<TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
<A HREF="<%$p%>edit/agent.cgi?<% $agent->agentnum %>"><% $agent->agentnum %></A>
</TD>
+% ##
+% # disabled
+% ##
% if ( ! $cgi->param('showdisabled') ) {
<TD CLASS="grid" BGCOLOR="<% $bgcolor %>" ALIGN="center">
<% $agent->disabled ? '<FONT COLOR="#FF0000"><B>DISABLED</B></FONT>'
@@ -78,14 +84,23 @@ full offerings (via their type).<BR><BR>
</TD>
% }
+% ##
+% # agent
+% ##
<TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
<A HREF="<%$p%>edit/agent.cgi?<% $agent->agentnum %>"><% $agent->agent %></A>
</TD>
+% ##
+% # type
+% ##
<TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
<A HREF="<%$p%>edit/agent_type.cgi?<% $agent->typenum %>"><% $agent->agent_type->atype %></A>
</TD>
+% ##
+% # master customer
+% ##
<TD CLASS="inv" BGCOLOR="<% $bgcolor %>">
% if ( $agent->agent_custnum ) {
<& /elements/small_custview.html,
@@ -97,6 +112,10 @@ full offerings (via their type).<BR><BR>
% }
</TD>
+% ##
+% # commissions
+% ##
+
<TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
<TABLE>
@@ -124,6 +143,9 @@ full offerings (via their type).<BR><BR>
</TD>
+% ##
+% # access groups
+% ##
<TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
% foreach my $access_group (
% map $_->access_group,
@@ -133,236 +155,127 @@ full offerings (via their type).<BR><BR>
% }
</TD>
+% ##
+% # invoice template
+% ##
<TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
<% $agent->invoice_template || '(Default)' %>
</TD>
+% ##
+% # customers
+% ##
+
<TD CLASS="inv" BGCOLOR="<% $bgcolor %>" VALIGN="bottom">
<TABLE CLASS="inv" CELLSPACING=0 CELLPADDING=0>
- <TR>
- <TH ALIGN="right" WIDTH="40%">
- <FONT COLOR="#7e0079">
- <% my $num_prospect = $agent->num_prospect_cust_main %>&nbsp;
- </FONT>
- </TH>
-
- <TD>
-% if ( $num_prospect ) {
-
- <A HREF="<% $cust_main_link %>&prospect=1">
-% }
-prospects
-% if ($num_prospect ) {
-</A>
-% }
-
- <TD>
- </TR>
-
- <TR>
- <TH ALIGN="right" WIDTH="40%">
- <FONT COLOR="#0000CC">
- <% my $num_inactive = $agent->num_inactive_cust_main %>&nbsp;
- </FONT>
- </TH>
-
- <TD>
-% if ( $num_inactive ) {
-
- <A HREF="<% $cust_main_link %>&inactive=1">
-% }
-inactive
-% if ( $num_inactive ) {
-</A>
-% }
-
- </TD>
- </TR>
-
- <TR>
- <TH ALIGN="right" WIDTH="40%">
- <FONT COLOR="#009999">
- <% my $num_ordered = $agent->num_ordered_cust_main %>&nbsp;
- </FONT>
- </TH>
-
- <TD>
-% if ( $num_ordered ) {
-
- <A HREF="<% $cust_main_link %>&ordered=1">
-% }
-ordered
-% if ($num_ordered ) {
-</A>
-% }
-
- <TD>
- </TR>
-
- <TR>
- <TH ALIGN="right" WIDTH="40%">
- <FONT COLOR="#00CC00">
- <% my $num_active = $agent->num_active_cust_main %>&nbsp;
- </FONT>
- </TH>
-
- <TD>
-% if ( $num_active ) {
+% my @cust_status =
+% qw( prospect inactive ordered active suspended cancelled );
+% my %method = ( 'suspended' => 'susp',
+% 'cancelled' => 'cancel'
+% );
+% my %PL = ( 'prospect' => 'prospects', );
+% my %link = ( 'cancelled' => 'showcancelledcustomers=1&cancelled' );
+% my $statuscolor = FS::cust_main->statuscolors;
+%
+% foreach my $status ( @cust_status ) {
+% my $meth = exists($method{$status}) ? $method{$status} : $status;
+% $meth = 'num_'. $meth. '_cust_main';
+% my $link = exists($link{$status}) ? $link{$status} : $status;
- <A HREF="<% $cust_main_link %>&active=1">
-% }
-active
-% if ( $num_active ) {
+ <TR>
+% my $num = 0;
+% unless ( $disable_counts ) {
+ <TH ALIGN="right" WIDTH="40%">
+ <FONT COLOR="#<% $statuscolor->{$status} %>">
+ <% $num = $agent->$meth() %>&nbsp;
+ </FONT>
+ </TH>
+% }
+ <TD>
+% if ( $num || $disable_counts ) {
+%
+
+ <A HREF="<% $cust_main_link. "&$link=1" %>">
+% }
+<% exists($PL{$status}) ? $PL{$status} : $status %>
+% if ($num || $disable_counts ) {
</A>
% }
- </TD>
- </TR>
-
- <TR>
- <TH ALIGN="right" WIDTH="40%">
- <FONT COLOR="#FF9900">
- <% my $num_susp = $agent->num_susp_cust_main %>&nbsp;
- </FONT>
- </TH>
-
<TD>
-% if ( $num_susp ) {
-
- <A HREF="<% $cust_main_link %>&suspended=1">
-% }
-suspended
-% if ( $num_susp ) {
-</A>
-% }
-
- </TD>
</TR>
- <TR>
- <TH ALIGN="right" WIDTH="40%">
- <FONT COLOR="#FF0000">
- <% my $num_cancel = $agent->num_cancel_cust_main %>&nbsp;
- </FONT>
- </TH>
-
- <TD>
-% if ( $num_cancel ) {
-
- <A HREF="<% $cust_main_link %>&showcancelledcustomers=1&cancelled=1">
-% }
-cancelled
-% if ( $num_cancel ) {
-</A>
-% }
-
- </TD>
- </TR>
+% }
</TABLE>
</TD>
+% ##
+% # customer packages
+% ##
+
<TD CLASS="inv" BGCOLOR="<% $bgcolor %>" VALIGN="bottom">
<TABLE CLASS="inv" CELLSPACING=0 CELLPADDING=0>
- <TR>
- <TH ALIGN="right" WIDTH="40%">
- <FONT COLOR="#0000CC">
- <% my $num_inactive_pkg = $agent->num_inactive_cust_pkg %>&nbsp;
- </FONT>
- </TH>
-
- <TD>
-% if ( $num_inactive_pkg ) {
-
- <A HREF="<% $cust_pkg_link %>&magic=inactive">
-% }
-inactive
-% if ( $num_inactive_pkg ) {
-</A>
-% }
-
- </TD>
- </TR>
-
- <!--ordered-->
- <TR>
- <TD>&nbsp;</TD>
- </TR>
-
- <TR>
- <TH ALIGN="right" WIDTH="40%">
- <FONT COLOR="#00CC00">
- <% my $num_active_pkg = $agent->num_active_cust_pkg %>&nbsp;
- </FONT>
- </TH>
-
- <TD>
-% if ( $num_active_pkg ) {
-
- <A HREF="<% $cust_pkg_link %>&magic=active">
-% }
-active
-% if ( $num_active_pkg ) {
-</A>
-% }
-
- </TD>
- </TR>
+% #my @pkg_status = FS::cust_pkg->statuses;
+% my @pkg_status = ( 'on hold', 'one-time charge', 'not yet billed',
+% qw( active suspended cancelled ) );
+% my %method = ( 'one-time charge' => 'inactive',
+% 'suspended' => 'susp',
+% 'cancelled' => 'cancel',
+% );
+% my $statuscolor = FS::cust_pkg->statuscolors;
+%
+% foreach my $status ( @pkg_status ) {
+% my $magic = exists($method{$status}) ? $method{$status} : $status;
+% $magic =~ s/ /_/g;
+% my $meth = 'num_'. $magic. '_cust_pkg';
+% ( my $label = $status ) =~ s/ /&nbsp;/g;
- <TR>
- <TH ALIGN="right" WIDTH="40%">
- <FONT COLOR="#FF9900">
- <% my $num_susp_pkg = $agent->num_susp_cust_pkg %>&nbsp;
- </FONT>
+ <TR>
+% my $num = 0;
+% unless ( $disable_counts ) {
+ <TH ALIGN="right" WIDTH="40%">
+ <FONT COLOR="#<% $statuscolor->{$status} %>">
+ <% $num = $agent->$meth() %>&nbsp;
+ </FONT>
+ </TH>
+% }
- </TH>
<TD>
-% if ( $num_susp_pkg ) {
+% if ( $num || $disable_counts ) {
- <A HREF="<% $cust_pkg_link %>&magic=suspended">
+ <A HREF="<% $cust_pkg_link %>&magic=<% $magic %>">
% }
-suspended
-% if ( $num_susp_pkg ) {
+<% $label %>
+% if ( $num || $disable_counts ) {
</A>
% }
</TD>
</TR>
-
- <TR>
- <TH ALIGN="right" WIDTH="40%">
- <FONT COLOR="#FF0000">
- <% my $num_cancel_pkg = $agent->num_cancel_cust_pkg %>&nbsp;
- </FONT>
- </TH>
-
- <TD>
-% if ( $num_cancel_pkg ) {
- <A HREF="<% $cust_pkg_link %>&magic=cancelled">
-% }
-cancelled
-% if ( $num_cancel_pkg ) {
-</A>
-% }
-
- </TD>
- </TR>
+% }
</TABLE>
</TD>
+% ##
+% # reports
+% ##
<TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
<A HREF="<% $p %>graph/report_cust_pkg.html?agentnum=<% $agent->agentnum %>">Package&nbsp;Churn</A>
<BR><A HREF="<% $p %>search/report_cust_pay.html?agentnum=<% $agent->agentnum %>">Payments</A>
<BR><A HREF="<% $p %>search/report_cust_credit.html?agentnum=<% $agent->agentnum %>">Credits</A>
<BR><A HREF="<% $p %>search/report_receivables.cgi?agentnum=<% $agent->agentnum %>">A/R&nbsp;Aging</A>
<!--<BR><A HREF="<% $p %>search/money_time.cgi?agentnum=<% $agent->agentnum %>">Sales/Credits/Receipts</A>-->
-
</TD>
+% ##
+% # registration codes
+% ##
+
<TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
<% my $num_reg_code = $agent->num_reg_code %>
% if ( $num_reg_code ) {
@@ -377,6 +290,10 @@ Unused
<BR><A HREF="<%$p%>edit/reg_code.cgi?agentnum=<% $agent->agentnum %>">Generate codes</A>
</TD>
+% ##
+% # prepaid cards
+% ##
+
<TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
<% my $num_prepay_credit = $agent->num_prepay_credit %>
% if ( $num_prepay_credit ) {
@@ -391,6 +308,9 @@ Unused
<BR><A HREF="<%$p%>edit/prepay_credit.cgi?agentnum=<% $agent->agentnum %>">Generate cards</A>
</TD>
+% ##
+% # ticketing
+% ##
% if ( $conf->config('ticket_system') ) {
<TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
% if ( $agent->ticketing_queueid ) {
@@ -401,12 +321,19 @@ Unused
</TD>
% }
+% ##
+% # currencies
+% ##
% if ( $conf->config('currencies') ) {
<TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
<% join('<BR>', sort keys %{ $agent->agent_currency_hashref } ) %>
</TD>
% }
+% ##
+% # payment gateway overrides
+% ##
+
<TD CLASS="inv" BGCOLOR="<% $bgcolor %>">
<TABLE CLASS="inv" CELLSPACING=0 CELLPADDING=0>
% foreach my $override (
@@ -433,6 +360,10 @@ Unused
</TABLE>
</TD>
+% ##
+% # configuration overrides
+% ##
+
<TD CLASS="inv" BGCOLOR="<% $bgcolor %>">
<TABLE CLASS="inv" CELLSPACING=0 CELLPADDING=0>
% foreach my $override (
@@ -482,5 +413,6 @@ if ( $cgi->param('showdisabled')
}
my $conf = new FS::Conf;
+my $disable_counts = $conf->exists('agent-disable_counts');
</%init>