X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_main%2FSearch.pm;h=06a4522f448f44fc251eb853eb07cd56e6ff375a;hb=c34d1fcd9b979bb3598c32dfab4b6d79ccd5a010;hp=ac170ff1f91240ce73efc6fb5c85365516cc7ba4;hpb=bd35baff8b7b5dcdd44d14a1139ef4d48009274c;p=freeside.git diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm index ac170ff1f..06a4522f4 100644 --- a/FS/FS/cust_main/Search.pm +++ b/FS/FS/cust_main/Search.pm @@ -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*$/ ) @@ -658,6 +667,21 @@ sub search { push @where, "cust_main.custbatch = '$1'"; } + + if ( $params->{'tagnum'} ) { + my @tagnums = ref( $params->{'tagnum'} ) ? @{ $params->{'tagnum'} } : ( $params->{'tagnum'} ); + + @tagnums = grep /^(\d+)$/, @tagnums; + + if ( @tagnums ) { + my $tags_where = "0 < (select count(1) from cust_tag where " + . " cust_tag.custnum = cust_main.custnum and tagnum in (" + . join(',', @tagnums) . "))"; + + push @where, $tags_where; + } + } + ## # setup queries, subs, etc. for the search