[freeside-commits] freeside/FS/FS/cust_main Search.pm,1.1,1.2

Ivan,,, ivan at wavetail.420.am
Wed Oct 20 18:34:54 PDT 2010


Update of /home/cvs/cvsroot/freeside/FS/FS/cust_main
In directory wavetail.420.am:/tmp/cvs-serv19193/FS/FS/cust_main

Modified Files:
	Search.pm 
Log Message:
better address searching: disable fuzzy/substring searches when an exact match is found, work around L:EN:NameParse DrainBramage w/two-letter first names like "Ed", add an address1 search to advanced customer search, RT#10254

Index: Search.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main/Search.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -d -r1.1 -r1.2
--- Search.pm	17 Sep 2010 23:32:33 -0000	1.1
+++ Search.pm	21 Oct 2010 01:34:52 -0000	1.2
@@ -203,7 +203,7 @@
     } elsif ( ! $NameParse->parse($value) ) {
 
       my %name = $NameParse->components;
-      $first = $name{'given_name_1'};
+      $first = $name{'given_name_1'} || $name{'initials_1'}; #wtf NameParse, Ed?
       $last  = $name{'surname_1'};
 
     }
@@ -422,6 +422,8 @@
 
 =item status
 
+=item address
+
 =item cancelled_pkgs
 
 bool
@@ -490,6 +492,18 @@
   }
   
   ##
+  # address
+  ##
+  if ( $params->{'address'} =~ /\S/ ) {
+    my $address = dbh->quote('%'. lc($params->{'address'}). '%');
+    push @where, '('. join(' OR ',
+                             map "LOWER($_) LIKE $address",
+                               qw(address1 address2 ship_address1 ship_address2)
+                          ).
+                 ')';
+  }
+
+  ##
   # parse cancelled package checkbox
   ##
 



More information about the freeside-commits mailing list