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 ( dbdef->table('agent')->column('disabled')
69 % && !$cgi->param('showdisabled') ) {
70 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
71 <% $agent->disabled ? 'DISABLED' : '' %>
75 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
76 <A HREF="<%$p%>edit/agent.cgi?<% $agent->agentnum %>"><% $agent->agent %></A>
79 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
80 <A HREF="<%$p%>edit/agent_type.cgi?<% $agent->typenum %>"><% $agent->agent_type->atype %></A>
83 <TD CLASS="inv" BGCOLOR="<% $bgcolor %>">
84 % if ( $agent->agent_custnum ) {
85 <% include('/elements/small_custview.html',
86 $agent->agent_custnum,
87 scalar($conf->config('countrydefault')),
94 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
95 % foreach my $access_group (
96 % map $_->access_group,
97 % qsearch('access_groupagent', { 'agentnum' => $agent->agentnum })
99 <A HREF="<%$p%>edit/access_group.html?<% $access_group->groupnum %>"><% $access_group->groupname |h %><BR>
103 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
104 <% $agent->invoice_template || '(Default)' %>
107 <TD CLASS="inv" BGCOLOR="<% $bgcolor %>" VALIGN="bottom">
108 <TABLE CLASS="inv" CELLSPACING=0 CELLPADDING=0>
111 <TH ALIGN="right" WIDTH="40%">
112 <FONT COLOR="#7e0079">
113 <% my $num_prospect = $agent->num_prospect_cust_main %>
118 % if ( $num_prospect ) {
120 <A HREF="<% $cust_main_link %>&prospect=1">
123 % if ($num_prospect ) {
131 <TH ALIGN="right" WIDTH="40%">
132 <FONT COLOR="#0000CC">
133 <% my $num_inactive = $agent->num_inactive_cust_main %>
138 % if ( $num_inactive ) {
140 <A HREF="<% $cust_main_link %>&inactive=1">
143 % if ( $num_inactive ) {
151 <TH ALIGN="right" WIDTH="40%">
152 <FONT COLOR="#00CC00">
153 <% my $num_active = $agent->num_active_cust_main %>
158 % if ( $num_active ) {
160 <A HREF="<% $cust_main_link %>&active=1">
163 % if ( $num_active ) {
171 <TH ALIGN="right" WIDTH="40%">
172 <FONT COLOR="#FF9900">
173 <% my $num_susp = $agent->num_susp_cust_main %>
180 <A HREF="<% $cust_main_link %>&suspended=1">
191 <TH ALIGN="right" WIDTH="40%">
192 <FONT COLOR="#FF0000">
193 <% my $num_cancel = $agent->num_cancel_cust_main %>
198 % if ( $num_cancel ) {
200 <A HREF="<% $cust_main_link %>&showcancelledcustomers=1&cancelled=1">
203 % if ( $num_cancel ) {
213 <TD CLASS="inv" BGCOLOR="<% $bgcolor %>" VALIGN="bottom">
214 <TABLE CLASS="inv" CELLSPACING=0 CELLPADDING=0>
217 <TH ALIGN="right" WIDTH="40%">
218 <FONT COLOR="#0000CC">
219 <% my $num_inactive_pkg = $agent->num_inactive_cust_pkg %>
224 % if ( $num_inactive_pkg ) {
226 <A HREF="<% $cust_pkg_link %>&magic=inactive">
229 % if ( $num_inactive_pkg ) {
237 <TH ALIGN="right" WIDTH="40%">
238 <FONT COLOR="#00CC00">
239 <% my $num_active_pkg = $agent->num_active_cust_pkg %>
244 % if ( $num_active_pkg ) {
246 <A HREF="<% $cust_pkg_link %>&magic=active">
249 % if ( $num_active_pkg ) {
257 <TH ALIGN="right" WIDTH="40%">
258 <FONT COLOR="#FF9900">
259 <% my $num_susp_pkg = $agent->num_susp_cust_pkg %>
264 % if ( $num_susp_pkg ) {
266 <A HREF="<% $cust_pkg_link %>&magic=suspended">
269 % if ( $num_susp_pkg ) {
277 <TH ALIGN="right" WIDTH="40%">
278 <FONT COLOR="#FF0000">
279 <% my $num_cancel_pkg = $agent->num_cancel_cust_pkg %>
284 % if ( $num_cancel_pkg ) {
286 <A HREF="<% $cust_pkg_link %>&magic=cancelled">
289 % if ( $num_cancel_pkg ) {
299 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
300 <A HREF="<% $p %>graph/report_cust_pkg.html?agentnum=<% $agent->agentnum %>">Package Churn</A>
301 <BR><A HREF="<% $p %>search/report_cust_pay.html?agentnum=<% $agent->agentnum %>">Payments</A>
302 <BR><A HREF="<% $p %>search/report_cust_credit.html?agentnum=<% $agent->agentnum %>">Credits</A>
303 <BR><A HREF="<% $p %>search/report_receivables.cgi?agentnum=<% $agent->agentnum %>">A/R Aging</A>
304 <!--<BR><A HREF="<% $p %>search/money_time.cgi?agentnum=<% $agent->agentnum %>">Sales/Credits/Receipts</A>-->
308 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
309 <% my $num_reg_code = $agent->num_reg_code %>
310 % if ( $num_reg_code ) {
312 <A HREF="<%$p%>search/reg_code.html?agentnum=<% $agent->agentnum %>">
315 % if ( $num_reg_code ) {
319 <BR><A HREF="<%$p%>edit/reg_code.cgi?agentnum=<% $agent->agentnum %>">Generate codes</A>
322 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
323 <% my $num_prepay_credit = $agent->num_prepay_credit %>
324 % if ( $num_prepay_credit ) {
326 <A HREF="<%$p%>search/prepay_credit.html?agentnum=<% $agent->agentnum %>">
329 % if ( $num_prepay_credit ) {
333 <BR><A HREF="<%$p%>edit/prepay_credit.cgi?agentnum=<% $agent->agentnum %>">Generate cards</A>
335 % if ( $conf->config('ticket_system') ) {
338 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
339 % if ( $agent->ticketing_queueid ) {
341 Queue: <% $agent->ticketing_queueid %>: <% $agent->ticketing_queue %><BR>
348 <TD CLASS="inv" BGCOLOR="<% $bgcolor %>">
349 <TABLE CLASS="inv" CELLSPACING=0 CELLPADDING=0>
350 % foreach my $override (
351 % # sort { } want taxclass-full stuff first? and default cards (empty cardtype)
352 % qsearch('agent_payment_gateway', { 'agentnum' => $agent->agentnum } )
358 <% $override->cardtype || 'Default' %> to <% $override->payment_gateway->gateway_module %> (<% $override->payment_gateway->gateway_username %>)
359 <% $override->taxclass
360 ? ' for '. $override->taxclass. ' only'
363 <FONT SIZE=-1><A HREF="javascript:areyousure('delete this payment gateway override', '<%$p%>misc/delete-agent_payment_gateway.cgi?<% $override->agentgatewaynum %>')">(delete)</A></FONT>
369 <TD><FONT SIZE=-1><A HREF="<%$p%>edit/agent_payment_gateway.html?agentnum=<% $agent->agentnum %>">(add override)</A></FONT></TD>
374 <TD CLASS="inv" BGCOLOR="<% $bgcolor %>">
375 <TABLE CLASS="inv" CELLSPACING=0 CELLPADDING=0>
376 % foreach my $override (
377 % qsearch('conf', { 'agentnum' => $agent->agentnum } )
383 <% $override->name %> <FONT SIZE=-1><A HREF="javascript:areyousure('delete this configuration override', '<%$p%>config/config-delete.cgi?confnum=<% $override->confnum %>')">(delete)</A></FONT>
389 <TD><FONT SIZE=-1><A HREF="<%$p%>config/config-view.cgi?agentnum=<% $agent->agentnum %>">(view/add/edit overrides)</A></FONT></TD>
400 <SCRIPT TYPE="text/javascript">
401 function areyousure(what, href) {
402 if ( confirm("Are you sure you want to " + what + "?") == true )
403 window.location.href = href;
412 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
415 if ( $cgi->param('showdisabled')
416 || !dbdef->table('agent')->column('disabled') ) {
419 %search = ( 'disabled' => '' );
422 my $conf = new FS::Conf;