1 <& elements/svc_Common.html,
2 table => 'svc_broadband',
5 svc_callback => \&svc_callback,
10 my $conf = FS::Conf->new;
11 my $fields = FS::svc_broadband->table_info->{'fields'};
12 my %labels = map { $_ => ( ref($fields->{$_})
13 ? $fields->{$_}{'label'}
20 $labels{'description'} = emt('Description');
21 $labels{'speed_down'} = emt('Download Speed');
22 $labels{'speed_up'} = emt('Upload Speed');
23 $labels{'ip_addr'} = emt('IP Address');
24 $labels{'usergroup'} = emt('RADIUS groups'); #?
26 $labels{'coordinates'} = 'Latitude/Longitude';
30 { field => 'routernum', value_callback => \&router },
33 { field => 'ip_addr', value_callback => \&ip_addr },
34 { field => 'sectornum', value_callback => \§ornum },
35 { field => 'mac_addr', type=>'mac_addr', value_callback => \&mac_addr },
38 { field => 'coordinates', value_callback => \&coordinates },
46 { field => 'shared_svcnum', value_callback=> \&shared_svcnum, }, #value_callback =>
54 { field => 'usergroup', value_callback => \&usergroup }
55 if $conf->exists('svc_broadband-radius');
59 my $router = $svc->router;
60 my $block = $svc->addr_block;
61 $router = $router->routernum . ': ' . $router->routername if $router;
62 $block = '; '.$block->cidr if $block;
68 my $ip_addr = $svc->ip_addr;
70 $out .= ' (' . include('/elements/popup_link-ping.html', ip => $ip_addr) . ')'
72 if ( my $addr_block = $svc->addr_block ) {
73 $out .= '<br>Netmask: ' . $addr_block->NetAddr->mask .
74 '<br>Gateway: ' . $addr_block->ip_gateway;
81 $svc->mac_addr_formatted('U',':');
86 my $usergroup = $svc->usergroup;
87 join('<BR>', $svc->radius_groups('long_description'));
91 my $svc_broadband = shift;
92 return '' unless $svc_broadband->sectornum;
93 my $tower_sector = $svc_broadband->tower_sector;
94 my $link = $tower_sector->ip_addr
95 ? '<A HREF="http://'. $tower_sector->ip_addr. '">'
98 $link . $tower_sector->description. ( $link ? '</A>' : '');
102 my $s = shift; #$svc_broadband
103 return '' unless $s->latitude && $s->longitude;
105 my $d = $s->description;
108 if ( my $cust_pkg = $s->cust_svc->cust_pkg ) {
109 $d = $cust_pkg->cust_main->name_short;
110 $agentnum = $cust_pkg->cust_main->agentnum;
114 #'Latitude: '. $s->latitude. ', Longitude: '. $s->longitude. ' '.
115 $s->latitude. ', '. $s->longitude. ' '.
116 include('/elements/coord-links.html',
125 my $svc_broadband = shift;
126 return '' unless $svc_broadband->shared_svcnum;
128 my $shared_svc_broadband =
129 qsearchs('svc_broadband', { 'svcnum' => $svc_broadband->shared_svcnum,
134 my $shared_cust_pkg = $shared_svc_broadband->cust_svc->cust_pkg;
136 $shared_svc_broadband->label.
138 ? ' ('. $shared_cust_pkg->cust_main->name. ')'
144 # trying to move to the callback style
145 my ($cgi, $svc_x, $part_svc, $cust_pkg, $fields, $opt) = @_;
147 if ( $part_svc->part_svc_column('latitude')->columnflag eq 'F'
148 && $part_svc->part_svc_column('longitude')->columnflag eq 'F'
151 @$fields = grep { !ref($_) || $_->{field} ne 'coordinates' } @$fields;
154 # again, we assume at most one of these exports per part_svc
155 my ($nas_export) = $part_svc->part_export('broadband_nas');
157 my $nas = qsearchs('nas', { 'svcnum' => $svc_x->svcnum });
159 $svc_x->set($_, $nas->$_) foreach (fields('nas'));
160 push @$fields, qw(shortname secret type ports server community);
161 $opt->{'labels'}{'shortname'} = 'Short name';
162 $opt->{'labels'}{'secret'} = 'Shared secret';
163 $opt->{'labels'}{'type'} = 'Type';
164 $opt->{'labels'}{'ports'} = 'Ports';
165 $opt->{'labels'}{'server'} = 'Server';
166 $opt->{'labels'}{'community'} = 'Community';