optimize CDR rating after timed rate perf regression, RT#15739
[freeside.git] / httemplate / browse / agent.cgi
index 234bfa7..64288b8 100755 (executable)
@@ -20,30 +20,29 @@ full offerings (via their type).<BR><BR>
 % 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">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>
   <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')
@@ -59,9 +58,6 @@ full offerings (via their type).<BR><BR>
 %  } else {
 %    $bgcolor = $bgcolor1;
 %  }
-%
-%
-
 
       <TR>
 
@@ -69,10 +65,11 @@ full offerings (via their type).<BR><BR>
           <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' : '' %>
+%       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>
 %       } 
 
@@ -84,11 +81,31 @@ full offerings (via their type).<BR><BR>
           <A HREF="<%$p%>edit/agent_type.cgi?<% $agent->typenum %>"><% $agent->agent_type->atype %></A>
         </TD>
 
+        <TD CLASS="inv" BGCOLOR="<% $bgcolor %>">
+%         if ( $agent->agent_custnum ) {
+            <% include('/elements/small_custview.html',
+                         $agent->agent_custnum,
+                         scalar($conf->config('countrydefault')),
+                         1, #show balance
+                      )
+            %>
+%         }
+        </TD>
+
+        <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>
+
         <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
           <% $agent->invoice_template || '(Default)' %>
         </TD>
 
-        <TD CLASS="inv" BGCOLOR="<% $bgcolor %>">
+        <TD CLASS="inv" BGCOLOR="<% $bgcolor %>" VALIGN="bottom">
           <TABLE CLASS="inv" CELLSPACING=0 CELLPADDING=0>
 
             <TR>
@@ -344,7 +361,7 @@ Unused
                         ? ' for '. $override->taxclass. ' only'
                         : ''
                   %>
-                  <FONT SIZE=-1><A HREF="<%$p%>misc/delete-agent_payment_gateway.cgi?<% $override->agentgatewaynum %>">(delete)</A></FONT>
+                  <FONT SIZE=-1><A HREF="javascript:areyousure('delete this payment gateway override', '<%$p%>misc/delete-agent_payment_gateway.cgi?<% $override->agentgatewaynum %>')">(delete)</A></FONT>
                 </TD>
               </TR>
 % } 
@@ -364,14 +381,13 @@ Unused
 
               <TR>
                 <TD> 
-                  <% $override->name %>
-                  <FONT SIZE=-1><A HREF="<%$p%>config/config-delete.cgi?<% $override->confnum %>">(delete)</A></FONT>
+                  <% $override->name %>&nbsp;<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>
@@ -381,6 +397,14 @@ Unused
 
 
     </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>