summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2014-04-11 15:12:22 -0700
committerMark Wells <mark@freeside.biz>2014-04-11 15:12:22 -0700
commitb3cecd1976e92c32740c3e2e1227a7d718e07b57 (patch)
tree57972f0650b8cca5c45d17f70016962f6b844bf5 /httemplate
parentbd4e387da29dc3dad44605572d531ab4f7ab4f4d (diff)
477 report, XML adjustments, #28020
Diffstat (limited to 'httemplate')
-rwxr-xr-xhttemplate/search/477.html6
-rwxr-xr-xhttemplate/search/477partIA.html1
-rwxr-xr-xhttemplate/search/477partIIA.html4
-rwxr-xr-xhttemplate/search/477partIIB.html7
-rwxr-xr-xhttemplate/search/477partV.html4
-rwxr-xr-xhttemplate/search/477partVI_census.html3
-rw-r--r--httemplate/search/elements/search-xml.html6
7 files changed, 18 insertions, 13 deletions
diff --git a/httemplate/search/477.html b/httemplate/search/477.html
index 3e7888c40..ecf21cfb1 100755
--- a/httemplate/search/477.html
+++ b/httemplate/search/477.html
@@ -1,4 +1,7 @@
% if ( $type eq 'xml' ) {
+% $filename = "fcc_477_$state" . '_' . time2str('%Y%m%d', $date) . '.xml';
+% http_header('Content-Type' => 'application/XML' ); # So saith RFC 4180
+% http_header('Content-Disposition' => 'attachment;filename="'.$filename.'"');
<?xml version="1.0" encoding="ISO-8859-1"?>
<Form_477_submission xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://specialreports.fcc.gov/wcb/Form477/XMLSchema-instance/form_477_upload_Schema.xsd" >
% } else { #html
@@ -64,6 +67,7 @@
<& "477part${part}.html",
'url' => $url,
'date' => $date,
+ 'filename' => $filename,
&>
% if ( $type eq 'xml' ) {
</<% 'Part_'. $part %>>
@@ -92,7 +96,7 @@ $state =~ /^[A-Z]{2}$/ or die "illegal state: $state";
my %part = map { $_ => 1 } grep { /^\w+$/ } $cgi->param('part');
my $type = $cgi->param('_type') || 'html';
-my $xlsname = '477report';
+my $filename;
my @technology_option = &FS::Report::FCC_477::parse_technology_option($cgi,1);
# save upload and download mappings
diff --git a/httemplate/search/477partIA.html b/httemplate/search/477partIA.html
index aa7381139..97f8ac0aa 100755
--- a/httemplate/search/477partIA.html
+++ b/httemplate/search/477partIA.html
@@ -118,7 +118,6 @@ my $percentages = ($technology eq 'Terrestrial Mobile Wireless');
# So we count packages that were in active status as of the specified date,
# not over any sort of range.
$search_hash{'active'} = [ $opt{date}, $opt{date} ];
-warn Dumper \%search_hash;
my $query = FS::cust_pkg->search(\%search_hash);
my $count_query = $query->{'count_query'};
diff --git a/httemplate/search/477partIIA.html b/httemplate/search/477partIIA.html
index 467b19c5f..7ccee6928 100755
--- a/httemplate/search/477partIIA.html
+++ b/httemplate/search/477partIIA.html
@@ -2,11 +2,9 @@
% my @cols = qw(a b c d);
% for ( my $row = 0; $row < scalar(@rows); $row++ ) {
% for my $col (0..3) {
-% if ( exists($data[$col][$row]) and $data[$col][$row] > 0 ) {
<PartII_<% $row + 1 %><% $cols[$col] %>>\
-<% $data[$col][$row] %>\
+<% $data[$col][$row] || 0 %>\
</PartII_<% $row + 1 %><% $cols[$col] %>>
-% }
% } #for $col
% } #for $row
% } else { # HTML mode
diff --git a/httemplate/search/477partIIB.html b/httemplate/search/477partIIB.html
index ce1ac03f0..bd56ecc60 100755
--- a/httemplate/search/477partIIB.html
+++ b/httemplate/search/477partIIB.html
@@ -118,11 +118,14 @@ foreach (@col_conds) {
if ( $row == 0 ) {
$col_data[$row] = $count; # the raw count
} else {
+ # the rows that are percentages of the raw count
if ( $col_data[0] == 0 ) {
- $col_data[$row] = ''; # show nothing in this row, then
+ # 0 out of 0 is not 0%, but supposedly this works
+ $col_data[$row] = '0.000';
} else {
- $col_data[$row] = sprintf('%.3f', 100 * $count / $col_data[0]) . '%';
+ $col_data[$row] = sprintf('%.3f', 100 * $count / $col_data[0]);
}
+ $col_data[$row] .= '%' unless $cgi->param('_type') eq 'xml';
} #if $row == 0
$row++;
}
diff --git a/httemplate/search/477partV.html b/httemplate/search/477partV.html
index 5f7708140..2ffad2a27 100755
--- a/httemplate/search/477partV.html
+++ b/httemplate/search/477partV.html
@@ -1,5 +1,5 @@
% if ( $cgi->param('_type') =~ /^xml$/ ) {
-<zip_code>
+<zip_codes>
% }
<& elements/search.html,
'html_init' => $html_init,
@@ -18,7 +18,7 @@
&>
% if ( $cgi->param('_type') =~ /^xml$/ ) {
-</zip_code>
+</zip_codes>
% }
<%init>
diff --git a/httemplate/search/477partVI_census.html b/httemplate/search/477partVI_census.html
index b4f6ddc01..2f3cf419a 100755
--- a/httemplate/search/477partVI_census.html
+++ b/httemplate/search/477partVI_census.html
@@ -24,7 +24,7 @@
'url' => $opt{url} || '',
'xml_row_element' => 'Datarow',
'really_disable_download' => 1,
-
+ 'filename' => $opt{filename},
&>
<%init>
@@ -117,7 +117,6 @@ foreach my $row ( @row_option ) {
($report_option ? ( 'report_option' => $report_option ) : () ),
}
);
-warn Dumper($sql_query) if $rowcount==1 and $columncount==3;
my $extracolumns = "$rowcount AS upload, $columncount AS download, $tech_code as technology_code";
my $percent = "CASE WHEN count(*) > 0 THEN 100-100*cast(count(cust_main.company) as numeric)/cast(count(*) as numeric) ELSE cast(0 as numeric) END AS residential";
$sql_query->{select} = "count(*) AS quantity, $extracolumns, cust_location.censustract, $percent";
diff --git a/httemplate/search/elements/search-xml.html b/httemplate/search/elements/search-xml.html
index 50b191610..18bfe8d82 100644
--- a/httemplate/search/elements/search-xml.html
+++ b/httemplate/search/elements/search-xml.html
@@ -32,9 +32,11 @@ my $header = $args{'header'};
my $rows = $args{'rows'};
my %opt = %{ $args{'opt'} };
+my $filename = $opt{'filename'} ||
+ ($opt{'name'} || PL($opt{'name_singular'}) . 'xml');
+
http_header('Content-Type' => 'application/XML' ); # So saith RFC 4180
-http_header('Content-Disposition' =>
- 'attachment;filename="'.($opt{'name'} || PL($opt{'name_singular'}) ).'.xml"');
+http_header('Content-Disposition' => 'attachment;filename="'.$filename.'"');
unless ( $opt{'fields'} ) {
foreach my $i ( 0 .. ( $#{ @$rows[0] } ) ) {