search for missing/outdated census tract, RT#86245
authorIvan Kohler <ivan@freeside.biz>
Mon, 28 Feb 2022 00:59:18 +0000 (16:59 -0800)
committerIvan Kohler <ivan@freeside.biz>
Mon, 28 Feb 2022 00:59:18 +0000 (16:59 -0800)
FS/FS/cust_main/Search.pm
httemplate/elements/menu.html

index 25216c6..37b8ec8 100644 (file)
@@ -790,6 +790,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
   ##
 
   # phones
   ##
 
index f6fc254..c0f3245 100644 (file)
@@ -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');
   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';
 $report_customers_lists{'with referrals'} = [ $fsurl. 'search/cust_main.html?with_referrals=1' ];
 
 tie my %report_customers, 'Tie::IxHash';