From d0ccab3fd755d1f3b81b8cfc27e99665ee3f20ec Mon Sep 17 00:00:00 2001 From: Christopher Burger Date: Fri, 24 May 2019 10:51:08 -0400 Subject: [PATCH] RT# 77532 - can search cust main phone numbers in advanced customer search Conflicts: httemplate/search/cust_main.html httemplate/search/report_cust_main.html --- FS/FS/cust_main/Search.pm | 15 +++++++++++++ httemplate/search/cust_main.html | 1 + httemplate/search/elements/cust_main_phones.html | 27 ++++++++++++++++++++++++ httemplate/search/report_cust_main.html | 2 ++ 4 files changed, 45 insertions(+) create mode 100644 httemplate/search/elements/cust_main_phones.html diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm index fcb3efc3b..8073ce102 100644 --- a/FS/FS/cust_main/Search.pm +++ b/FS/FS/cust_main/Search.pm @@ -791,6 +791,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 ### diff --git a/httemplate/search/cust_main.html b/httemplate/search/cust_main.html index 62e4a2706..4d5d18fe8 100755 --- a/httemplate/search/cust_main.html +++ b/httemplate/search/cust_main.html @@ -51,6 +51,7 @@ my %search_hash = (); my @scalars = qw ( agentnum salesnum status address city county state zip country location_history + daytime night mobile paydate_year paydate_month invoice_terms no_censustract with_geocode with_email tax no_tax POST no_POST custbatch usernum diff --git a/httemplate/search/elements/cust_main_phones.html b/httemplate/search/elements/cust_main_phones.html new file mode 100644 index 000000000..de62119f9 --- /dev/null +++ b/httemplate/search/elements/cust_main_phones.html @@ -0,0 +1,27 @@ + + <% mt('Phones') |h %> + + + +% foreach my $phone (qw(daytime night mobile)) { + + +% } + +
+ +
<% mt($phone_label{$phone}) |h %> +
 
+ + +<%init> +my %phone_label = ( + daytime => 'Day Phone', + night => 'Night Phone', + mobile => 'Mobile Phone', +); + \ No newline at end of file diff --git a/httemplate/search/report_cust_main.html b/httemplate/search/report_cust_main.html index 47d46e1cd..18b0fd1e5 100755 --- a/httemplate/search/report_cust_main.html +++ b/httemplate/search/report_cust_main.html @@ -223,6 +223,8 @@ + <& elements/cust_main_phones.html &> +   -- 2.11.0