diff options
author | Ivan Kohler <ivan@freeside.biz> | 2017-08-26 14:17:55 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2017-08-26 14:17:55 -0700 |
commit | 6145063b291a18aa9699295d373ccefad627f12e (patch) | |
tree | d921c2d606187047bff602f1cc6bf5dc64cf8945 | |
parent | aea440fb2771e2a79fc565ae0ab5f78c086e2750 (diff) |
referral count search, RT#75757
-rw-r--r-- | FS/FS/cust_main/Search.pm | 6 | ||||
-rwxr-xr-x | httemplate/search/report_cust_main.html | 7 |
2 files changed, 10 insertions, 3 deletions
diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm index e69e5f22d..6d7a9b218 100644 --- a/FS/FS/cust_main/Search.pm +++ b/FS/FS/cust_main/Search.pm @@ -884,10 +884,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 )"; } ## diff --git a/httemplate/search/report_cust_main.html b/httemplate/search/report_cust_main.html index 81d5d5891..54e1bb6e3 100755 --- a/httemplate/search/report_cust_main.html +++ b/httemplate/search/report_cust_main.html @@ -344,6 +344,13 @@ <TH ALIGN="right" VALIGN="center"><% mt('Search historical addresses') %></TH> <TD><INPUT TYPE="checkbox" NAME="location_history" VALUE="1"></TD> + <& /elements/tr-input-text.html, + label => emt('At least this many referrals'), + field => 'with_referrals', + size => 4, + maxlength => 4, + &> + </TABLE> <BR> |