fix losing rates when renaming a rate plan, RT#8173
[freeside.git] / httemplate / view / svc_broadband.cgi
1 <%include("/elements/header.html",'Broadband Service View', menubar(
2   ( ( $custnum )
3     ? ( "View this customer (#$display_custnum)" => "${p}view/cust_main.cgi?$custnum",
4       )                                                                       
5     : ( "Cancel this (unaudited) website" =>
6           "${p}misc/cancel-unaudited.cgi?$svcnum" )
7   )
8 ))
9 %>
10
11 <% include('/elements/init_overlib.html') %>
12
13 <A HREF="<%$p%>edit/svc_broadband.cgi?<%$svcnum%>">Edit this information</A>
14 <BR>
15 <%ntable("#cccccc")%>
16   <TR>
17     <TD>
18       <%ntable("#cccccc",2)%>
19         <TR>
20           <TD ALIGN="right">Service number</TD>
21           <TD BGCOLOR="#ffffff"><%$svcnum%></TD>
22         </TR>
23         <TR>
24           <TD ALIGN="right">Description</TD>
25           <TD BGCOLOR="#ffffff"><%$description%></TD>
26         </TR>
27
28 %       if ( $router ) {
29           <TR>
30             <TD ALIGN="right">Router</TD>
31             <TD BGCOLOR="#ffffff"><%$router->routernum%>: <%$router->routername%></TD>
32           </TR>
33 %       }
34
35         <TR>
36           <TD ALIGN="right">Download Speed</TD>
37           <TD BGCOLOR="#ffffff"><%$speed_down%></TD>
38         </TR>
39         <TR>
40           <TD ALIGN="right">Upload Speed</TD>
41           <TD BGCOLOR="#ffffff"><%$speed_up%></TD>
42         </TR>
43
44 %       if ( $ip_addr ) { 
45           <TR>
46             <TD ALIGN="right">IP Address</TD>
47             <TD BGCOLOR="#ffffff">
48               <%$ip_addr%>
49               (<% include('/elements/popup_link-ping.html', 'ip'=>$ip_addr ) %>)
50             </TD>
51           </TR>
52           <TR>
53             <TD ALIGN="right">IP Netmask</TD>
54             <TD BGCOLOR="#ffffff"><%$addr_block->NetAddr->mask%></TD>
55           </TR>
56           <TR>
57             <TD ALIGN="right">IP Gateway</TD>
58             <TD BGCOLOR="#ffffff"><%$addr_block->ip_gateway%></TD>
59           </TR>
60 %       }
61
62         <TR>
63           <TD ALIGN="right">MAC Address</TD>
64           <TD BGCOLOR="#ffffff"><%$mac_addr%></TD>
65         </TR>
66         <TR>
67           <TD ALIGN="right">Latitude</TD>
68           <TD BGCOLOR="#ffffff"><%$latitude%></TD>
69         </TR>
70         <TR>
71           <TD ALIGN="right">Longitude</TD>
72           <TD BGCOLOR="#ffffff"><%$longitude%></TD>
73         </TR>
74         <TR>
75           <TD ALIGN="right">Altitude</TD>
76           <TD BGCOLOR="#ffffff"><%$altitude%></TD>
77         </TR>
78         <TR>
79           <TD ALIGN="right">VLAN Profile</TD>
80           <TD BGCOLOR="#ffffff"><%$vlan_profile%></TD>
81         </TR>
82         <TR>
83           <TD ALIGN="right">Authentication Key</TD>
84           <TD BGCOLOR="#ffffff"><%$auth_key%></TD>
85         </TR>
86         <TR COLSPAN="2"><TD></TD></TR>
87 %
88 %foreach (sort { $a cmp $b } $svc_broadband->virtual_fields) {
89 %  print $svc_broadband->pvf($_)->widget('HTML', 'view',
90 %                                        $svc_broadband->getfield($_)), "\n";
91 %}
92 %
93 %
94
95       </TABLE>
96     </TD>
97   </TR>
98 </TABLE>
99
100 <BR>
101 <%ntable("#cccccc", 2)%>
102 %
103 %  my $sb_router = qsearchs('router', { svcnum => $svcnum });
104 %  if ($sb_router) {
105 %  
106
107   <B>Router associated: <%$sb_router->routername%> </B>
108   <A HREF="<%popurl(2)%>edit/router.cgi?<%$sb_router->routernum%>">
109     (details)
110   </A>
111   <BR>
112 % my @sb_addr_block;
113 %     if (@sb_addr_block = $sb_router->addr_block) {
114 %     
115
116   <B>Address space </B>
117   <A HREF="<%popurl(2)%>browse/addr_block.cgi">
118     (edit)
119   </A>
120   <BR>
121 %   print ntable("#cccccc", 1);
122 %       foreach (@sb_addr_block) { 
123
124     <TR>
125       <TD><%$_->ip_gateway%>/<%$_->ip_netmask%></TD>
126     </TR>
127 % } 
128
129   </TABLE>
130 % } else { 
131
132   <B>No address space allocated.</B>
133 % } 
134
135   <BR>
136 %
137 %  } else {
138 %
139
140
141 <FORM METHOD="GET" ACTION="<%popurl(2)%>edit/router.cgi">
142   <INPUT TYPE="hidden" NAME="svcnum" VALUE="<%$svcnum%>">
143 Add router named 
144   <INPUT TYPE="text" NAME="routername" SIZE="32" VALUE="Broadband router (<%$svcnum%>)">
145   <INPUT TYPE="submit" VALUE="Add router">
146 </FORM>
147 %
148 %}
149 %
150
151
152 <BR>
153 <%joblisting({'svcnum'=>$svcnum}, 1)%>
154
155 <% include('/elements/footer.html') %>
156 <%init>
157
158 die "access denied"
159   unless $FS::CurrentUser::CurrentUser->access_right('View customer services');
160
161 my($query) = $cgi->keywords;
162 $query =~ /^(\d+)$/;
163 my $svcnum = $1;
164 my $svc_broadband = qsearchs({
165   'select'    => 'svc_broadband.*',
166   'table'     => 'svc_broadband',
167   'addl_from' => ' LEFT JOIN cust_svc  USING ( svcnum  ) '.
168                  ' LEFT JOIN cust_pkg  USING ( pkgnum  ) '.
169                  ' LEFT JOIN cust_main USING ( custnum ) ',
170   'hashref'   => { 'svcnum' => $svcnum },
171   'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql(
172                             'null_right' => 'View/link unlinked services'
173                           ),
174 }) or die "svc_broadband: Unknown svcnum $svcnum";
175
176 #false laziness w/all svc_*.cgi
177 my $cust_svc = qsearchs( 'cust_svc', { 'svcnum' => $svcnum } );
178 my $pkgnum = $cust_svc->getfield('pkgnum');
179 my($cust_pkg, $custnum, $display_custnum);
180 if ($pkgnum) {
181   $cust_pkg = qsearchs( 'cust_pkg', { 'pkgnum' => $pkgnum } );
182   $custnum = $cust_pkg->custnum;
183   $display_custnum = $cust_pkg->cust_main->display_custnum;
184 } else {
185   $cust_pkg = '';
186   $custnum = '';
187 }
188 #eofalse
189
190 my $addr_block = $svc_broadband->addr_block;
191 my $router = $addr_block->router if $addr_block;
192
193 #if (not $router) { die "Could not lookup router for svc_broadband (svcnum $svcnum)" };
194
195 my (
196      $speed_down,
197      $speed_up,
198      $ip_addr,
199      $mac_addr,
200      $latitude,
201      $longitude,
202      $altitude,
203      $vlan_profile,
204      $auth_key,
205      $description,
206    ) = (
207      $svc_broadband->getfield('speed_down'),
208      $svc_broadband->getfield('speed_up'),
209      $svc_broadband->getfield('ip_addr'),
210      $svc_broadband->mac_addr,
211      $svc_broadband->latitude,
212      $svc_broadband->longitude,
213      $svc_broadband->altitude,
214      $svc_broadband->vlan_profile,
215      $svc_broadband->auth_key,
216      $svc_broadband->description,
217    );
218
219 </%init>