hit the database slightly less. this page still takes forever with lots of
[freeside.git] / httemplate / search / cust_main.cgi
index 7aa4021..a52321d 100755 (executable)
@@ -1,5 +1,5 @@
 <%
-#<!-- $Id: cust_main.cgi,v 1.7 2001-10-10 05:33:43 thalakan Exp $ -->
+#<!-- $Id: cust_main.cgi,v 1.13 2001-11-01 00:16:24 ivan Exp $ -->
 
 use strict;
 #use vars qw( $conf %ncancelled_pkgs %all_pkgs $cgi @cust_main $sortby );
@@ -9,7 +9,7 @@ use CGI::Carp qw(fatalsToBrowser);
 use IO::Handle;
 use String::Approx qw(amatch);
 use FS::UID qw(cgisuidsetup);
-use FS::Record qw(qsearch qsearchs dbdef ut_name);
+use FS::Record qw(qsearch qsearchs dbdef);
 use FS::CGI qw(header menubar eidiot popurl table);
 use FS::cust_main;
 use FS::cust_svc;
@@ -59,7 +59,7 @@ if ( scalar(@cust_main) == 1 && ! $cgi->param('referral_custnum') ) {
 } else { 
 
   my($total)=scalar(@cust_main);
-  print $cgi->header( '-expires' => 'now' ), header("Customer Search Results",menubar(
+  print header("Customer Search Results",menubar(
     'Main Menu', popurl(2)
   )), "$total matching customers found ";
   if ( $cgi->param('showcancelledcustomers') eq '0' #see if it was set by me
@@ -172,9 +172,9 @@ END
       my($pkg) = $_->part_pkg->pkg;
       my $comment = $_->part_pkg->comment;
       my($pkgview) = popurl(2). "/view/cust_pkg.cgi?$pkgnum";
-      #my(@cust_svc) = shift @lol_cust_svc;
-      my(@cust_svc) = qsearch( 'cust_svc', { 'pkgnum' => $_->pkgnum } );
-      my($rowspan) = scalar(@cust_svc) || 1;
+      my @cust_svc = @{shift @lol_cust_svc};
+      #my(@cust_svc) = qsearch( 'cust_svc', { 'pkgnum' => $_->pkgnum } );
+      my $rowspan = scalar(@cust_svc) || 1;
 
       print $n1, qq!<TD ROWSPAN=$rowspan><A HREF="$pkgview"><FONT SIZE=-1>$pkg - $comment</FONT></A></TD>!;
       my($n2)='';
@@ -250,8 +250,9 @@ sub lastsearch {
     $last_type{$_}++;
   }
 
-  my $error = ut_name($cgi->param('last_text'));
-  eidiot "Illegal last name" if $error;
+  $cgi->param('last_text') =~ /^([\w \,\.\-\']*)$/
+    or eidiot "Illegal last name";
+  my($last)=$1;
 
   if ( $last_type{'Exact'}
        && ! $last_type{'Fuzzy'}