summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/Conf.pm2
-rw-r--r--FS/FS/cust_main/Search.pm26
2 files changed, 19 insertions, 9 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index baca21dbd..16bbaad60 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -4044,7 +4044,7 @@ and customer address. Include units.',
'type' => 'select',
'multiple' => 1,
'select_hash' => [
- #'address1' => 'Billing address',
+ 'address' => 'Billing or service address',
],
},
diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm
index f14f897ea..182527ff9 100644
--- a/FS/FS/cust_main/Search.pm
+++ b/FS/FS/cust_main/Search.pm
@@ -610,14 +610,24 @@ sub search {
##
# address
##
- if ( $params->{'address'} =~ /\S/ ) {
- my $address = dbh->quote('%'. lc($params->{'address'}). '%');
- push @where, "EXISTS(
- SELECT 1 FROM cust_location
- WHERE cust_location.custnum = cust_main.custnum
- AND (LOWER(cust_location.address1) LIKE $address OR
- LOWER(cust_location.address2) LIKE $address)
- )";
+ if ( $params->{'address'} ) {
+ # allow this to be an arrayref
+ my @values = ($params->{'address'});
+ @values = @{$values[0]} if ref($values[0]);
+ my @orwhere;
+ foreach (grep /\S/, @values) {
+ my $address = dbh->quote('%'. lc($_). '%');
+ push @orwhere,
+ "LOWER(cust_location.address1) LIKE $address",
+ "LOWER(cust_location.address2) LIKE $address";
+ }
+ if (@orwhere) {
+ push @where, "EXISTS(
+ SELECT 1 FROM cust_location
+ WHERE cust_location.custnum = cust_main.custnum
+ AND (".join(' OR ',@orwhere).")
+ )";
+ }
}
##