freeside/httemplate/search cust_main.cgi,1.42,1.43

ivan ivan at pouncequick.420.am
Thu Dec 2 01:59:53 PST 2004


Update of /home/cvs/cvsroot/freeside/httemplate/search
In directory pouncequick:/tmp/cvs-serv24319/httemplate/search

Modified Files:
	cust_main.cgi 
Log Message:
second big RT integration checkin, customer linking/delinking interface


Index: cust_main.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/cust_main.cgi,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- cust_main.cgi	24 Aug 2004 11:16:57 -0000	1.42
+++ cust_main.cgi	2 Dec 2004 09:59:48 -0000	1.43
@@ -48,6 +48,9 @@
 my $total = 0;
 
 my(@cust_main, $sortby, $orderby);
+my @select = ();
+my @addl_headers = ();
+my @addl_cols = ();
 if ( $cgi->param('browse')
      || $cgi->param('otaker_on')
      || $cgi->param('agentnum_on')
@@ -65,6 +68,12 @@
     } elsif ( $query eq 'company' ) {
       $sortby=\*company_sort;
       $orderby = "ORDER BY LOWER(company || ' ' || last || ' ' || first )";
+    } elsif ( $query eq 'tickets' ) {
+      $sortby = \*tickets_sort;
+      $orderby = "ORDER BY tickets DESC";
+      push @select, FS::TicketSystem->sql_customer_tickets. " as tickets";
+      push @addl_headers, 'Tickets';
+      push @addl_cols, 'tickets';
     } else {
       die "unknown browse field $query";
     }
@@ -136,7 +145,14 @@
     }
   }
 
-  @cust_main = qsearch('cust_main', \%search, '',   
+  my $select;
+  if ( @select ) {
+    $select = 'cust_main.*, '. join (', ', @select);
+  } else {
+    $select = '*';
+  }
+
+  @cust_main = qsearch('cust_main', \%search, $select,   
                          "$addl_qual $orderby $limit" );
 
 #  foreach my $cust_main ( @just_cust_main ) {
@@ -312,6 +328,10 @@
 END
 }
 
+foreach my $addl_header ( @addl_headers ) {
+  print "<TH>$addl_header</TH>";
+}
+
 print <<END;
         <TH>Packages</TH>
         <TH COLSPAN=2>Services</TH>
@@ -370,6 +390,12 @@
 END
     }
 
+    foreach my $addl_col ( @addl_cols ) {
+      print qq!<TD ROWSPAN=$rowspan><A HREF="XXXnotyetXXX">!.
+              $cust_main->get($addl_col).
+            "</A></TD>";
+    }
+
     my($n1)='';
     foreach ( @{$all_pkgs{$custnum}} ) {
       my $pkgnum = $_->pkgnum;
@@ -422,6 +448,10 @@
 
 sub custnum_sort {
   $a->getfield('custnum') <=> $b->getfield('custnum');
+}
+
+sub tickets_sort {
+  $a->getfield('tickets') <=> $b->getfield('tickets');
 }
 
 sub custnumsearch {




More information about the freeside-commits mailing list