1 <% include('elements/svc_Common.html',
2 'post_url' => popurl(1). 'process/svc_broadband.cgi',
3 'name' => 'broadband service',
4 'table' => 'svc_broadband',
5 'labels' => { 'svcnum' => 'Service #',
6 'description' => 'Description',
7 'ip_addr' => 'IP address',
8 'speed_down' => 'Download speed',
9 'speed_up' => 'Upload speed',
10 'blocknum' => 'Router/Block',
11 'block_label' => 'Router/Block',
12 'mac_addr' => 'MAC address',
13 'latitude' => 'Latitude',
14 'longitude' => 'Longitude',
15 'altitude' => 'Altitude',
16 'vlan_profile' => 'VLAN profile',
17 'performance_profile' => 'Performance profile',
18 'authkey' => 'Authentication key',
21 'field_callback' => $callback,
22 'dummy' => $cgi->query_string,
28 unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific?
30 # If it's stupid but it works, it's still stupid.
33 my $conf = new FS::Conf;
36 qw( description ip_addr speed_down speed_up blocknum ),
37 { field=>'block_label', type=>'fixed' },
38 qw( mac_addr latitude longitude altitude vlan_profile performance_profile authkey )
44 my ($cgi, $object, $fieldref) = @_;
46 my $svcpart = $object->svcnum ? $object->cust_svc->svcpart
47 : $cgi->param('svcpart');
49 my $part_svc = qsearchs( 'part_svc', { svcpart => $svcpart } );
50 die "No part_svc entry!" unless $part_svc;
52 my $columndef = $part_svc->part_svc_column($fieldref->{'field'});
53 if ($columndef->columnflag eq 'F') {
54 $fieldref->{'type'} = 'fixed';
55 $fieldref->{'value'} = $columndef->columnvalue;
56 $fixedblock = $fieldref->{value}
57 if $fieldref->{field} eq 'blocknum';
60 if ($object->svcnum) {
62 $fieldref->{type} = 'hidden'
63 if $fieldref->{field} eq 'blocknum';
65 $fieldref->{value} = $object->addr_block->label
66 if $fieldref->{field} eq 'block_label';
70 if ($fieldref->{field} eq 'block_label') {
72 $object->blocknum($fixedblock);
73 $fieldref->{value} = $object->addr_block->label;
75 $fieldref->{type} = 'hidden';
79 if ($fieldref->{field} eq 'blocknum') {
80 if ( $fixedblock or $conf->exists('auto_router') ) {
81 $fieldref->{type} = 'hidden';
82 $fieldref->{value} = $fixedblock;
86 my $cust_pkg = qsearchs( 'cust_pkg', {pkgnum => $cgi->param('pkgnum')} );
87 die "No cust_pkg entry!" unless $cust_pkg;
89 $object->svcpart($part_svc->svcpart);
92 || $cust_pkg->cust_main->agentnum == $_->agentnum
93 && $FS::CurrentUser::CurrentUser->agentnum($_->agentnum)
95 map { $_->addr_block } $object->allowed_routers;
96 my @options = map { $_->blocknum } @addr_block;
97 my %option_labels = map { ( $_->blocknum => $_->label ) } @addr_block;
98 $fieldref->{type} = 'select';
99 $fieldref->{options} = \@options;
100 $fieldref->{labels} = \%option_labels;