summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2014-07-21 15:35:33 -0700
committerMark Wells <mark@freeside.biz>2014-07-21 15:35:40 -0700
commit8fdc0ea36474cfb3d1389f41691c14598559cbe7 (patch)
tree1984c9268d53df1edb76cf40575499cfb3e0d2c4 /httemplate
parent08db5f6900bb754efb597a2967adde4dbd12e731 (diff)
477 report rewrite, #28020
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/elements/tr-input-fcc_options.html89
-rw-r--r--httemplate/misc/part_pkg_fcc_options.html15
-rw-r--r--[-rwxr-xr-x]httemplate/search/477.html318
-rwxr-xr-xhttemplate/search/old477/477.html135
-rwxr-xr-xhttemplate/search/old477/477partIA.html (renamed from httemplate/search/477partIA.html)0
-rwxr-xr-xhttemplate/search/old477/477partIIA.html (renamed from httemplate/search/477partIIA.html)0
-rwxr-xr-xhttemplate/search/old477/477partIIB.html (renamed from httemplate/search/477partIIB.html)0
-rwxr-xr-xhttemplate/search/old477/477partIV.html (renamed from httemplate/search/477partIV.html)0
-rwxr-xr-xhttemplate/search/old477/477partV.html (renamed from httemplate/search/477partV.html)2
-rwxr-xr-xhttemplate/search/old477/477partVI_census.html (renamed from httemplate/search/477partVI_census.html)2
-rwxr-xr-xhttemplate/search/old477/report_477.html282
-rwxr-xr-xhttemplate/search/report_477.html279
12 files changed, 740 insertions, 382 deletions
diff --git a/httemplate/elements/tr-input-fcc_options.html b/httemplate/elements/tr-input-fcc_options.html
index bd5083075..11cb4a962 100644
--- a/httemplate/elements/tr-input-fcc_options.html
+++ b/httemplate/elements/tr-input-fcc_options.html
@@ -1,16 +1,24 @@
+<STYLE>
+ ul.fcc_options {
+ font-weight: normal;
+ text-align: left;
+ padding: 0em 1em 0em 2em;
+ }
+</STYLE>
<TR>
<TH COLSPAN=2>
<& hidden.html, 'id' => $id, @_ &>
-%# <& input-text.html, 'id' => $id, @_ &>
-%# XXX debugging
- <FONT SIZE="+1"><BUTTON TYPE="button" onclick="show_fcc_options()">
- FCC Form 477 information
- </BUTTON></FONT>
+%# <& input-text.html, 'id' => $id, @_ &> # XXX debugging
+ <UL ID="<%$id%>_display_fcc_options" CLASS="fcc_options">
+ </UL>
+ <BUTTON TYPE="button" onclick="edit_fcc_options()">
+ Edit
+ </BUTTON>
% # show some kind of useful summary of the FCC options here
</TH>
</TR>
<SCRIPT TYPE="text/javascript">
-function show_fcc_options() {
+function edit_fcc_options() {
<& popup_link_onclick.html,
'action' => $fsurl.'misc/part_pkg_fcc_options.html?id=' . $id,
'actionlabel' => 'FCC Form 477 options',
@@ -18,6 +26,75 @@ function show_fcc_options() {
'height' => 600,
&>
}
+var technology_labels = <% encode_json(FS::part_pkg_fcc_option->technology_labels) %>;
+function show_fcc_options() {
+ var curr_values = JSON.parse(document.getElementById('<% $id %>').value);
+ // hardcoded for the same reasons as misc/part_pkg_fcc_options
+ var out = '';
+ var tech = curr_values['technology'];
+ if ( tech ) {
+ if (technology_labels[tech]) {
+ tech = technology_labels[tech];
+ } else {
+ tech = 'Technology '+tech; // unknown?
+ }
+ }
+ var media = String.toLowerCase(curr_values['media'] || 'unknown media');
+ if ( curr_values['is_consumer'] ) {
+ out += '<li><strong>Consumer-grade</strong> service</li>>';
+ } else {
+ out += '<li><strong>Business-grade</strong> service</li>';
+ }
+ if ( curr_values['is_broadband'] ) {
+ out += '<li>Broadband via <strong>' + tech + '</strong>'
+ + '<li><strong>' + curr_values['broadband_downstream']
+ + 'Mbps </strong> down / '
+ + '<strong>' + curr_values['broadband_upstream']
+ + 'Mbps </strong> up</li>';
+ }
+ if ( curr_values['is_phone'] ) {
+ if ( curr_values['phone_wholesale'] ) {
+ out += '<li>Wholesale telephone</li>';
+ if ( curr_values['phone_vges'] ) {
+ out += '<li><strong>' + curr_values['phone_vges'] + '</strong>'
+ + ' switched voice-grade lines</li>';
+ }
+ if ( curr_values['phone_circuits'] ) {
+ out += '<li><strong>' + curr_values['phone_circuits'] + '</strong>'
+ + ' unswitched circuits</li>';
+ }
+ } else {
+ // enduser service
+ out += '<li>Local telephone over <strong>' + media + '</strong></li>'
+ + '<li><strong>' + curr_values['phone_lines']
+ + '</strong> voice-grade lines</li>';
+ if ( curr_values['phone_localloop'] == 'resale' ) {
+ out += '<li><strong>Resold</strong> from another carrier</li>>';
+ } else if ( curr_values['phone_localloop'] == 'leased' ) {
+ out += '<li>Using <strong>leased circuits</strong> from another carrier</li>';
+ } else if ( curr_values['phone_localloop'] == 'owned' ) {
+ out += '<li>Using <strong>our own circuits</strong></li>';
+ }
+ if ( curr_values['phone_longdistance'] ) {
+ out += '<li>Includes <strong>long-distance service</strong></li>';
+ }
+ }
+ } // is_phone
+ if ( curr_values['is_voip'] ) {
+ out += '<li><strong>VoIP</strong> telephone service</li>';
+ if ( curr_values['voip_ott'] ) {
+ out += '<li>Using a <strong>separate</strong> last-mile connection</li>';
+ } else {
+ out += '<li><strong>Including</strong> last-mile connection</li>';
+ }
+ } // is_voip
+
+ var out_ul = document.getElementById('<% $id %>_display_fcc_options');
+ out_ul.innerHTML = out;
+}
+<&| onload.js &>
+ show_fcc_options();
+</&>
</SCRIPT>
<%init>
my %opt = @_;
diff --git a/httemplate/misc/part_pkg_fcc_options.html b/httemplate/misc/part_pkg_fcc_options.html
index 1f5d4a8bf..f74328446 100644
--- a/httemplate/misc/part_pkg_fcc_options.html
+++ b/httemplate/misc/part_pkg_fcc_options.html
@@ -90,8 +90,8 @@
<& .checkbox, 'is_voip' &>
<LABEL FOR="is_voip">This package provides VoIP telephone service</LABEL>
<FIELDSET ID="voip">
- <LABEL FOR="voip_ott">Do you also provide last-mile connectivity?</LABEL>
- <& .checkbox, 'voip_ott' &>
+ <& .checkbox, 'voip_lastmile' &>
+ <LABEL FOR="voip_lastmile">Do you also provide last-mile connectivity?</LABEL>
</FIELDSET>
</P>
<DIV WIDTH="100%" STYLE="text-align:center">
@@ -103,8 +103,8 @@
// this form is invoked as a popup; the current values of the parent
// object are in the form field ID passed as the 'id' param
-var parent_id = window.parent.document.getElementById('<% $parent_id %>');
-var curr_values = JSON.parse(window.parent_id.value);
+var parent_input = window.parent.document.getElementById('<% $parent_id %>');
+var curr_values = JSON.parse(window.parent_input.value);
var form = document.forms['fcc_option_form'];
var media_types = <% encode_json($media_types) %>
var technology_labels = <% encode_json($technology_labels) %>
@@ -129,6 +129,9 @@ function save_changes() {
var form = document.forms['fcc_option_form'];
var data = {};
for (var i = 0; i < form.elements.length; i++) {
+ if (form.elements[i].type == 'submit')
+ continue;
+
// quick and dirty test for whether the element is displayed
if (form.elements[i].clientHeight > 0) {
if (form.elements[i].type == 'checkbox') {
@@ -140,7 +143,9 @@ function save_changes() {
}
}
}
- parent_id.value = JSON.stringify(data);
+ parent_input.value = JSON.stringify(data);
+ // update the display
+ parent.show_fcc_options();
parent.cClick(); //overlib
}
diff --git a/httemplate/search/477.html b/httemplate/search/477.html
index ecf21cfb1..68493377d 100755..100644
--- a/httemplate/search/477.html
+++ b/httemplate/search/477.html
@@ -1,135 +1,219 @@
-% 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
-<& /elements/header.html, "FCC Form 477 Results - $state" &>
-%# XXX when we stop supporting IE8, add this to freeside.css using :nth-child
-%# selectors, and remove it from everywhere else
+<& /elements/header.html, $title &>
<STYLE TYPE="text/css">
-.grid TH { background-color: #cccccc; padding: 0px 3px 2px; text-align: right }
-.row0 TD { background-color: #eeeeee; padding: 0px 3px 2px; text-align: right }
-.row1 TD { background-color: #ffffff; padding: 0px 3px 2px; text-align: right }
+table.fcc477part {
+ border-collapse: collapse;
+ border: 1px #777 solid;
+ margin-bottom: 20px;
+}
+table.fcc477part td {
+ padding: 0px 4px;
+ border-left: 1px #777 solid;
+ border-right: 1px #777 solid;
+}
+table.fcc477part tbody td {
+ text-align: right;
+}
+table.fcc477part thead tr.head {
+ text-align: center;
+ vertical-align: top;
+ font-weight: bold;
+ border-top: 1px #777 solid;
+ border-bottom: 1px #777 solid;
+}
+table.fcc477part thead tr.subhead {
+ text-align: center;
+ font-weight: bold;
+ font-size: small;
+ border-top: 1px #777 solid;
+ border-bottom: 1px #777 solid;
+}
+.parttitle {
+ font-weight: bold;
+ font-size: large;
+ float: left;
+}
+a.download {
+ float: right;
+}
</STYLE>
-
-<TABLE WIDTH="100%">
- <TR>
- <TD></TD>
- <TD ALIGN="right" CLASS="noprint">
- Download full results<BR>
-% $cgi->param('_type', 'xml');
- as <A HREF="<% $cgi->self_url %>">XML file</A><BR>
-
-% $cgi->param('_type', 'html-print');
- as <A HREF="<% $cgi->self_url %>">printable copy</A>
-
- </TD>
-% $cgi->param('_type', $type );
- </TR>
-</TABLE>
-% } #html
-% foreach my $part ( @parts ) {
-% if ( $part{$part} ) {
-%
-% if ( $part eq 'V' ) {
-% next unless ( $part{'IIA'} || $part{'IIB'} );
-% }
-%
-% if ( $part eq 'VI_census' ) {
-% next unless $part{'IA'};
-% }
-%
-% my @reports = ();
-% if ( $part eq 'IA' ) {
-% for ( my $tech = 0; $tech < scalar(@technology_option); $tech++ ) {
-% next unless $technology_option[$tech];
-% my $url = &{$url_mangler}($part);
-% if ( $type eq 'xml' ) {
-<<% 'Part_IA_'. chr(65 + $tech) %>>
-% }
-<& "477part${part}.html",
- 'tech_code' => $tech,
- 'url' => $url,
- 'type' => $type,
- 'date' => $date,
-&>
-% if ( $type eq 'xml' ) {
-</<% 'Part_IA_'. chr(65 + $tech) %>>
-% }
-% }
-% } else { # not part IA
-% if ( $type eq 'xml' ) {
-<<% 'Part_'. $part %>>
-% }
-% my $url = &{$url_mangler}($part);
-<& "477part${part}.html",
- 'url' => $url,
- 'date' => $date,
- 'filename' => $filename,
-&>
-% if ( $type eq 'xml' ) {
-</<% 'Part_'. $part %>>
-% }
+% foreach my $partnum (@partnums) {
+% $cgi->param('parts', $partnum);
+% $cgi->param('type', 'csv');
+<table class="fcc477part">
+ <caption>
+ <span class="parttitle">Part <% $partnum %></span>
+ <a class="download" href="<% $cgi->self_url %>">Download</a>
+ </caption>
+% my $header = ".header$partnum";
+% my $data = $parts{$partnum};
+ <thead>
+ <& $header &>
+ </thead>
+% #XXX column headings
+% foreach my $row (@$data) {
+ <tr>
+% foreach my $item (@$row) {
+ <td><% $item %></td>
% }
+ </tr>
% }
-% }
-%
-% if ( $type eq 'xml' ) {
-</Form_477_submission>
-% } else {
+</table>
+% } # foreach $partnum
<& /elements/footer.html &>
-% }
<%init>
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('List packages');
-my $curuser = $FS::CurrentUser::CurrentUser;
+my %parts;
+# load from cache if possible
+my $session;
+if ( $cgi->param('session') =~ /^(\d+)$/ ) {
+ $session = $1;
+ %parts = %{ $m->cache->get($session) };
+} else {
+ $session = sprintf('%010d%06d', time, int(rand(1000000)));
+ $cgi->param('session', $session);
+}
-die "access denied"
- unless $curuser->access_right('List packages');
+my $agentnum;
+if ($cgi->param('agentnum') =~ /^(\d+)$/ ) {
+ $agentnum = $1;
+}
+my $date = parse_datetime($cgi->param('date')) || time;
+my @partnums = grep /^\d+$/, $cgi->param('parts');
+foreach my $partnum (@partnums) {
+ my $method = "part$partnum";
+ $parts{$partnum} ||= FS::Report::FCC_477->$method(
+ date => $date,
+ agentnum => $agentnum
+ );
+}
+$m->cache->set($session, \%parts, '1h');
-my $date = $cgi->param('date') ? parse_datetime($cgi->param('date'))
- : time;
+my $title = 'FCC Form 477 Data - ' . time2str('%b %o, %Y', $date);
-my $state = uc($cgi->param('state'));
-$state =~ /^[A-Z]{2}$/ or die "illegal state: $state";
+if ( $cgi->param('type') eq 'csv' ) {
+ my $partnum = $partnums[0]; # ignore any beyond the first
+ my $data = $parts{$partnum};
+ my $csv = Text::CSV_XS->new({ eol => "\r\n" }); # i think
-my %part = map { $_ => 1 } grep { /^\w+$/ } $cgi->param('part');
-my $type = $cgi->param('_type') || 'html';
-my $filename;
-my @technology_option = &FS::Report::FCC_477::parse_technology_option($cgi,1);
+ my $filename = time2str('%Y-%m-%d', $date) . '-part' . $partnum . '.csv';
+ http_header('Content-Type' => 'text/csv');
+ http_header('Content-Disposition' => qq(attachment;filename="$filename"));
-# save upload and download mappings
-my @download = $cgi->param('part1_column_option');
-my @upload = $cgi->param('part1_row_option');
-for(my $i=0; $i < scalar(@download); $i++) {
- &FS::Report::FCC_477::save_fcc477map("part1_column_option_$i",$download[$i]);
-}
-for(my $i=0; $i < scalar(@upload); $i++) {
- &FS::Report::FCC_477::save_fcc477map("part1_row_option_$i",$upload[$i]);
-}
+ $m->clear_buffer;
-my @part2a_row_option = $cgi->param('part2a_row_option');
-for(my $i=0; $i < scalar(@part2a_row_option); $i++) {
- &FS::Report::FCC_477::save_fcc477map("part2a_row_option_$i",$part2a_row_option[$i]);
+ foreach my $row (@$data) {
+ $csv->combine(@$row);
+ $m->print($csv->string);
+ }
+ $m->abort;
}
-my @part2b_row_option = $cgi->param('part2b_row_option');
-for(my $i=0; $i < scalar(@part2b_row_option); $i++) {
- &FS::Report::FCC_477::save_fcc477map("part2b_row_option_$i",$part2b_row_option[$i]);
-}
+</%init>
+<%def .header6>
+ <TR CLASS="head">
+ <TD ROWSPAN=2>Census Tract</TD>
+ <TD ROWSPAN=2>Technology</TD>
+ <TD COLSPAN=2>Speed (Mbps)</TD>
+ <TD COLSPAN=2>Subscriptions</TD>
+ </TR>
+ <TR CLASS="subhead">
+ <TD>Down</TD>
+ <TD>Up</TD>
+ <TD>Total</TD>
+ <TD>Consumer</TD>
+ </TR>
+</%def>
+<%def .header7>
+ <TR CLASS="head">
+ <TD ROWSPAN=2>State</TD>
+ <TD COLSPAN=2>Speed (Mbps)</TD>
+ <TD COLSPAN=2>Subscriptions</TD>
+ </TR>
+ <TR CLASS="subhead">
+ <TD>Down</TD>
+ <TD>Up</TD>
+ <TD>Total</TD>
+ <TD>Consumer</TD>
+ </TR>
+</%def>
+<%def .header8>
+ <TR CLASS="head">
+ <TD ROWSPAN=2>State</TD>
+ <TD COLSPAN=2>Subscriptions</TD>
+ </TR>
+ <TR CLASS="subhead">
+ <TD>Total</TD>
+ <TD>Direct</TD>
+ </TR>
+</%def>
+<%def .header9>
+ <TR CLASS="head">
+ <TD ROWSPAN=3>State</TD>
+ <TD COLSPAN=2>Wholesale</TD>
+ <TD COLSPAN=12>End User Lines</TD>
+ </TR>
+ <TR CLASS="subhead">
+ <TD ROWSPAN=2>VGEs</TD>
+ <TD ROWSPAN=2>UNE-Ls</TD>
-my $part5_report_option = $cgi->param('part5_report_option');
-if ( $part5_report_option ) {
- FS::Report::FCC_477::save_fcc477map('part5_report_option', $part5_report_option);
-}
+ <TD ROWSPAN=2>Total</TD>
+ <TD ROWSPAN=2>With Broadband</TD>
+ <TD COLSPAN=2>Consumer</TD>
+ <TD COLSPAN=2>Business</TD>
-my $url_mangler = sub {
- my $part = shift;
- my $url = $cgi->url('-path_info' => 1, '-full' => 1);
- $url =~ s/477\./477part$part./;
- $url;
-};
-my @parts = qw( IA IIA IIB IV V VI_census );
+ <TD COLSPAN=3>Local Loop</TD>
-</%init>
+ <TD COLSPAN=3>Special Media</TD>
+ </TR>
+
+ <TR CLASS="subhead">
+ <TD> </TD>
+ <TD>+LD</TD>
+ <TD> </TD>
+ <TD>+LD</TD>
+
+ <TD>Owned</TD>
+ <TD>UNE-L</TD>
+ <TD>Resale</TD>
+
+ <TD>Fiber</TD>
+ <TD>Coaxial</TD>
+ <TD>Wireless</TD>
+ </TR>
+</%def>
+<%def .header10>
+ <TR CLASS="head">
+ <TD ROWSPAN=2>State</TD>
+ <TD COLSPAN=2>VoIP OTT</TD>
+ <TD COLSPAN=8>VoIP Non-OTT</TD>
+ </TR>
+ <TR CLASS="subhead">
+ <TD ROWSPAN=2>Total</TD>
+ <TD ROWSPAN=2>Consumer</TD>
+
+ <TD ROWSPAN=2>Total</TD>
+ <TD ROWSPAN=2>Consumer</TD>
+ <TD ROWSPAN=2>Bundled</TD>
+ <TD COLSPAN=5>Media Type</TD>
+ </TR>
+ <TR CLASS="subhead">
+ <TD>Copper</TD>
+ <TD>Fiber</TD>
+ <TD>Coaxial</TD>
+ <TD>Wireless</TD>
+ <TD>Other</TD>
+ </TR>
+</%def>
+<%def .header11>
+ <TR CLASS="head">
+ <TD ROWSPAN=2>Census Tract</TD>
+ <TD ROWSPAN=2>VoIP?</TD>
+ <TD COLSPAN=2>Lines/Subscriptions</TD>
+ </TR>
+ <TR CLASS="subhead">
+ <TD>Total</TD>
+ <TD>Consumer</TD>
+ </TR>
+</%def>
diff --git a/httemplate/search/old477/477.html b/httemplate/search/old477/477.html
new file mode 100755
index 000000000..ecf21cfb1
--- /dev/null
+++ b/httemplate/search/old477/477.html
@@ -0,0 +1,135 @@
+% 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
+<& /elements/header.html, "FCC Form 477 Results - $state" &>
+%# XXX when we stop supporting IE8, add this to freeside.css using :nth-child
+%# selectors, and remove it from everywhere else
+<STYLE TYPE="text/css">
+.grid TH { background-color: #cccccc; padding: 0px 3px 2px; text-align: right }
+.row0 TD { background-color: #eeeeee; padding: 0px 3px 2px; text-align: right }
+.row1 TD { background-color: #ffffff; padding: 0px 3px 2px; text-align: right }
+</STYLE>
+
+<TABLE WIDTH="100%">
+ <TR>
+ <TD></TD>
+ <TD ALIGN="right" CLASS="noprint">
+ Download full results<BR>
+% $cgi->param('_type', 'xml');
+ as <A HREF="<% $cgi->self_url %>">XML file</A><BR>
+
+% $cgi->param('_type', 'html-print');
+ as <A HREF="<% $cgi->self_url %>">printable copy</A>
+
+ </TD>
+% $cgi->param('_type', $type );
+ </TR>
+</TABLE>
+% } #html
+% foreach my $part ( @parts ) {
+% if ( $part{$part} ) {
+%
+% if ( $part eq 'V' ) {
+% next unless ( $part{'IIA'} || $part{'IIB'} );
+% }
+%
+% if ( $part eq 'VI_census' ) {
+% next unless $part{'IA'};
+% }
+%
+% my @reports = ();
+% if ( $part eq 'IA' ) {
+% for ( my $tech = 0; $tech < scalar(@technology_option); $tech++ ) {
+% next unless $technology_option[$tech];
+% my $url = &{$url_mangler}($part);
+% if ( $type eq 'xml' ) {
+<<% 'Part_IA_'. chr(65 + $tech) %>>
+% }
+<& "477part${part}.html",
+ 'tech_code' => $tech,
+ 'url' => $url,
+ 'type' => $type,
+ 'date' => $date,
+&>
+% if ( $type eq 'xml' ) {
+</<% 'Part_IA_'. chr(65 + $tech) %>>
+% }
+% }
+% } else { # not part IA
+% if ( $type eq 'xml' ) {
+<<% 'Part_'. $part %>>
+% }
+% my $url = &{$url_mangler}($part);
+<& "477part${part}.html",
+ 'url' => $url,
+ 'date' => $date,
+ 'filename' => $filename,
+&>
+% if ( $type eq 'xml' ) {
+</<% 'Part_'. $part %>>
+% }
+% }
+% }
+% }
+%
+% if ( $type eq 'xml' ) {
+</Form_477_submission>
+% } else {
+<& /elements/footer.html &>
+% }
+<%init>
+
+my $curuser = $FS::CurrentUser::CurrentUser;
+
+die "access denied"
+ unless $curuser->access_right('List packages');
+
+my $date = $cgi->param('date') ? parse_datetime($cgi->param('date'))
+ : time;
+
+my $state = uc($cgi->param('state'));
+$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 $filename;
+my @technology_option = &FS::Report::FCC_477::parse_technology_option($cgi,1);
+
+# save upload and download mappings
+my @download = $cgi->param('part1_column_option');
+my @upload = $cgi->param('part1_row_option');
+for(my $i=0; $i < scalar(@download); $i++) {
+ &FS::Report::FCC_477::save_fcc477map("part1_column_option_$i",$download[$i]);
+}
+for(my $i=0; $i < scalar(@upload); $i++) {
+ &FS::Report::FCC_477::save_fcc477map("part1_row_option_$i",$upload[$i]);
+}
+
+my @part2a_row_option = $cgi->param('part2a_row_option');
+for(my $i=0; $i < scalar(@part2a_row_option); $i++) {
+ &FS::Report::FCC_477::save_fcc477map("part2a_row_option_$i",$part2a_row_option[$i]);
+}
+
+my @part2b_row_option = $cgi->param('part2b_row_option');
+for(my $i=0; $i < scalar(@part2b_row_option); $i++) {
+ &FS::Report::FCC_477::save_fcc477map("part2b_row_option_$i",$part2b_row_option[$i]);
+}
+
+my $part5_report_option = $cgi->param('part5_report_option');
+if ( $part5_report_option ) {
+ FS::Report::FCC_477::save_fcc477map('part5_report_option', $part5_report_option);
+}
+
+my $url_mangler = sub {
+ my $part = shift;
+ my $url = $cgi->url('-path_info' => 1, '-full' => 1);
+ $url =~ s/477\./477part$part./;
+ $url;
+};
+my @parts = qw( IA IIA IIB IV V VI_census );
+
+</%init>
diff --git a/httemplate/search/477partIA.html b/httemplate/search/old477/477partIA.html
index 55e901bb3..55e901bb3 100755
--- a/httemplate/search/477partIA.html
+++ b/httemplate/search/old477/477partIA.html
diff --git a/httemplate/search/477partIIA.html b/httemplate/search/old477/477partIIA.html
index 7ccee6928..7ccee6928 100755
--- a/httemplate/search/477partIIA.html
+++ b/httemplate/search/old477/477partIIA.html
diff --git a/httemplate/search/477partIIB.html b/httemplate/search/old477/477partIIB.html
index bd56ecc60..bd56ecc60 100755
--- a/httemplate/search/477partIIB.html
+++ b/httemplate/search/old477/477partIIB.html
diff --git a/httemplate/search/477partIV.html b/httemplate/search/old477/477partIV.html
index 269a925dc..269a925dc 100755
--- a/httemplate/search/477partIV.html
+++ b/httemplate/search/old477/477partIV.html
diff --git a/httemplate/search/477partV.html b/httemplate/search/old477/477partV.html
index 2ffad2a27..80201f9d7 100755
--- a/httemplate/search/477partV.html
+++ b/httemplate/search/old477/477partV.html
@@ -1,7 +1,7 @@
% if ( $cgi->param('_type') =~ /^xml$/ ) {
<zip_codes>
% }
-<& elements/search.html,
+<& /search/elements/search.html,
'html_init' => $html_init,
'name' => 'zip code',
'query' => $sql_query,
diff --git a/httemplate/search/477partVI_census.html b/httemplate/search/old477/477partVI_census.html
index 2f3cf419a..efcf4ef1b 100755
--- a/httemplate/search/477partVI_census.html
+++ b/httemplate/search/old477/477partVI_census.html
@@ -1,4 +1,4 @@
-<& elements/search.html,
+<& /search/elements/search.html,
'html_init' => '<H2>Part VI</H2>',
'html_foot' => $html_foot,
'name' => 'regions',
diff --git a/httemplate/search/old477/report_477.html b/httemplate/search/old477/report_477.html
new file mode 100755
index 000000000..a5dd70b7c
--- /dev/null
+++ b/httemplate/search/old477/report_477.html
@@ -0,0 +1,282 @@
+<% include('/elements/header.html', 'FCC Form 477 Report' ) %>
+
+<FORM ACTION="477.html" METHOD="GET">
+<INPUT TYPE="hidden" NAME="magic" VALUE="active">
+
+ <TABLE BGCOLOR="#cccccc" CELLSPACING=0>
+
+ <TR>
+ <TH CLASS="background" COLSPAN=2 ALIGN="left">
+ <FONT SIZE="+1">Search options</FONT>
+ </TH>
+ </TR>
+
+ <% include( '/elements/tr-select-agent.html',
+ 'curr_value' => scalar( $cgi->param('agentnum') ),
+ 'disable_empty' => 0,
+ )
+ %>
+
+% # not tr-select-state, we only want to choose from among those that
+% # have customers
+ <& /elements/tr-select-table.html,
+ 'label' => 'State',
+ 'field' => 'state',
+ 'table' => 'cust_location',
+ 'name_col' => 'state',
+ 'value_col' => 'state',
+ 'disable_empty' => 1,
+ 'records' => \@states,
+ &>
+
+ <& /elements/tr-input-date-field.html, {
+ 'label' => 'As of date',
+ 'name' => 'date',
+ 'value' => '',
+ 'format' => '%m/%d/%Y'
+ } &>
+
+ <% include( '/elements/tr-select-pkg_class.html',
+ 'multiple' => 1,
+ 'empty_label' => '(empty class)',
+ )
+ %>
+
+ <SCRIPT type="text/javascript">
+ function partchange(what) {
+ var id = 'part' + what.value;
+ var element = document.getElementById(id);
+ if (what.checked) {
+ element.style.display = '';
+ } else {
+ element.style.display = 'none';
+ }
+ }
+ function toggleV() {
+ document.getElementById('enableV').disabled =
+ ! (document.getElementById('enableIIA').checked ||
+ document.getElementById('enableIIB').checked);
+ }
+ function toggleVI() {
+ document.getElementById('enableVI').disabled =
+ ! document.getElementById('enableIA').checked;
+ }
+ </SCRIPT>
+
+ <% include( '/elements/tr-checkbox.html',
+ 'label' => 'Enable part IA?',
+ 'field' => 'part',
+ 'id' => 'enableIA',
+ 'value' => 'IA',
+ 'onchange' => 'partchange(this); toggleVI();',
+ )
+ %>
+
+ <TR id='partIA' style="display:none"><TD>Part IA</TD><TD><TABLE>
+ <TR><TD>Download speeds</TD><TD>
+ <TABLE>
+% my $i = 0;
+% foreach my $speed ( @FS::Report::FCC_477::download ) {
+ <TR>
+ <TH><% $speed %></TH>
+ <TD>
+ <% include( '/elements/select-table.html',
+ 'table' => 'part_pkg_report_option',
+ 'name_col' => 'name',
+ 'hashref' => { 'disabled' => '' },
+ 'element_name' => 'part1_column_option',
+ 'disable_empty' => 1,
+ 'curr_value' =>
+ FS::Report::FCC_477::restore_fcc477map("part1_column_option_$i"),
+ )
+ %>
+ </TD>
+ </TR>
+% $i++
+% }
+ </TABLE></TD>
+ <TD>Upload speeds</TD><TD>
+ <TABLE>
+% $i = 0;
+% foreach my $speed ( @FS::Report::FCC_477::upload ) {
+ <TR>
+ <TH><% $speed %></TH>
+ <TD>
+ <% include( '/elements/select-table.html',
+ 'table' => 'part_pkg_report_option',
+ 'name_col' => 'name',
+ 'hashref' => { 'disabled' => '' },
+ 'element_name' => 'part1_row_option',
+ 'disable_empty' => 1,
+ 'curr_value' =>
+ FS::Report::FCC_477::restore_fcc477map("part1_row_option_$i"),
+ )
+ %>
+ </TD>
+ </TR>
+% $i++
+% }
+ </TABLE></TD></TR>
+ <TR><TD>Technologies</TD><TD>
+ <TABLE>
+% $i = 0;
+% foreach my $tech ( @FS::Report::FCC_477::technology ) {
+ <TR>
+ <TH><% $tech %></TH>
+ <TD>
+ <% include( '/elements/select-table.html',
+ 'table' => 'part_pkg_report_option',
+ 'name_col' => 'name',
+ 'hashref' => { 'disabled' => '' },
+ 'element_name' => "part1_technology_option_$i",
+ 'empty_label' => '(omit)',
+ 'curr_value' =>
+ FS::Report::FCC_477::restore_fcc477map("part1_technology_option_$i"),
+ )
+ %>
+ </TD>
+ </TR>
+% $i++
+% }
+ </TABLE></TD></TR>
+ </TABLE></TD></TR>
+
+ <% include( '/elements/tr-checkbox.html',
+ 'label' => 'Enable part IIA?',
+ 'field' => 'part',
+ 'id' => 'enableIIA',
+ 'value' => 'IIA',
+ 'onchange' => 'partchange(this); toggleV();',
+ )
+ %>
+
+ <TR id='partIIA' style="display:none"><TD>Part IIA</TD><TD><TABLE>
+% $i = 0;
+% foreach my $option ( @FS::Report::FCC_477::part2aoption ) {
+ <TR>
+ <TH><% $option %></TH>
+ <TD>
+ <% include( '/elements/select-table.html',
+ 'table' => 'part_pkg_report_option',
+ 'name_col' => 'name',
+ 'hashref' => { 'disabled' => '' },
+ 'element_name' => 'part2a_row_option',
+ 'curr_value' =>
+ FS::Report::FCC_477::restore_fcc477map("part2a_row_option_$i"),
+ )
+ %>
+ </TD>
+ </TR>
+% $i++
+% }
+ </TABLE></TD></TR>
+
+ <% include( '/elements/tr-checkbox.html',
+ 'label' => 'Enable part IIB?',
+ 'field' => 'part',
+ 'id' => 'enableIIB',
+ 'value' => 'IIB',
+ 'onchange' => 'partchange(this); toggleV();',
+ )
+ %>
+
+ <TR id='partIIB' style="display:none"><TD>Part IIB</TD><TD><TABLE>
+% $i = 0;
+% foreach my $option ( @FS::Report::FCC_477::part2boption ) {
+ <TR>
+ <TH><% $option %></TH>
+ <TD>
+ <% include( '/elements/select-table.html',
+ 'table' => 'part_pkg_report_option',
+ 'name_col' => 'name',
+ 'hashref' => { 'disabled' => '' },
+ 'element_name' => 'part2b_row_option',
+ 'curr_value' =>
+ FS::Report::FCC_477::restore_fcc477map("part2b_row_option_$i"),
+ )
+ %>
+ </TD>
+ </TR>
+% $i++
+% }
+ </TABLE></TD></TR>
+
+ <% include( '/elements/tr-checkbox.html',
+ 'label' => 'Enable part IV?',
+ 'field' => 'part',
+ 'id' => 'enableIV', #unused
+ 'value' => 'IV',
+ 'onchange' => 'partchange(this)',
+ )
+ %>
+
+ <TR id='partIV' style="display:none"><TD>Part IV</TD><TD><TABLE>
+ <% include( '/elements/tr-textarea.html',
+ 'label' => 'Explanatory notes',
+ 'id' => 'partIV',
+ 'field' => 'notes',
+ 'rows' => 15,
+ 'cols' => 80,
+ )
+ %>
+ </TABLE></TD></TR>
+
+ <% include( '/elements/tr-checkbox.html',
+ 'label' => 'Enable part V?',
+ 'field' => 'part',
+ 'value' => 'V',
+ 'id' => 'enableV',
+ 'onchange' => 'partchange(this)',
+ 'postfix' =>
+ '&nbsp;<FONT SIZE="-1">(requires Part IIA or IIB)</FONT>',
+ )
+ %>
+ <TR id='partV' style="display:none">
+ <TD>Part V</TD>
+ <TD>
+ <% include( '/elements/select-table.html',
+ 'table' => 'part_pkg_report_option',
+ 'name_col' => 'name',
+ 'hashref' => { 'disabled' => '' },
+ 'element_name' => 'part5_report_option',
+ 'curr_value' =>
+ FS::Report::FCC_477::restore_fcc477map("part5_report_option"),
+ )
+ %>
+ </TD>
+ </TR>
+
+
+ <% include( '/elements/tr-checkbox.html',
+ 'label' => 'Enable part VI?',
+ 'field' => 'part',
+ 'id' => 'enableVI',
+ 'value' => 'VI_census',
+ 'postfix' =>
+ '&nbsp;<FONT SIZE="-1">(requires part IA)</FONT>',
+ )
+ %>
+ <SCRIPT TYPE="text/javascript">
+ toggleV();
+ toggleVI();
+ </SCRIPT>
+ </TABLE>
+
+<BR>
+<INPUT TYPE="submit" VALUE="Get Report">
+
+</FORM>
+
+<% include('/elements/footer.html') %>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('List packages');
+
+my @states = qsearch({
+ 'table' => 'cust_location',
+ 'select' => 'DISTINCT(state)',
+ 'hashref' => { 'country' => 'US' }, # 477 report isn't relevant elsewhere
+});
+
+</%init>
diff --git a/httemplate/search/report_477.html b/httemplate/search/report_477.html
index a5dd70b7c..e3ae69e6f 100755
--- a/httemplate/search/report_477.html
+++ b/httemplate/search/report_477.html
@@ -1,32 +1,23 @@
-<% include('/elements/header.html', 'FCC Form 477 Report' ) %>
+% if ( $conf->exists('old_fcc_report') ) {
+% $m->clear_buffer;
+% $m->print($cgi->redirect($fsurl . 'search/old477/report_477.html'));
+% $m->abort;
+% }
+<& /elements/header.html, 'FCC Form 477 Report' &>
<FORM ACTION="477.html" METHOD="GET">
-<INPUT TYPE="hidden" NAME="magic" VALUE="active">
<TABLE BGCOLOR="#cccccc" CELLSPACING=0>
<TR>
<TH CLASS="background" COLSPAN=2 ALIGN="left">
- <FONT SIZE="+1">Search options</FONT>
+ <FONT SIZE="+1">Report options</FONT>
</TH>
</TR>
- <% include( '/elements/tr-select-agent.html',
- 'curr_value' => scalar( $cgi->param('agentnum') ),
- 'disable_empty' => 0,
- )
- %>
-
-% # not tr-select-state, we only want to choose from among those that
-% # have customers
- <& /elements/tr-select-table.html,
- 'label' => 'State',
- 'field' => 'state',
- 'table' => 'cust_location',
- 'name_col' => 'state',
- 'value_col' => 'state',
- 'disable_empty' => 1,
- 'records' => \@states,
+ <& /elements/tr-select-agent.html,
+ 'curr_value' => scalar( $cgi->param('agentnum') ),
+ 'disable_empty' => 0,
&>
<& /elements/tr-input-date-field.html, {
@@ -36,247 +27,31 @@
'format' => '%m/%d/%Y'
} &>
- <% include( '/elements/tr-select-pkg_class.html',
- 'multiple' => 1,
- 'empty_label' => '(empty class)',
- )
- %>
-
- <SCRIPT type="text/javascript">
- function partchange(what) {
- var id = 'part' + what.value;
- var element = document.getElementById(id);
- if (what.checked) {
- element.style.display = '';
- } else {
- element.style.display = 'none';
- }
- }
- function toggleV() {
- document.getElementById('enableV').disabled =
- ! (document.getElementById('enableIIA').checked ||
- document.getElementById('enableIIB').checked);
- }
- function toggleVI() {
- document.getElementById('enableVI').disabled =
- ! document.getElementById('enableIA').checked;
- }
- </SCRIPT>
-
- <% include( '/elements/tr-checkbox.html',
- 'label' => 'Enable part IA?',
- 'field' => 'part',
- 'id' => 'enableIA',
- 'value' => 'IA',
- 'onchange' => 'partchange(this); toggleVI();',
- )
- %>
-
- <TR id='partIA' style="display:none"><TD>Part IA</TD><TD><TABLE>
- <TR><TD>Download speeds</TD><TD>
- <TABLE>
-% my $i = 0;
-% foreach my $speed ( @FS::Report::FCC_477::download ) {
- <TR>
- <TH><% $speed %></TH>
- <TD>
- <% include( '/elements/select-table.html',
- 'table' => 'part_pkg_report_option',
- 'name_col' => 'name',
- 'hashref' => { 'disabled' => '' },
- 'element_name' => 'part1_column_option',
- 'disable_empty' => 1,
- 'curr_value' =>
- FS::Report::FCC_477::restore_fcc477map("part1_column_option_$i"),
- )
- %>
- </TD>
- </TR>
-% $i++
-% }
- </TABLE></TD>
- <TD>Upload speeds</TD><TD>
- <TABLE>
-% $i = 0;
-% foreach my $speed ( @FS::Report::FCC_477::upload ) {
- <TR>
- <TH><% $speed %></TH>
- <TD>
- <% include( '/elements/select-table.html',
- 'table' => 'part_pkg_report_option',
- 'name_col' => 'name',
- 'hashref' => { 'disabled' => '' },
- 'element_name' => 'part1_row_option',
- 'disable_empty' => 1,
- 'curr_value' =>
- FS::Report::FCC_477::restore_fcc477map("part1_row_option_$i"),
- )
- %>
- </TD>
- </TR>
-% $i++
-% }
- </TABLE></TD></TR>
- <TR><TD>Technologies</TD><TD>
- <TABLE>
-% $i = 0;
-% foreach my $tech ( @FS::Report::FCC_477::technology ) {
- <TR>
- <TH><% $tech %></TH>
- <TD>
- <% include( '/elements/select-table.html',
- 'table' => 'part_pkg_report_option',
- 'name_col' => 'name',
- 'hashref' => { 'disabled' => '' },
- 'element_name' => "part1_technology_option_$i",
- 'empty_label' => '(omit)',
- 'curr_value' =>
- FS::Report::FCC_477::restore_fcc477map("part1_technology_option_$i"),
- )
- %>
- </TD>
- </TR>
-% $i++
-% }
- </TABLE></TD></TR>
- </TABLE></TD></TR>
-
- <% include( '/elements/tr-checkbox.html',
- 'label' => 'Enable part IIA?',
- 'field' => 'part',
- 'id' => 'enableIIA',
- 'value' => 'IIA',
- 'onchange' => 'partchange(this); toggleV();',
- )
- %>
-
- <TR id='partIIA' style="display:none"><TD>Part IIA</TD><TD><TABLE>
-% $i = 0;
-% foreach my $option ( @FS::Report::FCC_477::part2aoption ) {
- <TR>
- <TH><% $option %></TH>
- <TD>
- <% include( '/elements/select-table.html',
- 'table' => 'part_pkg_report_option',
- 'name_col' => 'name',
- 'hashref' => { 'disabled' => '' },
- 'element_name' => 'part2a_row_option',
- 'curr_value' =>
- FS::Report::FCC_477::restore_fcc477map("part2a_row_option_$i"),
- )
- %>
- </TD>
- </TR>
-% $i++
-% }
- </TABLE></TD></TR>
-
- <% include( '/elements/tr-checkbox.html',
- 'label' => 'Enable part IIB?',
- 'field' => 'part',
- 'id' => 'enableIIB',
- 'value' => 'IIB',
- 'onchange' => 'partchange(this); toggleV();',
- )
- %>
-
- <TR id='partIIB' style="display:none"><TD>Part IIB</TD><TD><TABLE>
-% $i = 0;
-% foreach my $option ( @FS::Report::FCC_477::part2boption ) {
- <TR>
- <TH><% $option %></TH>
- <TD>
- <% include( '/elements/select-table.html',
- 'table' => 'part_pkg_report_option',
- 'name_col' => 'name',
- 'hashref' => { 'disabled' => '' },
- 'element_name' => 'part2b_row_option',
- 'curr_value' =>
- FS::Report::FCC_477::restore_fcc477map("part2b_row_option_$i"),
- )
- %>
- </TD>
- </TR>
-% $i++
-% }
- </TABLE></TD></TR>
-
- <% include( '/elements/tr-checkbox.html',
- 'label' => 'Enable part IV?',
- 'field' => 'part',
- 'id' => 'enableIV', #unused
- 'value' => 'IV',
- 'onchange' => 'partchange(this)',
- )
- %>
-
- <TR id='partIV' style="display:none"><TD>Part IV</TD><TD><TABLE>
- <% include( '/elements/tr-textarea.html',
- 'label' => 'Explanatory notes',
- 'id' => 'partIV',
- 'field' => 'notes',
- 'rows' => 15,
- 'cols' => 80,
- )
- %>
- </TABLE></TD></TR>
-
- <% include( '/elements/tr-checkbox.html',
- 'label' => 'Enable part V?',
- 'field' => 'part',
- 'value' => 'V',
- 'id' => 'enableV',
- 'onchange' => 'partchange(this)',
- 'postfix' =>
- '&nbsp;<FONT SIZE="-1">(requires Part IIA or IIB)</FONT>',
- )
- %>
- <TR id='partV' style="display:none">
- <TD>Part V</TD>
- <TD>
- <% include( '/elements/select-table.html',
- 'table' => 'part_pkg_report_option',
- 'name_col' => 'name',
- 'hashref' => { 'disabled' => '' },
- 'element_name' => 'part5_report_option',
- 'curr_value' =>
- FS::Report::FCC_477::restore_fcc477map("part5_report_option"),
- )
- %>
- </TD>
- </TR>
-
-
- <% include( '/elements/tr-checkbox.html',
- 'label' => 'Enable part VI?',
- 'field' => 'part',
- 'id' => 'enableVI',
- 'value' => 'VI_census',
- 'postfix' =>
- '&nbsp;<FONT SIZE="-1">(requires part IA)</FONT>',
- )
- %>
- <SCRIPT TYPE="text/javascript">
- toggleV();
- toggleVI();
- </SCRIPT>
+ <& /elements/tr-checkbox-multiple.html,
+ 'label' => 'Enable parts',
+ 'field' => 'parts',
+ 'labels' => {
+ 6 => 'Part 6 (Fixed Broadband Subscription)',
+ #7 => 'Part 7 (Mobile Wireless Broadband Subscription),
+ #8 => 'Part 8 (Mobile Local Telephone Subscription),
+ 9 => 'Part 9 (Local Exchange Telephone Subscription)',
+ 10 => 'Part 10 (Interconnected VoIP Subscription)',
+ 11 => 'Part 11 (Voice Telephone Subscription Detail)',
+ },
+ options => [ 6, 9, 10, 11 ],
+ &>
</TABLE>
-<BR>
-<INPUT TYPE="submit" VALUE="Get Report">
+ <BR>
+ <INPUT TYPE="submit" VALUE="Get Report">
</FORM>
-<% include('/elements/footer.html') %>
+<& /elements/footer.html &>
<%init>
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('List packages');
-my @states = qsearch({
- 'table' => 'cust_location',
- 'select' => 'DISTINCT(state)',
- 'hashref' => { 'country' => 'US' }, # 477 report isn't relevant elsewhere
-});
-
+my $conf = FS::Conf->new;
</%init>