summaryrefslogtreecommitdiff
path: root/FS/FS/cust_main/Search.pm
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2012-07-29 17:57:24 -0700
committerMark Wells <mark@freeside.biz>2012-07-29 17:57:24 -0700
commitf578e57b593adb9254b2e465c73116a0e0e617b5 (patch)
treeb31d14a998f7b81bca8932462deeea1447144afb /FS/FS/cust_main/Search.pm
parent7b6434395ecdbf8013309d22564b146736d6e927 (diff)
update customer list and zip code report to use cust_location, #940
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 b213bbcbe..2d347e140 100644
--- a/FS/FS/cust_main/Search.pm
+++ b/FS/FS/cust_main/Search.pm
@@ -457,6 +457,8 @@ HASHREF. Valid parameters are
=item address
+=item zip
+
=item refnum
=item cancelled_pkgs
@@ -516,6 +518,7 @@ sub search {
'usernum' => '',
'status' => '',
'address' => '',
+ 'zip' => '',
'paydate_year' => '',
'invoice_terms' => '',
'custbatch' => '',
@@ -578,6 +581,18 @@ sub search {
)";
}
+ ##
+ # zipcode
+ ##
+ if ( $params->{'zip'} =~ /\S/ ) {
+ my $zip = dbh->quote($params->{'zip'} . '%');
+ push @where, "EXISTS(
+ SELECT 1 FROM cust_location
+ WHERE cust_location.custnum = cust_main.custnum
+ AND cust_location.zip LIKE $zip
+ )";
+ }
+
###
# refnum
###