[freeside-commits] freeside/httemplate/view/cust_main misc.html, 1.10, 1.11

Ivan,,, ivan at wavetail.420.am
Thu Oct 9 18:15:52 PDT 2008


Update of /home/cvs/cvsroot/freeside/httemplate/view/cust_main
In directory wavetail.420.am:/tmp/cvs-serv11362/httemplate/view/cust_main

Modified Files:
	misc.html 
Log Message:
add options to auto-generate agent_custid and display it as the customer number, RT#4099

Index: misc.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/view/cust_main/misc.html,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- misc.html	15 Dec 2006 05:29:48 -0000	1.10
+++ misc.html	10 Oct 2008 01:15:49 -0000	1.11
@@ -1,41 +1,29 @@
-%
-%  my( $cust_main ) = @_;
-%  my $conf = new FS::Conf;
-%  my $date_format = ($conf->config('date_format') || "%m/%d/%Y");
-%
-
-
 <% ntable("#cccccc") %><TR><TD><% &ntable("#cccccc",2) %>
 
 <TR>
   <TD ALIGN="right">Customer&nbsp;number</TD>
-  <TD BGCOLOR="#ffffff"><% $cust_main->custnum %></TD>
+  <TD BGCOLOR="#ffffff"><% $cust_main->display_custnum %></TD>
 </TR>
 
 <TR>
   <TD ALIGN="right">Status</TD>
   <TD BGCOLOR="#ffffff"><FONT COLOR="#<% $cust_main->statuscolor %>"><B><% ucfirst($cust_main->status) %></B></FONT></TD>
 </TR>
-%
-%  my @agents = qsearch( 'agent', {} );
-%  my $agent;
-%  unless ( scalar(@agents) == 1 ) {
-%    $agent = qsearchs('agent',{ 'agentnum' => $cust_main->agentnum } );
-%
-
 
-<TR>
-  <TD ALIGN="right">Agent</TD>
-  <TD BGCOLOR="#ffffff"><% $agent->agentnum %>: <% $agent->agent %></TD>
-</TR>
-%
-%  } else {
-%    $agent = $agents[0];
-%  }
-%
-%  if ( $cust_main->agent_custid ) {
-%
+%my $agent;
+%if ( $num_agents == 1 ) {
+%  my @agents = qsearchs( 'agent', {} );
+%  $agent = $agents[0];
+%} else {
+%  $agent = qsearchs('agent',{ 'agentnum' => $cust_main->agentnum } );
+   <TR>
+     <TD ALIGN="right">Agent</TD>
+     <TD BGCOLOR="#ffffff"><% $agent->agentnum %>: <% $agent->agent %></TD>
+   </TR>
+% }
 
+%  if ( $cust_main->agent_custid
+%       && ! $conf->exists('cust_main-default_agent_custid') ) {
 
 <TR>
   <TD ALIGN="right">Agent customer ref#</TD>
@@ -109,4 +97,14 @@
 % }
 
 </TABLE></TD></TR></TABLE>
+<%init>
+
+my( $cust_main ) = @_;
+my $conf = new FS::Conf;
+my $date_format = ($conf->config('date_format') || "%m/%d/%Y");
+
+my $sth = dbh->prepare('SELECT COUNT(*) FROM agent') or die dbh->errstr;
+$sth->execute or die $sth->errstr;
+my $num_agents = $sth->fetchrow_arrayref->[0];
 
+</%init>



More information about the freeside-commits mailing list