diff options
-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 e02114016..14dd4b469 100644 --- a/FS/FS/cust_main/Search.pm +++ b/FS/FS/cust_main/Search.pm @@ -695,6 +695,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 ## @@ -714,6 +729,7 @@ sub search { SELECT 1 FROM cust_location WHERE cust_location.custnum = cust_main.custnum AND (".join(' OR ',@orwhere).") + $current )"; } } @@ -727,6 +743,7 @@ sub search { SELECT 1 FROM cust_location WHERE cust_location.custnum = cust_main.custnum AND cust_location.city = $city + $current )"; } @@ -739,6 +756,7 @@ sub search { SELECT 1 FROM cust_location WHERE cust_location.custnum = cust_main.custnum AND cust_location.county = $county + $current )"; } @@ -751,6 +769,7 @@ sub search { SELECT 1 FROM cust_location WHERE cust_location.custnum = cust_main.custnum AND cust_location.state = $state + $current )"; } @@ -763,6 +782,7 @@ sub search { SELECT 1 FROM cust_location WHERE cust_location.custnum = cust_main.custnum AND cust_location.zip LIKE $zip + $current )"; } @@ -775,6 +795,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 4de2faa00..bcb5176bc 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -5079,6 +5079,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 672c20174..1aa3390cb 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 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 b6be023f6..69bbe8538 100755 --- a/httemplate/search/report_cust_main.html +++ b/httemplate/search/report_cust_main.html @@ -197,6 +197,10 @@ </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> |