add customer search by billing email, RT10399
authorlevinse <levinse>
Mon, 10 Jan 2011 20:14:08 +0000 (20:14 +0000)
committerlevinse <levinse>
Mon, 10 Jan 2011 20:14:08 +0000 (20:14 +0000)
FS/FS/cust_main/Search.pm

index ad24ff8..06a4522 100644 (file)
@@ -112,8 +112,17 @@ sub smart_search {
   # custnum search (also try agent_custid), with some tweaking options if your
   # legacy cust "numbers" have letters
   } 
-
-  if ( $search =~ /^\s*(\d+)\s*$/
+  
+  
+  if ( $search =~ /@/ ) {
+      push @cust_main,
+         map $_->cust_main,
+             qsearch( {
+                        'table'     => 'cust_main_invoice',
+                        'hashref'   => { 'dest' => $search },
+                      }
+                    );
+  } elsif ( $search =~ /^\s*(\d+)\s*$/
          || ( $conf->config('cust_main-agent_custid-format') eq 'ww?d+'
               && $search =~ /^\s*(\w\w?\d+)\s*$/
             )