set the suspension date before calling service suspensions, fix RADIUS groups suspens...
[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 <% include('/view/elements/svc_edit_link.html', 'svc'=>$svc_broadband) %>
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>
87           <TD ALIGN="right">Service Plan Id</TD>
88           <TD BGCOLOR="#ffffff"><%$plan_id%></TD>
89         </TR>
90         <TR COLSPAN="2"><TD></TD></TR>
91 %
92 %foreach (sort { $a cmp $b } $svc_broadband->virtual_fields) {
93 %  print $svc_broadband->pvf($_)->widget('HTML', 'view',
94 %                                        $svc_broadband->getfield($_)), "\n";
95 %}
96 %
97 %
98
99       </TABLE>
100     </TD>
101   </TR>
102 </TABLE>
103
104 <BR>
105 <%ntable("#cccccc", 2)%>
106 %
107 %  my $sb_router = qsearchs('router', { svcnum => $svcnum });
108 %  if ($sb_router) {
109 %  
110
111   <B>Router associated: <%$sb_router->routername%> </B>
112   <A HREF="<%popurl(2)%>edit/router.cgi?<%$sb_router->routernum%>">
113     (details)
114   </A>
115   <BR>
116 % my @sb_addr_block;
117 %     if (@sb_addr_block = $sb_router->addr_block) {
118 %     
119
120   <B>Address space </B>
121   <A HREF="<%popurl(2)%>browse/addr_block.cgi">
122     (edit)
123   </A>
124   <BR>
125 %   print ntable("#cccccc", 1);
126 %       foreach (@sb_addr_block) { 
127
128     <TR>
129       <TD><%$_->ip_gateway%>/<%$_->ip_netmask%></TD>
130     </TR>
131 % } 
132
133   </TABLE>
134 % } else { 
135
136   <B>No address space allocated.</B>
137 % } 
138
139   <BR>
140 %
141 %  } else {
142 %
143
144
145 <FORM METHOD="GET" ACTION="<%popurl(2)%>edit/router.cgi">
146   <INPUT TYPE="hidden" NAME="svcnum" VALUE="<%$svcnum%>">
147 Add router named 
148   <INPUT TYPE="text" NAME="routername" SIZE="32" VALUE="Broadband router (<%$svcnum%>)">
149   <INPUT TYPE="submit" VALUE="Add router">
150 </FORM>
151 %
152 %}
153 %
154
155
156 <BR>
157 <%joblisting({'svcnum'=>$svcnum}, 1)%>
158
159 <% include('/elements/footer.html') %>
160 <%init>
161
162 die "access denied"
163   unless $FS::CurrentUser::CurrentUser->access_right('View customer services');
164
165 my($query) = $cgi->keywords;
166 $query =~ /^(\d+)$/;
167 my $svcnum = $1;
168 my $svc_broadband = qsearchs({
169   'select'    => 'svc_broadband.*',
170   'table'     => 'svc_broadband',
171   'addl_from' => ' LEFT JOIN cust_svc  USING ( svcnum  ) '.
172                  ' LEFT JOIN cust_pkg  USING ( pkgnum  ) '.
173                  ' LEFT JOIN cust_main USING ( custnum ) ',
174   'hashref'   => { 'svcnum' => $svcnum },
175   'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql(
176                             'null_right' => 'View/link unlinked services'
177                           ),
178 }) or die "svc_broadband: Unknown svcnum $svcnum";
179
180 #false laziness w/all svc_*.cgi
181 my $cust_svc = qsearchs( 'cust_svc', { 'svcnum' => $svcnum } );
182 my $pkgnum = $cust_svc->getfield('pkgnum');
183 my($cust_pkg, $custnum, $display_custnum);
184 if ($pkgnum) {
185   $cust_pkg = qsearchs( 'cust_pkg', { 'pkgnum' => $pkgnum } );
186   $custnum = $cust_pkg->custnum;
187   $display_custnum = $cust_pkg->cust_main->display_custnum;
188 } else {
189   $cust_pkg = '';
190   $custnum = '';
191 }
192 #eofalse
193
194 my $addr_block = $svc_broadband->addr_block;
195 my $router = $addr_block->router if $addr_block;
196
197 #if (not $router) { die "Could not lookup router for svc_broadband (svcnum $svcnum)" };
198
199 my (
200      $speed_down,
201      $speed_up,
202      $ip_addr,
203      $mac_addr,
204      $latitude,
205      $longitude,
206      $altitude,
207      $vlan_profile,
208      $auth_key,
209      $description,
210      $plan_id,
211    ) = (
212      $svc_broadband->getfield('speed_down'),
213      $svc_broadband->getfield('speed_up'),
214      $svc_broadband->getfield('ip_addr'),
215      $svc_broadband->mac_addr,
216      $svc_broadband->latitude,
217      $svc_broadband->longitude,
218      $svc_broadband->altitude,
219      $svc_broadband->vlan_profile,
220      $svc_broadband->auth_key,
221      $svc_broadband->description,
222      $svc_broadband->plan_id,
223    );
224
225 </%init>