[freeside-commits] branch master updated. b3cecd1976e92c32740c3e2e1227a7d718e07b57

Mark Wells mark at 420.am
Fri Apr 11 18:34:20 PDT 2014


The branch, master has been updated
       via  b3cecd1976e92c32740c3e2e1227a7d718e07b57 (commit)
      from  bd4e387da29dc3dad44605572d531ab4f7ab4f4d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b3cecd1976e92c32740c3e2e1227a7d718e07b57
Author: Mark Wells <mark at freeside.biz>
Date:   Fri Apr 11 15:12:22 2014 -0700

    477 report, XML adjustments, #28020

diff --git a/httemplate/search/477.html b/httemplate/search/477.html
index 3e7888c..ecf21cf 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 aa73811..97f8ac0 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 467b19c..7ccee69 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 ce1ac03f..bd56ecc 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 5f77081..2ffad2a 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 b4f6ddc..2f3cf41 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 50b1916..18bfe8d 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] } ) ) {

-----------------------------------------------------------------------

Summary of changes:
 httemplate/search/477.html                 |    6 +++++-
 httemplate/search/477partIA.html           |    1 -
 httemplate/search/477partIIA.html          |    4 +---
 httemplate/search/477partIIB.html          |    7 +++++--
 httemplate/search/477partV.html            |    4 ++--
 httemplate/search/477partVI_census.html    |    3 +--
 httemplate/search/elements/search-xml.html |    6 ++++--
 7 files changed, 18 insertions(+), 13 deletions(-)




More information about the freeside-commits mailing list