From: Ivan Kohler Date: Mon, 23 Jun 2014 22:39:42 +0000 (-0700) Subject: option to disable customer/package counts on agent browser, RT#29748 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=682b3ae3a8f6a3c500ebb770c797df19d62ea305 option to disable customer/package counts on agent browser, RT#29748 --- diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 941417f6c..b38b0d7cc 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -5741,6 +5741,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 => "DEPRECATED", type => "text" }, { key => "apachemachine", section => "deprecated", description => "DEPRECATED", type => "text" }, { key => "apachemachines", section => "deprecated", description => "DEPRECATED", type => "text" }, diff --git a/FS/FS/agent.pm b/FS/FS/agent.pm index 1dd6796cb..e7fb3fba2 100644 --- a/FS/FS/agent.pm +++ b/FS/FS/agent.pm @@ -609,6 +609,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 4a98b7329..17505ddfc 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -3182,7 +3182,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', @@ -3195,6 +3195,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 8da37a2dc..ae8c61897 100755 --- a/httemplate/browse/agent.cgi +++ b/httemplate/browse/agent.cgi @@ -62,10 +62,16 @@ full offerings (via their type).

+% ## +% # agentnum +% ## <% $agent->agentnum %> +% ## +% # disabled +% ## % if ( ! $cgi->param('showdisabled') ) { <% $agent->disabled ? 'DISABLED' @@ -74,14 +80,23 @@ full offerings (via their type).

% } +% ## +% # agent +% ## <% $agent->agent %> +% ## +% # type +% ## <% $agent->agent_type->atype %> +% ## +% # master customer +% ## % if ( $agent->agent_custnum ) { <& /elements/small_custview.html, @@ -93,6 +108,10 @@ full offerings (via their type).

% } +% ## +% # commissions +% ## + @@ -120,6 +139,9 @@ full offerings (via their type).

+% ## +% # access groups +% ## +% ## +% # invoice template +% ## +% ## +% # customers +% ## + +% ## +% # customer packages +% ## + +% ## +% # reports +% ## +% ## +% # registration codes +% ## + +% ## +% # prepaid cards +% ## + -% if ( $conf->config('ticket_system') ) { - +% ## +% # ticketing +% ## +% if ( $conf->config('ticket_system') ) { % } +% ## +% # payment gateway overrides +% ## +% ## +% # configuration overrides +% ## +
% foreach my $access_group ( % map $_->access_group, @@ -129,236 +151,127 @@ full offerings (via their type).

% }
<% $agent->invoice_template || '(Default)' %> - - - - - - - - - - - - - - - - - - - - +% my $num = 0; +% unless ( $disable_counts ) { + +% } + - - - - - - - - - - +% }
- - <% my $num_prospect = $agent->num_prospect_cust_main %>  - - -% if ( $num_prospect ) { - - -% } -prospects -% if ($num_prospect ) { - -% } - - -
- - <% my $num_inactive = $agent->num_inactive_cust_main %>  - - -% if ( $num_inactive ) { - - -% } -inactive -% if ( $num_inactive ) { - -% } - -
- - <% my $num_ordered = $agent->num_ordered_cust_main %>  - - -% if ( $num_ordered ) { - - -% } -ordered -% if ($num_ordered ) { - -% } - - -
- - <% my $num_active = $agent->num_active_cust_main %>  - - -% 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; - +
+ + <% $num = $agent->$meth() %>  + + +% if ( $num || $disable_counts ) { +% + + "> % } -active -% if ( $num_active ) { +<% exists($PL{$status}) ? $PL{$status} : $status %> +% if ($num || $disable_counts ) { % } -
- - <% my $num_susp = $agent->num_susp_cust_main %>  - - -% if ( $num_susp ) { - - -% } -suspended -% if ( $num_susp ) { - -% } - -
- - <% my $num_cancel = $agent->num_cancel_cust_main %>  - - -% if ( $num_cancel ) { - - -% } -cancelled -% if ( $num_cancel ) { - -% } - -
- - - - - - - - - - - - - - - - +% #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/ / /g; - - +% my $num = 0; +% unless ( $disable_counts ) { + +% } - - - - - - - +% }
- - <% my $num_inactive_pkg = $agent->num_inactive_cust_pkg %>  - - -% if ( $num_inactive_pkg ) { - - -% } -inactive -% if ( $num_inactive_pkg ) { - -% } - -
 
- - <% my $num_active_pkg = $agent->num_active_cust_pkg %>  - - -% if ( $num_active_pkg ) { - - -% } -active -% if ( $num_active_pkg ) { - -% } - -
- - <% my $num_susp_pkg = $agent->num_susp_cust_pkg %>  - +
+ + <% $num = $agent->$meth() %>  + + -% if ( $num_susp_pkg ) { +% if ( $num || $disable_counts ) { - + % } -suspended -% if ( $num_susp_pkg ) { +<% $label %> +% if ( $num || $disable_counts ) { % }
- - <% my $num_cancel_pkg = $agent->num_cancel_cust_pkg %>  - - -% if ( $num_cancel_pkg ) { - -% } -cancelled -% if ( $num_cancel_pkg ) { - -% } - -
Package Churn
Payments
Credits
A/R Aging -
<% my $num_reg_code = $agent->num_reg_code %> % if ( $num_reg_code ) { @@ -373,6 +286,10 @@ Unused
Generate codes
<% my $num_prepay_credit = $agent->num_prepay_credit %> % if ( $num_prepay_credit ) { @@ -386,19 +303,22 @@ Unused
Generate cards
% if ( $agent->ticketing_queueid ) { - Queue: <% $agent->ticketing_queueid %>: <% $agent->ticketing_queue %>
% } -
% foreach my $override ( @@ -425,6 +345,10 @@ Unused
% foreach my $override ( @@ -474,5 +398,6 @@ if ( $cgi->param('showdisabled') } my $conf = new FS::Conf; +my $disable_counts = $conf->exists('agent-disable_counts');