1 <% include("/elements/header.html",'Agent Listing', menubar(
2 'Agent Types' => $p. 'browse/agent_type.cgi',
3 # 'Add new agent' => '../edit/agent.cgi'
5 Agents are resellers of your service. Agents may be limited to a subset of your
6 full offerings (via their type).<BR><BR>
7 <A HREF="<% $p %>edit/agent.cgi"><I>Add a new agent</I></A><BR><BR>
8 % if ( dbdef->table('agent')->column('disabled') ) {
10 <% $cgi->param('showdisabled')
11 ? do { $cgi->param('showdisabled', 0);
12 '( <a href="'. $cgi->self_url. '">hide disabled agents</a> )'; }
13 : do { $cgi->param('showdisabled', 1);
14 '( <a href="'. $cgi->self_url. '">show disabled agents</a> )'; }
19 <% include('/elements/table-grid.html') %>
20 % my $bgcolor1 = '#eeeeee';
21 % my $bgcolor2 = '#ffffff';
25 <TH CLASS="grid" BGCOLOR="#cccccc" COLSPAN=<% ( $cgi->param('showdisabled') || !dbdef->table('agent')->column('disabled') ) ? 2 : 3 %>>Agent</TH>
26 <TH CLASS="grid" BGCOLOR="#cccccc">Type</TH>
27 <TH CLASS="grid" BGCOLOR="#cccccc">Master Customer</TH>
28 <TH CLASS="grid" BGCOLOR="#cccccc">Access Groups</TH>
29 <TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1>Invoice<BR>Template</FONT></TH>
30 <TH CLASS="grid" BGCOLOR="#cccccc">Customers</TH>
31 <TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1>Customer<BR>packages</FONT></TH>
32 <TH CLASS="grid" BGCOLOR="#cccccc">Reports</TH>
33 <TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1>Registration<BR>codes</FONT></TH>
34 <TH CLASS="grid" BGCOLOR="#cccccc">Prepaid cards</TH>
36 % if ( $conf->config('ticket_system') ) {
37 <TH CLASS="grid" BGCOLOR="#cccccc">Ticketing</TH>
40 <TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1>Payment Gateway Overrides</FONT></TH>
41 <TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1>Configuration Overrides</FONT></TH>
44 %# <TH><FONT SIZE=-1>Agent #</FONT></TH>
46 %foreach my $agent ( sort {
47 % #$a->getfield('agentnum') <=> $b->getfield('agentnum')
48 % $a->getfield('agent') cmp $b->getfield('agent')
49 %} qsearch('agent', \%search ) ) {
51 % my $cust_main_link = $p. 'search/cust_main.cgi?agentnum_on=1&'.
52 % 'agentnum='. $agent->agentnum;
54 % my $cust_pkg_link = $p. 'search/cust_pkg.cgi?agentnum='. $agent->agentnum;
56 % if ( $bgcolor eq $bgcolor1 ) {
57 % $bgcolor = $bgcolor2;
59 % $bgcolor = $bgcolor1;
64 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
65 <A HREF="<%$p%>edit/agent.cgi?<% $agent->agentnum %>"><% $agent->agentnum %></A>
68 % if ( ! $cgi->param('showdisabled') ) {
69 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>" ALIGN="center">
70 <% $agent->disabled ? '<FONT COLOR="#FF0000"><B>DISABLED</B></FONT>'
71 : '<FONT COLOR="#00CC00"><B>Active</B></FONT>'
76 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
77 <A HREF="<%$p%>edit/agent.cgi?<% $agent->agentnum %>"><% $agent->agent %></A>
80 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
81 <A HREF="<%$p%>edit/agent_type.cgi?<% $agent->typenum %>"><% $agent->agent_type->atype %></A>
84 <TD CLASS="inv" BGCOLOR="<% $bgcolor %>">
85 % if ( $agent->agent_custnum ) {
86 <% include('/elements/small_custview.html',
87 $agent->agent_custnum,
88 scalar($conf->config('countrydefault')),
95 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
96 % foreach my $access_group (
97 % map $_->access_group,
98 % qsearch('access_groupagent', { 'agentnum' => $agent->agentnum })
100 <A HREF="<%$p%>edit/access_group.html?<% $access_group->groupnum %>"><% $access_group->groupname |h %><BR>
104 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
105 <% $agent->invoice_template || '(Default)' %>
108 <TD CLASS="inv" BGCOLOR="<% $bgcolor %>" VALIGN="bottom">
109 <TABLE CLASS="inv" CELLSPACING=0 CELLPADDING=0>
112 <TH ALIGN="right" WIDTH="40%">
113 <FONT COLOR="#7e0079">
114 <% my $num_prospect = $agent->num_prospect_cust_main %>
119 % if ( $num_prospect ) {
121 <A HREF="<% $cust_main_link %>&prospect=1">
124 % if ($num_prospect ) {
132 <TH ALIGN="right" WIDTH="40%">
133 <FONT COLOR="#0000CC">
134 <% my $num_inactive = $agent->num_inactive_cust_main %>
139 % if ( $num_inactive ) {
141 <A HREF="<% $cust_main_link %>&inactive=1">
144 % if ( $num_inactive ) {
152 <TH ALIGN="right" WIDTH="40%">
153 <FONT COLOR="#00CC00">
154 <% my $num_active = $agent->num_active_cust_main %>
159 % if ( $num_active ) {
161 <A HREF="<% $cust_main_link %>&active=1">
164 % if ( $num_active ) {
172 <TH ALIGN="right" WIDTH="40%">
173 <FONT COLOR="#FF9900">
174 <% my $num_susp = $agent->num_susp_cust_main %>
181 <A HREF="<% $cust_main_link %>&suspended=1">
192 <TH ALIGN="right" WIDTH="40%">
193 <FONT COLOR="#FF0000">
194 <% my $num_cancel = $agent->num_cancel_cust_main %>
199 % if ( $num_cancel ) {
201 <A HREF="<% $cust_main_link %>&showcancelledcustomers=1&cancelled=1">
204 % if ( $num_cancel ) {
214 <TD CLASS="inv" BGCOLOR="<% $bgcolor %>" VALIGN="bottom">
215 <TABLE CLASS="inv" CELLSPACING=0 CELLPADDING=0>
218 <TH ALIGN="right" WIDTH="40%">
219 <FONT COLOR="#0000CC">
220 <% my $num_inactive_pkg = $agent->num_inactive_cust_pkg %>
225 % if ( $num_inactive_pkg ) {
227 <A HREF="<% $cust_pkg_link %>&magic=inactive">
230 % if ( $num_inactive_pkg ) {
238 <TH ALIGN="right" WIDTH="40%">
239 <FONT COLOR="#00CC00">
240 <% my $num_active_pkg = $agent->num_active_cust_pkg %>
245 % if ( $num_active_pkg ) {
247 <A HREF="<% $cust_pkg_link %>&magic=active">
250 % if ( $num_active_pkg ) {
258 <TH ALIGN="right" WIDTH="40%">
259 <FONT COLOR="#FF9900">
260 <% my $num_susp_pkg = $agent->num_susp_cust_pkg %>
265 % if ( $num_susp_pkg ) {
267 <A HREF="<% $cust_pkg_link %>&magic=suspended">
270 % if ( $num_susp_pkg ) {
278 <TH ALIGN="right" WIDTH="40%">
279 <FONT COLOR="#FF0000">
280 <% my $num_cancel_pkg = $agent->num_cancel_cust_pkg %>
285 % if ( $num_cancel_pkg ) {
287 <A HREF="<% $cust_pkg_link %>&magic=cancelled">
290 % if ( $num_cancel_pkg ) {
300 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
301 <A HREF="<% $p %>graph/report_cust_pkg.html?agentnum=<% $agent->agentnum %>">Package Churn</A>
302 <BR><A HREF="<% $p %>search/report_cust_pay.html?agentnum=<% $agent->agentnum %>">Payments</A>
303 <BR><A HREF="<% $p %>search/report_cust_credit.html?agentnum=<% $agent->agentnum %>">Credits</A>
304 <BR><A HREF="<% $p %>search/report_receivables.cgi?agentnum=<% $agent->agentnum %>">A/R Aging</A>
305 <!--<BR><A HREF="<% $p %>search/money_time.cgi?agentnum=<% $agent->agentnum %>">Sales/Credits/Receipts</A>-->
309 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
310 <% my $num_reg_code = $agent->num_reg_code %>
311 % if ( $num_reg_code ) {
313 <A HREF="<%$p%>search/reg_code.html?agentnum=<% $agent->agentnum %>">
316 % if ( $num_reg_code ) {
320 <BR><A HREF="<%$p%>edit/reg_code.cgi?agentnum=<% $agent->agentnum %>">Generate codes</A>
323 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
324 <% my $num_prepay_credit = $agent->num_prepay_credit %>
325 % if ( $num_prepay_credit ) {
327 <A HREF="<%$p%>search/prepay_credit.html?agentnum=<% $agent->agentnum %>">
330 % if ( $num_prepay_credit ) {
334 <BR><A HREF="<%$p%>edit/prepay_credit.cgi?agentnum=<% $agent->agentnum %>">Generate cards</A>
336 % if ( $conf->config('ticket_system') ) {
339 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
340 % if ( $agent->ticketing_queueid ) {
342 Queue: <% $agent->ticketing_queueid %>: <% $agent->ticketing_queue %><BR>
349 <TD CLASS="inv" BGCOLOR="<% $bgcolor %>">
350 <TABLE CLASS="inv" CELLSPACING=0 CELLPADDING=0>
351 % foreach my $override (
352 % # sort { } want taxclass-full stuff first? and default cards (empty cardtype)
353 % qsearch('agent_payment_gateway', { 'agentnum' => $agent->agentnum } )
359 <% $override->cardtype || 'Default' %> to <% $override->payment_gateway->gateway_module %> (<% $override->payment_gateway->gateway_username %>)
360 <% $override->taxclass
361 ? ' for '. $override->taxclass. ' only'
364 <FONT SIZE=-1><A HREF="javascript:areyousure('delete this payment gateway override', '<%$p%>misc/delete-agent_payment_gateway.cgi?<% $override->agentgatewaynum %>')">(delete)</A></FONT>
370 <TD><FONT SIZE=-1><A HREF="<%$p%>edit/agent_payment_gateway.html?agentnum=<% $agent->agentnum %>">(add override)</A></FONT></TD>
375 <TD CLASS="inv" BGCOLOR="<% $bgcolor %>">
376 <TABLE CLASS="inv" CELLSPACING=0 CELLPADDING=0>
377 % foreach my $override (
378 % qsearch('conf', { 'agentnum' => $agent->agentnum } )
384 <% $override->name %> <FONT SIZE=-1><A HREF="javascript:areyousure('delete this configuration override', '<%$p%>config/config-delete.cgi?confnum=<% $override->confnum %>')">(delete)</A></FONT>
390 <TD><FONT SIZE=-1><A HREF="<%$p%>config/config-view.cgi?agentnum=<% $agent->agentnum %>">(view/add/edit overrides)</A></FONT></TD>
401 <SCRIPT TYPE="text/javascript">
402 function areyousure(what, href) {
403 if ( confirm("Are you sure you want to " + what + "?") == true )
404 window.location.href = href;
413 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
416 if ( $cgi->param('showdisabled')
417 || !dbdef->table('agent')->column('disabled') ) {
420 %search = ( 'disabled' => '' );
423 my $conf = new FS::Conf;