<% include("/elements/header.html",'Agent Listing', menubar(
- 'Main Menu' => $p,
'Agent Types' => $p. 'browse/agent_type.cgi',
# 'Add new agent' => '../edit/agent.cgi'
)) %>
% my $bgcolor1 = '#eeeeee';
% my $bgcolor2 = '#ffffff';
% my $bgcolor = '';
-%
-
<TR>
<TH CLASS="grid" BGCOLOR="#cccccc" COLSPAN=<% ( $cgi->param('showdisabled') || !dbdef->table('agent')->column('disabled') ) ? 2 : 3 %>>Agent</TH>
<TH CLASS="grid" BGCOLOR="#cccccc">Type</TH>
+ <TH CLASS="grid" BGCOLOR="#cccccc">Master Customer</TH>
+ <TH CLASS="grid" BGCOLOR="#cccccc">Commissions</TH>
+ <TH CLASS="grid" BGCOLOR="#cccccc">Access Groups</TH>
<TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1>Invoice<BR>Template</FONT></TH>
<TH CLASS="grid" BGCOLOR="#cccccc">Customers</TH>
<TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1>Customer<BR>packages</FONT></TH>
<TH CLASS="grid" BGCOLOR="#cccccc">Reports</TH>
<TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1>Registration<BR>codes</FONT></TH>
<TH CLASS="grid" BGCOLOR="#cccccc">Prepaid cards</TH>
-% if ( $conf->config('ticket_system') ) {
+% if ( $conf->config('ticket_system') ) {
<TH CLASS="grid" BGCOLOR="#cccccc">Ticketing</TH>
% }
- <TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1>Payment Gateway Overrides</FONT></TH>
+% if ( $conf->config('currencies') ) {
+ <TH CLASS="grid" BGCOLOR="#cccccc">Currencies</TH>
+% }
+
+ <TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1>Payment Gateway Override</FONT></TH>
<TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1>Configuration Overrides</FONT></TH>
</TR>
-%
+
%# <TH><FONT SIZE=-1>Agent #</FONT></TH>
%# <TH>Agent</TH>
-%
%foreach my $agent ( sort {
% #$a->getfield('agentnum') <=> $b->getfield('agentnum')
% $a->getfield('agent') cmp $b->getfield('agent')
% } else {
% $bgcolor = $bgcolor1;
% }
-%
-%
-
<TR>
+% ##
+% # agentnum
+% ##
<TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
<A HREF="<%$p%>edit/agent.cgi?<% $agent->agentnum %>"><% $agent->agentnum %></A>
</TD>
-% if ( dbdef->table('agent')->column('disabled')
-% && !$cgi->param('showdisabled') ) {
- <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
- <% $agent->disabled ? 'DISABLED' : '' %>
+% ##
+% # disabled
+% ##
+% if ( ! $cgi->param('showdisabled') ) {
+ <TD CLASS="grid" BGCOLOR="<% $bgcolor %>" ALIGN="center">
+ <% $agent->disabled ? '<FONT COLOR="#FF0000"><B>DISABLED</B></FONT>'
+ : '<FONT COLOR="#00CC00"><B>Active</B></FONT>'
+ %>
</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>
- <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
- <% $agent->invoice_template || '(Default)' %>
- </TD>
-
+% ##
+% # master customer
+% ##
<TD CLASS="inv" BGCOLOR="<% $bgcolor %>">
- <TABLE CLASS="inv" CELLSPACING=0 CELLPADDING=0>
-
- <TR>
- <TH ALIGN="right" WIDTH="40%">
- <FONT COLOR="#7e0079">
- <% my $num_prospect = $agent->num_prospect_cust_main %>
- </FONT>
- </TH>
+% if ( $agent->agent_custnum ) {
+ <& /elements/small_custview.html,
+ $agent->agent_custnum,
+ scalar($conf->config('countrydefault')),
+ 1, #show balance
+ $p.'view/cust_main.cgi',
+ &>
+% }
+ </TD>
- <TD>
-% if ( $num_prospect ) {
+% ##
+% # commissions
+% ##
- <A HREF="<% $cust_main_link %>&prospect=1">
-% }
-prospects
-% if ($num_prospect ) {
-</A>
-% }
+ <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
- <TD>
- </TR>
+ <TABLE>
- <TR>
- <TH ALIGN="right" WIDTH="40%">
- <FONT COLOR="#0000CC">
- <% my $num_inactive = $agent->num_inactive_cust_main %>
- </FONT>
- </TH>
+% #surprising amount of false laziness w/ edit/process/agent.cgi
+% my @pkg_class = qsearch('pkg_class', { 'disabled'=>'' });
+% foreach my $pkg_class ( '', @pkg_class ) {
+% my %agent_pkg_class = ( 'agentnum' => $agent->agentnum,
+% 'classnum' => $pkg_class ? $pkg_class->classnum : ''
+% );
+% my $agent_pkg_class =
+% qsearchs( 'agent_pkg_class', \%agent_pkg_class )
+% || new FS::agent_pkg_class \%agent_pkg_class;
+% my $param = 'classnum'. $agent_pkg_class{classnum};
- <TD>
-% if ( $num_inactive ) {
+ <TR>
+ <TD><% $agent_pkg_class->commission_percent || 0 %>%</TD>
+ <TD><% $pkg_class ? $pkg_class->classname : mt('(no package class)') |h %>
+ </TD>
+ </TR>
- <A HREF="<% $cust_main_link %>&inactive=1">
-% }
-inactive
-% if ( $num_inactive ) {
-</A>
-% }
+% }
- </TD>
- </TR>
+ </TABLE>
- <TR>
- <TH ALIGN="right" WIDTH="40%">
- <FONT COLOR="#00CC00">
- <% my $num_active = $agent->num_active_cust_main %>
- </FONT>
- </TH>
+ </TD>
- <TD>
-% if ( $num_active ) {
+% ##
+% # access groups
+% ##
+ <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
+% foreach my $access_group (
+% map $_->access_group,
+% qsearch('access_groupagent', { 'agentnum' => $agent->agentnum })
+% ) {
+ <A HREF="<%$p%>edit/access_group.html?<% $access_group->groupnum %>"><% $access_group->groupname |h %><BR>
+% }
+ </TD>
- <A HREF="<% $cust_main_link %>&active=1">
-% }
-active
-% if ( $num_active ) {
-</A>
-% }
+% ##
+% # invoice template
+% ##
+ <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
+ <% $agent->invoice_template || '(Default)' %>
+ </TD>
- </TD>
- </TR>
+% ##
+% # customers
+% ##
- <TR>
- <TH ALIGN="right" WIDTH="40%">
- <FONT COLOR="#FF9900">
- <% my $num_susp = $agent->num_susp_cust_main %>
- </FONT>
- </TH>
+ <TD CLASS="inv" BGCOLOR="<% $bgcolor %>" VALIGN="bottom">
+ <TABLE CLASS="inv" CELLSPACING=0 CELLPADDING=0>
- <TD>
-% if ( $num_susp ) {
+% 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 %>&suspended=1">
+ <TR>
+% my $num = 0;
+% unless ( $disable_counts ) {
+ <TH ALIGN="right" WIDTH="40%">
+ <FONT COLOR="#<% $statuscolor->{$status} %>">
+ <% $num = $agent->$meth() %>
+ </FONT>
+ </TH>
+% }
+ <TD>
+% if ( $num || $disable_counts ) {
+%
+
+ <A HREF="<% $cust_main_link. "&$link=1" %>">
% }
-suspended
-% if ( $num_susp ) {
+<% exists($PL{$status}) ? $PL{$status} : $status %>
+% if ($num || $disable_counts ) {
</A>
% }
- </TD>
- </TR>
-
- <TR>
- <TH ALIGN="right" WIDTH="40%">
- <FONT COLOR="#FF0000">
- <% my $num_cancel = $agent->num_cancel_cust_main %>
- </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 %>
- </FONT>
- </TH>
-
- <TD>
-% if ( $num_inactive_pkg ) {
-
- <A HREF="<% $cust_pkg_link %>&magic=inactive">
-% }
-inactive
-% if ( $num_inactive_pkg ) {
-</A>
-% }
-
- </TD>
- </TR>
-
- <TR>
- <TH ALIGN="right" WIDTH="40%">
- <FONT COLOR="#00CC00">
- <% my $num_active_pkg = $agent->num_active_cust_pkg %>
- </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/ / /g;
- <TR>
- <TH ALIGN="right" WIDTH="40%">
- <FONT COLOR="#FF9900">
- <% my $num_susp_pkg = $agent->num_susp_cust_pkg %>
- </FONT>
+ <TR>
+% my $num = 0;
+% unless ( $disable_counts ) {
+ <TH ALIGN="right" WIDTH="40%">
+ <FONT COLOR="#<% $statuscolor->{$status} %>">
+ <% $num = $agent->$meth() %>
+ </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 %>
- </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 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 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 ) {
<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 ) {
<BR><A HREF="<%$p%>edit/prepay_credit.cgi?agentnum=<% $agent->agentnum %>">Generate cards</A>
</TD>
-% if ( $conf->config('ticket_system') ) {
-
+% ##
+% # ticketing
+% ##
+% if ( $conf->config('ticket_system') ) {
<TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
-% if ( $agent->ticketing_queueid ) {
-
- Queue: <% $agent->ticketing_queueid %>: <% $agent->ticketing_queue %><BR>
+% if ( $agent->ticketing_queueid ) {
+ Queue: <% $agent->ticketing_queueid %>:
+ <% $agent->ticketing_queue %>
+ <BR>
+% }
+ </TD>
% }
+% ##
+% # currencies
+% ##
+% if ( $conf->config('currencies') ) {
+ <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
+ <% join('<BR>', sort keys %{ $agent->agent_currency_hashref } ) %>
</TD>
% }
+% ##
+% # payment gateway override
+% ##
<TD CLASS="inv" BGCOLOR="<% $bgcolor %>">
<TABLE CLASS="inv" CELLSPACING=0 CELLPADDING=0>
-% foreach my $override (
-% # sort { } want taxclass-full stuff first? and default cards (empty cardtype)
-% qsearch('agent_payment_gateway', { 'agentnum' => $agent->agentnum } )
-% ) {
-%
-
+% my $gw_override = qsearchs('agent_payment_gateway', { 'agentnum' => $agent->agentnum } );
+% if ($gw_override) {
<TR>
<TD>
- <% $override->cardtype || 'Default' %> to <% $override->payment_gateway->gateway_module %> (<% $override->payment_gateway->gateway_username %>)
- <% $override->taxclass
- ? ' for '. $override->taxclass. ' only'
- : ''
- %>
- <FONT SIZE=-1><A HREF="<%$p%>misc/delete-agent_payment_gateway.cgi?<% $override->agentgatewaynum %>">(delete)</A></FONT>
+ <% $gw_override->payment_gateway->gateway_module %> (<% $gw_override->payment_gateway->gateway_username %>)
+ <FONT SIZE=-1><A HREF="javascript:areyousure('delete this payment gateway override', '<%$p%>misc/delete-agent_payment_gateway.cgi?<% $gw_override->agentgatewaynum %>')">(delete)</A></FONT>
</TD>
</TR>
-% }
-
+% } else {
<TR>
<TD><FONT SIZE=-1><A HREF="<%$p%>edit/agent_payment_gateway.html?agentnum=<% $agent->agentnum %>">(add override)</A></FONT></TD>
</TR>
+% }
</TABLE>
</TD>
+% ##
+% # configuration overrides
+% ##
+
<TD CLASS="inv" BGCOLOR="<% $bgcolor %>">
<TABLE CLASS="inv" CELLSPACING=0 CELLPADDING=0>
% foreach my $override (
<TR>
<TD>
- <% $override->name %>
- <FONT SIZE=-1><A HREF="<%$p%>config/config-delete.cgi?<% $override->confnum %>">(delete)</A></FONT>
+ <% $override->name %> <FONT SIZE=-1><A HREF="javascript:areyousure('delete this configuration override', '<%$p%>config/config-delete.cgi?confnum=<% $override->confnum %>')">(delete)</A></FONT>
</TD>
</TR>
% }
<TR>
- <TD><FONT SIZE=-1><A HREF="<%$p%>config/config-view.cgi?agentnum=<% $agent->agentnum %>">(add override)</A></FONT></TD>
+ <TD><FONT SIZE=-1><A HREF="<%$p%>config/config-view.cgi?agentnum=<% $agent->agentnum %>">(view/add/edit overrides)</A></FONT></TD>
</TR>
</TABLE>
</TD>
</TABLE>
+
+<SCRIPT TYPE="text/javascript">
+ function areyousure(what, href) {
+ if ( confirm("Are you sure you want to " + what + "?") == true )
+ window.location.href = href;
+ }
+</SCRIPT>
+
</BODY>
</HTML>
<%init>
}
my $conf = new FS::Conf;
+my $disable_counts = $conf->exists('agent-disable_counts');
</%init>