summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2022-02-27 16:59:24 -0800
committerIvan Kohler <ivan@freeside.biz>2022-02-27 16:59:24 -0800
commit8e2aeb1581a89359b92b5d81f42254490af069d2 (patch)
treea94ac9def8fd8e7a2d232c922b0c4d3f3ff98a69
parent7b5cd538a10c11fc25fe221381a2973463c3819f (diff)
search for missing/outdated census tract, RT#86245
-rw-r--r--FS/FS/cust_main/Search.pm14
-rw-r--r--httemplate/elements/menu.html2
2 files changed, 16 insertions, 0 deletions
diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm
index a12846c1c..46d1bc6e1 100644
--- a/FS/FS/cust_main/Search.pm
+++ b/FS/FS/cust_main/Search.pm
@@ -792,6 +792,20 @@ sub search {
}
##
+ # no_censustract
+ ##
+ if ( $params->{'no_censustract'} ) {
+ push @where, "EXISTS(
+ SELECT 1 FROM cust_location
+ WHERE locationnum = cust_main.ship_locationnum
+ AND cust_location.country = 'US'
+ AND ( cust_location.censusyear IS NULL
+ OR cust_location.censusyear != '2020'
+ )
+ )";
+ }
+
+ ##
# phones
##
diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html
index 0c159951d..7f809bcae 100644
--- a/httemplate/elements/menu.html
+++ b/httemplate/elements/menu.html
@@ -129,6 +129,8 @@ $report_customers_lists{'by active trouble tickets'} = [ $fsurl. 'search/cust_ma
if $conf->config('ticket_system');
$report_customers_lists{'with USPS-unvalidated addresses'} = [ $fsurl. 'search/cust_main.cgi?browse=uspsunvalid', '' ]
if $conf->config('usps_webtools-userid') && $conf->config('usps_webtools-password');
+$report_customers_lists{'with missing/outdated census tract'} = [ $fsurl. 'search/cust_main.html?no_censustract=1', '' ]
+ if $conf->config('usps_webtools-userid') && $conf->config('usps_webtools-password');
$report_customers_lists{'with referrals'} = [ $fsurl. 'search/cust_main.html?with_referrals=1' ];
tie my %report_customers, 'Tie::IxHash';