summaryrefslogtreecommitdiff
path: root/FS/FS/cust_main/Search.pm
diff options
context:
space:
mode:
authorChristopher Burger <burgerc@freeside.biz>2019-05-24 10:51:08 -0400
committerChristopher Burger <burgerc@freeside.biz>2019-05-24 10:51:08 -0400
commit6b5dda03831aef0cb5689cf2acf3fac47e4b12cb (patch)
treee61c92299b348069140a942785f58e2c0e084ab2 /FS/FS/cust_main/Search.pm
parent562a3c85e49cd3ea8fb80e5c2fd7f4c5f60333e9 (diff)
RT# 77532 - can search cust main phone numbers in advanced customer search
Diffstat (limited to 'FS/FS/cust_main/Search.pm')
-rw-r--r--FS/FS/cust_main/Search.pm15
1 files changed, 15 insertions, 0 deletions
diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm
index 63f10fb..479ebf5 100644
--- a/FS/FS/cust_main/Search.pm
+++ b/FS/FS/cust_main/Search.pm
@@ -789,6 +789,21 @@ sub search {
)";
}
+ ##
+ # phones
+ ##
+
+ foreach my $phonet (qw(daytime night mobile)) {
+ if ($params->{$phonet}) {
+ $params->{$phonet} =~ s/\D//g;
+ $params->{$phonet} =~ /^(\d{3})(\d{3})(\d{4})(\d*)$/
+ or next;
+ my $phonen = "$1-$2-$3";
+ if ($4) { push @where, "cust_main.".$phonet." = '".$phonen." x$4'"; }
+ else { push @where, "cust_main.".$phonet." like '".$phonen."%'"; }
+ }
+ }
+
###
# refnum
###