sub email_search {
my %options = @_;
- local($DEBUG) = 1;
-
my $email = delete $options{'email'};
- #we're only being used by RT at the moment... no agent virtualization yet
+ #no agent virtualization yet
#my $agentnums_sql = $FS::CurrentUser::CurrentUser->agentnums_sql;
my @cust_main = ();
}
}
+ ##
+ # city
+ ##
+ if ( $params->{'city'} =~ /\S/ ) {
+ my $city = dbh->quote($params->{'city'});
+ push @where, "EXISTS(
+ SELECT 1 FROM cust_location
+ WHERE cust_location.custnum = cust_main.custnum
+ AND cust_location.city = $city
+ )";
+ }
+
##
# county
##
'ON (cust_main.'.$pre.'locationnum = '.$pre.'location.locationnum) ';
}
+ # always make referral available in results
+ # (maybe we should be using FS::UI::Web::join_cust_main instead?)
+ $addl_from .= ' LEFT JOIN (select refnum, referral from part_referral) AS part_referral_x ON (cust_main.refnum = part_referral_x.refnum) ';
+
my $count_query = "SELECT COUNT(*) FROM cust_main $addl_from $extra_sql";
my @select = (