summaryrefslogtreecommitdiff
path: root/FS/FS/cust_main/Search.pm
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2017-08-26 14:17:54 -0700
committerIvan Kohler <ivan@freeside.biz>2017-08-26 14:17:54 -0700
commitbfb7b46876ec9b25c4ccdd862a7b5868efac9675 (patch)
treee1522ad934e6729ee09cba6b6e616e282785c838 /FS/FS/cust_main/Search.pm
parentdc4563f6529ffbc7eab505e430cff956d13c5602 (diff)
referral count search, RT#75757
Diffstat (limited to 'FS/FS/cust_main/Search.pm')
-rw-r--r--FS/FS/cust_main/Search.pm6
1 files changed, 3 insertions, 3 deletions
diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm
index d668094..09558b8 100644
--- a/FS/FS/cust_main/Search.pm
+++ b/FS/FS/cust_main/Search.pm
@@ -872,10 +872,10 @@ sub search {
##
# with referrals
##
- if ( $params->{'with_referrals'} ) {
+ if ( $params->{'with_referrals'} =~ /^\s*(\d+)\s*$/ ) {
push @where,
- ' EXISTS ( SELECT 1 FROM cust_main AS referred_cust_main
- WHERE cust_main.custnum = referred_cust_main.referral_custnum )';
+ " $1 <= ( SELECT COUNT(*) FROM cust_main AS referred_cust_main
+ WHERE cust_main.custnum = referred_cust_main.referral_custnum )";
}
##