combine ticket notification scrips, #15353
[freeside.git] / httemplate / search / 477.html
1 % unless ( $type eq 'xml' ) {
2 <% include( '/elements/header.html', 'FCC Form 477 Results') %>
3 %}else{
4 <?xml version="1.0" encoding="ISO-8859-1"?>
5 <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" >
6 %}
7 % if ( $type eq 'html' || $type eq 'html-print' ) {
8 <TABLE WIDTH="100%">
9   <TR><TD></TD>
10 %}elsif ( $type eq 'xml' ) {
11 %}
12 %           unless ( $type eq 'html-print' || $type eq 'xml' ) {
13
14               <TD ALIGN="right">
15
16                 Download full results<BR>
17 %               $cgi->param('_type', 'xml');
18                 as <A HREF="<% $cgi->self_url %>">XML file</A><BR>
19
20 %               $cgi->param('_type', 'html-print');
21                 as <A HREF="<% $cgi->self_url %>">printable copy</A>
22
23               </TD>
24 %             $cgi->param('_type', $type );
25 %           }
26 % if ( $type eq 'html' || $type eq 'html-print' ) {
27   </TR>
28 </TABLE>
29 %}elsif ( $type eq 'xml' ) {
30 %}
31 % foreach my $part ( @parts ) {
32 %   if ( $part{$part} ) {
33 %
34 %     if ( $part eq 'V' ) {
35 %       next unless ( $part{'IIA'} || $part{'IIB'} );
36 %     }
37 %
38 %     if ( $part eq 'VI_census' ) {
39 %       next unless $part{'IA'};
40 %     }
41 %
42 %     my @reports = ();
43 %     if ( $part eq 'IA' ) {
44 %       for ( my $tech = 0; $tech < scalar(@technology_option); $tech++ ) {
45 %         next unless $technology_option[$tech];
46 %         my $url = &{$url_mangler}($part);
47 %         if ( $type eq 'xml' ) {
48 <<% 'Part_IA_'. chr(65 + $tech) %>>
49 %         }
50 <% include( "477part${part}_summary.html", 'tech_code' => $tech, 'url' => $url ) %>
51 <% include( "477part${part}_detail.html", 'tech_code' => $tech, 'url' => $url ) %>
52 %         if ( $type eq 'xml' ) {
53 </<% 'Part_IA_'. chr(65 + $tech) %>>
54 %         }
55 %       }
56 %     } else {
57 %       if ( $type eq 'xml' ) {
58 <<% 'Part_'. $part %>>
59 %       }
60 %       my $url = &{$url_mangler}($part);
61 <% include( "477part${part}.html", 'url' => $url ) %>
62 %       if ( $type eq 'xml' ) {
63 </<% 'Part_'. $part %>>
64 %       }
65 %     }
66 %   }
67 % }
68 %
69 % if ( $type eq 'html' || $type eq 'html-print' ) {
70 <% include( '/elements/footer.html') %>
71 %}elsif ( $type eq 'xml' ) {
72 </Form_477_submission>
73 %}
74 <%init>
75
76 my $curuser = $FS::CurrentUser::CurrentUser;
77
78 die "access denied"
79   unless $curuser->access_right('List packages');
80
81 my %part = map { $_ => 1 } grep { /^\w+$/ } $cgi->param('part');
82 my $type = $cgi->param('_type') || 'html';
83 my $xlsname = '477report';
84 my @technology_option = &FS::Report::FCC_477::parse_technology_option($cgi,1);
85
86 # save upload and download mappings
87 my @download = $cgi->param('part1_column_option');
88 my @upload = $cgi->param('part1_row_option');
89 for(my $i=0; $i < scalar(@download); $i++) {
90     &FS::Report::FCC_477::save_fcc477map("part1_column_option_$i",$download[$i]);
91 }
92 for(my $i=0; $i < scalar(@upload); $i++) {
93     &FS::Report::FCC_477::save_fcc477map("part1_row_option_$i",$upload[$i]);
94 }
95
96 my @part2a_row_option = $cgi->param('part2a_row_option');
97 for(my $i=0; $i < scalar(@part2a_row_option); $i++) {
98     &FS::Report::FCC_477::save_fcc477map("part2a_row_option_$i",$part2a_row_option[$i]);
99 }
100
101 my @part2b_row_option = $cgi->param('part2b_row_option');
102 for(my $i=0; $i < scalar(@part2b_row_option); $i++) {
103     &FS::Report::FCC_477::save_fcc477map("part2b_row_option_$i",$part2b_row_option[$i]);
104 }
105
106 my $url_mangler = sub {
107   my $part = shift;
108   my $url = $cgi->url('-path_info' => 1, '-full' => 1);
109   $url =~ s/477\./477part$part./;
110   $url;
111 };
112 my @parts = qw( IA IIA IIB IV V VI_census );
113
114 </%init>