[freeside-commits] freeside/httemplate/search cust_main.cgi, 1.76, 1.77
Ivan,,,
ivan at wavetail.420.am
Thu Oct 9 18:15:52 PDT 2008
Update of /home/cvs/cvsroot/freeside/httemplate/search
In directory wavetail.420.am:/tmp/cvs-serv11362/httemplate/search
Modified Files:
cust_main.cgi
Log Message:
add options to auto-generate agent_custid and display it as the customer number, RT#4099
Index: cust_main.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/cust_main.cgi,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -d -r1.76 -r1.77
--- cust_main.cgi 17 Dec 2007 00:59:02 -0000 1.76
+++ cust_main.cgi 10 Oct 2008 01:15:50 -0000 1.77
@@ -62,8 +62,13 @@
% if ( $cgi->param('browse') ) {
% my $query = $cgi->param('browse');
% if ( $query eq 'custnum' ) {
-% $sortby=\*custnum_sort;
-% $orderby = "ORDER BY custnum";
+% if ( $conf->exists('cust_main-default_agent_custid') ) {
+% $sortby=\*display_custnum_sort;
+% $orderby = "ORDER BY CASE WHEN agent_custid IS NOT NULL AND agent_custid != '' THEN CAST(agent_custid AS BIGINT) ELSE custnum END";
+% } else {
+% $sortby=\*custnum_sort;
+% $orderby = "ORDER BY custnum";
+% }
% } elsif ( $query eq 'last' ) {
% $sortby=\*last_sort;
% $orderby = "ORDER BY LOWER(last || ' ' || first)";
@@ -379,7 +384,7 @@
% my $statuscol = $cust_main->statuscolor;
<TR>
- <TD CLASS="grid" ALIGN="right" BGCOLOR="<% $bgcolor %>" ROWSPAN=<% $rowspan || 1 %>><A HREF="<% $view %>"><FONT SIZE=-1><% $custnum %></FONT></A></TD>
+ <TD CLASS="grid" ALIGN="right" BGCOLOR="<% $bgcolor %>" ROWSPAN=<% $rowspan || 1 %>><A HREF="<% $view %>"><FONT SIZE=-1><% $cust_main->display_custnum %></FONT></A></TD>
<TD CLASS="grid" ALIGN="center" BGCOLOR="<% $bgcolor %>" ROWSPAN=<% $rowspan || 1 %>><FONT SIZE="-1" COLOR="#<% $statuscol %>"><B><% ucfirst($status) %></B></FONT></TD>
<TD CLASS="grid" BGCOLOR="<% $bgcolor %>" ROWSPAN=<% $rowspan || 1 %>><A HREF="<% $view %>"><FONT SIZE=-1><% "$last, $first" %></FONT></A></TD>
<TD CLASS="grid" BGCOLOR="<% $bgcolor %>" ROWSPAN=<% $rowspan || 1 %>><% $pcompany %></TD>
@@ -538,6 +543,10 @@
% || lc($a->first) cmp lc($b->first);;
%}
%
+%sub display_custnum_sort {
+% $a->display_custnum <=> $b->display_custnum;
+%}
+%
%sub custnum_sort {
% $a->getfield('custnum') <=> $b->getfield('custnum');
%}
More information about the freeside-commits
mailing list