eliminate duplicate cusomters before figuring to display a list or redirect.
authorivan <ivan>
Sun, 10 Feb 2002 17:30:33 +0000 (17:30 +0000)
committerivan <ivan>
Sun, 10 Feb 2002 17:30:33 +0000 (17:30 +0000)
eliiminates "2 matching found" displayed but only one in list.

httemplate/search/cust_main.cgi

index b962c7c..1e28ad5 100755 (executable)
@@ -45,7 +45,7 @@ $limit .= "LIMIT $maxrecords" if $maxrecords;
 my $offset = $cgi->param('offset') || 0;
 $limit .= " OFFSET $offset" if $offset;
 
 my $offset = $cgi->param('offset') || 0;
 $limit .= " OFFSET $offset" if $offset;
 
-my $total;
+my $total = 0;
 
 my(@cust_main, $sortby, $orderby);
 if ( $cgi->param('browse') ) {
 
 my(@cust_main, $sortby, $orderby);
 if ( $cgi->param('browse') ) {
@@ -134,6 +134,9 @@ if ( $cgi->param('browse') ) {
     if $cgi->param('showcancelledcustomers') eq '0' #see if it was set by me
        || ( $conf->exists('hidecancelledcustomers')
              && ! $cgi->param('showcancelledcustomers') );
     if $cgi->param('showcancelledcustomers') eq '0' #see if it was set by me
        || ( $conf->exists('hidecancelledcustomers')
              && ! $cgi->param('showcancelledcustomers') );
+
+  my %saw = ();
+  @cust_main = grep { !$saw{$_->custnum}++ } @cust_main;
 }
 
 my %all_pkgs;
 }
 
 my %all_pkgs;