summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FS/FS/Report/FCC_477.pm83
-rw-r--r--FS/FS/cust_pkg.pm12
-rwxr-xr-xhttemplate/search/477partVI_census.html14
-rwxr-xr-xhttemplate/search/cust_pkg.cgi3
4 files changed, 102 insertions, 10 deletions
diff --git a/FS/FS/Report/FCC_477.pm b/FS/FS/Report/FCC_477.pm
index 453cf8dd8..582ddbee4 100644
--- a/FS/FS/Report/FCC_477.pm
+++ b/FS/FS/Report/FCC_477.pm
@@ -1,12 +1,12 @@
package FS::Report::FCC_477;
+use base qw( FS::Report );
use strict;
-use vars qw( @ISA @upload @download @technology @part2aoption @part2boption );
-use FS::Report;
+use vars qw( @upload @download @technology @part2aoption @part2boption
+ %states
+ );
use FS::Record qw( dbh );
-@ISA = qw( FS::Report );
-
=head1 NAME
FS::Report::FCC_477 - Routines for FCC Form 477 reports
@@ -77,6 +77,70 @@ Documentation.
'other broadband',
);
+#from the select at http://www.ffiec.gov/census/default.aspx
+%states = (
+ '01' => 'ALABAMA (AL)',
+ '02' => 'ALASKA (AK)',
+ '04' => 'ARIZONA (AZ)',
+ '05' => 'ARKANSAS (AR)',
+ '06' => 'CALIFORNIA (CA)',
+ '08' => 'COLORADO (CO)',
+
+ '09' => 'CONNECTICUT (CT)',
+ '10' => 'DELAWARE (DE)',
+ '11' => 'DISTRICT OF COLUMBIA (DC)',
+ '12' => 'FLORIDA (FL)',
+ '13' => 'GEORGIA (GA)',
+ '15' => 'HAWAII (HI)',
+
+ '16' => 'IDAHO (ID)',
+ '17' => 'ILLINOIS (IL)',
+ '18' => 'INDIANA (IN)',
+ '19' => 'IOWA (IA)',
+ '20' => 'KANSAS (KS)',
+ '21' => 'KENTUCKY (KY)',
+
+ '22' => 'LOUISIANA (LA)',
+ '23' => 'MAINE (ME)',
+ '24' => 'MARYLAND (MD)',
+ '25' => 'MASSACHUSETTS (MA)',
+ '26' => 'MICHIGAN (MI)',
+ '27' => 'MINNESOTA (MN)',
+
+ '28' => 'MISSISSIPPI (MS)',
+ '29' => 'MISSOURI (MO)',
+ '30' => 'MONTANA (MT)',
+ '31' => 'NEBRASKA (NE)',
+ '32' => 'NEVADA (NV)',
+ '33' => 'NEW HAMPSHIRE (NH)',
+
+ '34' => 'NEW JERSEY (NJ)',
+ '35' => 'NEW MEXICO (NM)',
+ '36' => 'NEW YORK (NY)',
+ '37' => 'NORTH CAROLINA (NC)',
+ '38' => 'NORTH DAKOTA (ND)',
+ '39' => 'OHIO (OH)',
+
+ '40' => 'OKLAHOMA (OK)',
+ '41' => 'OREGON (OR)',
+ '42' => 'PENNSYLVANIA (PA)',
+ '44' => 'RHODE ISLAND (RI)',
+ '45' => 'SOUTH CAROLINA (SC)',
+ '46' => 'SOUTH DAKOTA (SD)',
+
+ '47' => 'TENNESSEE (TN)',
+ '48' => 'TEXAS (TX)',
+ '49' => 'UTAH (UT)',
+ '50' => 'VERMONT (VT)',
+ '51' => 'VIRGINIA (VA)',
+ '53' => 'WASHINGTON (WA)',
+
+ '54' => 'WEST VIRGINIA (WV)',
+ '55' => 'WISCONSIN (WI)',
+ '56' => 'WYOMING (WY)',
+ '72' => 'PUERTO RICO (PR)',
+);
+
sub restore_fcc477map {
my $key = shift;
FS::Record::scalar_sql('',"select formvalue from fcc477map where formkey = ?",$key);
@@ -113,4 +177,15 @@ sub parse_technology_option {
return (@result);
}
+sub statenum2state {
+ my $num = shift;
+ $states{$num};
+}
+
+#sub statenum2abbr {
+# my $num = shift;
+# $states{$num} =~ /\((\w\w)\)$/ or return '';
+# $1;
+#}
+
1;
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index 64a8a3a9f..468e0ebc6 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -3042,6 +3042,18 @@ sub search {
}
###
+ # parse censustract2
+ ###
+ if ( exists($params->{'censustract2'}) =~ /^(\d*)$/ ) {
+ if ($1) {
+ push @where, "cust_main.censustract LIKE '$1%'";
+ } else {
+ push @where,
+ "( cust_main.censustract = '' OR cust_main.censustract IS NULL )";
+ }
+ }
+
+ ###
# parse part_pkg
###
diff --git a/httemplate/search/477partVI_census.html b/httemplate/search/477partVI_census.html
index 53b6db062..fc260bef8 100755
--- a/httemplate/search/477partVI_census.html
+++ b/httemplate/search/477partVI_census.html
@@ -31,10 +31,10 @@
'fields' => [
sub { my $row = shift;
$state_hash{substr($row->censustract, 0, 2)}++;
- substr($row->censustract, 2, 3) || 'none'
+ substr($row->censustract, 2, 3) || 'None'
},
sub { my $row = shift;
- substr($row->censustract, 5) || 'none'
+ substr($row->censustract, 5) || 'None'
},
'upload',
'download',
@@ -149,9 +149,13 @@ my $html_foot = sub {
'<BR><B>WARNING: multiple states found</B><BR>'.
'<TABLE BORDER=0>'. #nicer formatting someday
join('', map { '<TR>'.
- "<TD>$_</TD>".
- qq(<TD><A HREF="${link}state=$_">).
- $state_hash{$_}. '</A></TD>'.
+ '<TD>'.
+ ( &FS::Report::FCC_477::statenum2state($_) || 'None' ).
+ '</TD>'.
+ '<TD>'.
+ qq(<A HREF="${link}censustract2=$_">).
+ $state_hash{$_}. ' census tracts</A>'.
+ '</TD>'.
'</TR>';
}
keys %state_hash
diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi
index d48ba1916..09b52d76b 100755
--- a/httemplate/search/cust_pkg.cgi
+++ b/httemplate/search/cust_pkg.cgi
@@ -154,7 +154,8 @@ for (qw( pkgpart classnum )) {
$search_hash{$_} = [ $cgi->param($_) ];
}
-for my $param ( qw(censustract) ) {
+#scalars that need to be passed if empty
+for my $param (qw(censustract censustract2 )) {
$search_hash{$param} = $cgi->param($param) || ''
if ( grep { /$param/ } $cgi->param );
}