-#eofalse
-
-my $ac = qsearchs('ac', { acnum => $svc_broadband->getfield('acnum') });
-
-my (
- $acname,
- $acnum,
- $speed_down,
- $speed_up,
- $ip_addr,
- $ip_netmask,
- $mac_addr,
- $location
- ) = (
- $ac->getfield('acname'),
- $ac->getfield('acnum'),
- $svc_broadband->getfield('speed_down'),
- $svc_broadband->getfield('speed_up'),
- $svc_broadband->getfield('ip_addr'),
- $svc_broadband->getfield('ip_netmask'),
- $svc_broadband->getfield('mac_addr'),
- $svc_broadband->getfield('location')
- );
-
-print header('Broadband Service View', menubar(
- ( ( $custnum )
- ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum",
- "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum",
- )
- : ( "Cancel this (unaudited) website" =>
- "${p}misc/cancel-unaudited.cgi?$svcnum" )
- ),
- "Main menu" => $p,
-)).
- qq!<A HREF="${p}edit/svc_broadband.cgi?$svcnum">Edit this information</A><BR>!.
- ntable("#cccccc"). '<TR><TD>'. ntable("#cccccc",2).
- qq!<TR><TD ALIGN="right">Service number</TD>!.
- qq!<TD BGCOLOR="#ffffff">$svcnum</TD></TR>!.
- qq!<TR><TD ALIGN="right">AC</TD>!.
- qq!<TD BGCOLOR="#ffffff">$acnum: $acname</TD></TR>!.
- qq!<TR><TD ALIGN="right">Download Speed</TD>!.
- qq!<TD BGCOLOR="#ffffff">$speed_down</TD></TR>!.
- qq!<TR><TD ALIGN="right">Upload Speed</TD>!.
- qq!<TD BGCOLOR="#ffffff">$speed_up</TD></TR>!.
- qq!<TR><TD ALIGN="right">IP Address/Mask</TD>!.
- qq!<TD BGCOLOR="#ffffff">$ip_addr/$ip_netmask</TD></TR>!.
- qq!<TR><TD ALIGN="right">MAC Address</TD>!.
- qq!<TD BGCOLOR="#ffffff">$mac_addr</TD></TR>!.
- qq!<TR><TD ALIGN="right" VALIGN="TOP">Location</TD>!.
- qq!<TD BGCOLOR="#ffffff"><PRE>$location</PRE></TD></TR>!.
- '</TABLE></TD></TR></TABLE>'.
- '<BR>'. joblisting({'svcnum'=>$svcnum}, 1).
- '</BODY></HTML>'
-;
-%>
+
+sub usergroup {
+ my $svc = shift;
+ my $usergroup = $svc->usergroup;
+ join('<BR>', $svc->radius_groups('long_description'));
+}
+
+sub sectornum {
+ my $svc_broadband = shift;
+ return '' unless $svc_broadband->sectornum;
+ my $tower_sector = $svc_broadband->tower_sector;
+ my $link = $tower_sector->ip_addr
+ ? '<A HREF="http://'. $tower_sector->ip_addr. '">'
+ : '';
+
+ $link . $tower_sector->description. ( $link ? '</A>' : '');
+}
+
+sub coordinates {
+ my $s = shift; #$svc_broadband
+ return '' unless $s->latitude && $s->longitude;
+
+ my $d = $s->description;
+ my $agentnum;
+ unless ($d) {
+ if ( my $cust_pkg = $s->cust_svc->cust_pkg ) {
+ $d = $cust_pkg->cust_main->name_short;
+ $agentnum = $cust_pkg->cust_main->agentnum;
+ }
+ }
+
+ #'Latitude: '. $s->latitude. ', Longitude: '. $s->longitude. ' '.
+ $s->latitude. ', '. $s->longitude. ' '.
+ include('/elements/coord-links.html',
+ $s->latitude,
+ $s->longitude,
+ $d,
+ $agentnum
+ );
+}
+
+sub svc_callback {
+ # trying to move to the callback style
+ my ($cgi, $svc_x, $part_svc, $cust_pkg, $fields, $opt) = @_;
+ # again, we assume at most one of these exports per part_svc
+ my ($nas_export) = $part_svc->part_export('broadband_nas');
+ if ( $nas_export ) {
+ my $nas = qsearchs('nas', { 'svcnum' => $svc_x->svcnum });
+ if ( $nas ) {
+ $svc_x->set($_, $nas->$_) foreach (fields('nas'));
+ push @$fields, qw(shortname secret type ports server community);
+ $opt->{'labels'}{'shortname'} = 'Short name';
+ $opt->{'labels'}{'secret'} = 'Shared secret';
+ $opt->{'labels'}{'type'} = 'Type';
+ $opt->{'labels'}{'ports'} = 'Ports';
+ $opt->{'labels'}{'server'} = 'Server';
+ $opt->{'labels'}{'community'} = 'Community';
+ } #if $nas
+ } #$nas_export
+};
+
+
+</%init>