[freeside-commits] branch FREESIDE_3_BRANCH updated. c742a74ec444c4606006a14e814d06e0b1795ea4
Ivan
ivan at 420.am
Sat Aug 26 15:01:24 PDT 2017
The branch, FREESIDE_3_BRANCH has been updated
via c742a74ec444c4606006a14e814d06e0b1795ea4 (commit)
from 6145063b291a18aa9699295d373ccefad627f12e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit c742a74ec444c4606006a14e814d06e0b1795ea4
Author: Ivan Kohler <ivan at freeside.biz>
Date: Sat Aug 26 15:01:21 2017 -0700
referral status search, RT#75757
diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm
index 6d7a9b2..7d0e43d 100644
--- a/FS/FS/cust_main/Search.pm
+++ b/FS/FS/cust_main/Search.pm
@@ -884,10 +884,24 @@ sub search {
##
# with referrals
##
- if ( $params->{'with_referrals'} =~ /^\s*(\d+)\s*$/ ) {
+ if ( $params->{with_referrals} =~ /^\s*(\d+)\s*$/ ) {
+
+ my $n = $1;
+
+ # referral status
+ my $and_status = '';
+ if ( grep { $params->{referral_status} eq $_ } FS::cust_main->statuses() ) {
+ my $method = $params->{referral_status}. '_sql';
+ $and_status = ' AND '. FS::cust_main->$method();
+ $and_status =~ s/ cust_main\./ referred_cust_main./g;
+ }
+
push @where,
- " $1 <= ( SELECT COUNT(*) FROM cust_main AS referred_cust_main
- WHERE cust_main.custnum = referred_cust_main.referral_custnum )";
+ " $n <= ( SELECT COUNT(*) FROM cust_main AS referred_cust_main
+ WHERE cust_main.custnum = referred_cust_main.referral_custnum
+ $and_status
+ )";
+
}
##
diff --git a/httemplate/search/cust_main.html b/httemplate/search/cust_main.html
index 0743829..7729da4 100755
--- a/httemplate/search/cust_main.html
+++ b/httemplate/search/cust_main.html
@@ -55,7 +55,7 @@ my @scalars = qw (
all_tags
all_pkg_classnums
any_pkg_status
- with_referrals
+ with_referrals referral_status
);
for my $param ( @scalars ) {
diff --git a/httemplate/search/report_cust_main.html b/httemplate/search/report_cust_main.html
index 54e1bb6..e1ce26d 100755
--- a/httemplate/search/report_cust_main.html
+++ b/httemplate/search/report_cust_main.html
@@ -113,6 +113,25 @@
<TH CLASS="background" COLSPAN=2> </TH>
</TR>
<TR>
+ <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1"><% mt('Referral search options') |h %></FONT></TH>
+ </TR>
+
+ <& /elements/tr-input-text.html,
+ label => emt('At least this many'),
+ field => 'with_referrals',
+ size => 4,
+ maxlength => 4,
+ &>
+
+ <& /elements/tr-select-cust_main-status.html,
+ label => emt('Referral status'),
+ field => 'referral_status',
+ &>
+
+ <TR>
+ <TH CLASS="background" COLSPAN=2> </TH>
+ </TR>
+ <TR>
<TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1"><% mt('Package search options') |h %></FONT></TH>
</TR>
@@ -344,13 +363,6 @@
<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>
-----------------------------------------------------------------------
Summary of changes:
FS/FS/cust_main/Search.pm | 20 +++++++++++++++++---
httemplate/search/cust_main.html | 2 +-
httemplate/search/report_cust_main.html | 26 +++++++++++++++++++-------
3 files changed, 37 insertions(+), 11 deletions(-)
More information about the freeside-commits
mailing list