diff options
author | Ivan Kohler <ivan@freeside.biz> | 2016-11-16 17:11:47 -0800 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2016-11-16 17:11:47 -0800 |
commit | a36d5bbb21a67515e6560547669bd80fc2b3a8d9 (patch) | |
tree | feb91036cd4979388c3c0888af06975ff9370089 | |
parent | ac15bb65127bdb70398d4043a314b98eb1877fcd (diff) |
when searching locaitons, don't search historic locations by default, RT#73412
-rw-r--r-- | FS/FS/cust_main/Search.pm | 21 | ||||
-rw-r--r-- | FS/FS/cust_pkg.pm | 11 | ||||
-rwxr-xr-x | httemplate/search/cust_main.html | 3 | ||||
-rwxr-xr-x | httemplate/search/report_cust_main.html | 4 |
4 files changed, 38 insertions, 1 deletions
diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm index 66b73dd..677a3e5 100644 --- a/FS/FS/cust_main/Search.pm +++ b/FS/FS/cust_main/Search.pm @@ -701,6 +701,21 @@ sub search { push @where, FS::cust_main->$method(); } + my $current = ''; + unless ( $params->{location_history} ) { + $current = ' + AND ( cust_location.locationnum IN ( cust_main.bill_locationnum, + cust_main.ship_locationnum + ) + OR cust_location.locationnum IN ( + SELECT locationnum FROM cust_pkg + WHERE cust_pkg.custnum = cust_main.custnum + AND locationnum IS NOT NULL + AND '. FS::cust_pkg->ncancelled_recurring_sql.' + ) + )'; + } + ## # address ## @@ -720,6 +735,7 @@ sub search { SELECT 1 FROM cust_location WHERE cust_location.custnum = cust_main.custnum AND (".join(' OR ',@orwhere).") + $current )"; } } @@ -733,6 +749,7 @@ sub search { SELECT 1 FROM cust_location WHERE cust_location.custnum = cust_main.custnum AND cust_location.city = $city + $current )"; } @@ -745,6 +762,7 @@ sub search { SELECT 1 FROM cust_location WHERE cust_location.custnum = cust_main.custnum AND cust_location.county = $county + $current )"; } @@ -757,6 +775,7 @@ sub search { SELECT 1 FROM cust_location WHERE cust_location.custnum = cust_main.custnum AND cust_location.state = $state + $current )"; } @@ -769,6 +788,7 @@ sub search { SELECT 1 FROM cust_location WHERE cust_location.custnum = cust_main.custnum AND cust_location.zip LIKE $zip + $current )"; } @@ -781,6 +801,7 @@ sub search { SELECT 1 FROM cust_location WHERE cust_location.custnum = cust_main.custnum AND cust_location.country = '$country' + $current )"; } diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index b5506f6..ee9afa3 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -5042,6 +5042,17 @@ sub cancel_sql { "cust_pkg.cancel IS NOT NULL AND cust_pkg.cancel != 0"; } +=item ncancelled_recurring_sql + +Returns an SQL expression identifying un-cancelled, recurring packages. + +=cut + +sub ncancelled_recurring_sql { + $_[0]->recurring_sql(). + " AND ( cust_pkg.cancel IS NULL OR cust_pkg.cancel = 0 ) "; +} + =item status_sql Returns an SQL expression to give the package status as a string. diff --git a/httemplate/search/cust_main.html b/httemplate/search/cust_main.html index 503e782..040d6c3 100755 --- a/httemplate/search/cust_main.html +++ b/httemplate/search/cust_main.html @@ -41,7 +41,8 @@ my %search_hash = (); #scalars my @scalars = qw ( - agentnum salesnum status address city county state zip country + agentnum salesnum status + address city county state zip country location_history paydate_year paydate_month invoice_terms no_censustract with_geocode with_email tax no_tax POST no_POST custbatch usernum diff --git a/httemplate/search/report_cust_main.html b/httemplate/search/report_cust_main.html index f029ea6..81d5d58 100755 --- a/httemplate/search/report_cust_main.html +++ b/httemplate/search/report_cust_main.html @@ -340,6 +340,10 @@ <TD><INPUT TYPE="checkbox" NAME="cancelled_pkgs"></TD> </TR> + <TR> + <TH ALIGN="right" VALIGN="center"><% mt('Search historical addresses') %></TH> + <TD><INPUT TYPE="checkbox" NAME="location_history" VALUE="1"></TD> + </TABLE> <BR> |