X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fsvc_broadband.cgi;h=ae7f50fca0e80056a618e941f6e0d6e0d19e06bc;hb=dd65ba99bb9281571f19744154a3b03bcd3f01ab;hp=25fb009acf5903865fe5adf47464058aae6ce0fc;hpb=a1871d3d13c1dafa93b956762c0d23728d261da7;p=freeside.git diff --git a/httemplate/edit/svc_broadband.cgi b/httemplate/edit/svc_broadband.cgi index 25fb009ac..ae7f50fca 100644 --- a/httemplate/edit/svc_broadband.cgi +++ b/httemplate/edit/svc_broadband.cgi @@ -2,20 +2,6 @@ 'post_url' => popurl(1). 'process/svc_broadband.cgi', 'name' => 'broadband service', 'table' => 'svc_broadband', - 'labels' => { 'svcnum' => 'Service #', - 'description' => 'Description', - 'ip_addr' => 'IP address', - 'speed_down' => 'Download speed', - 'speed_up' => 'Upload speed', - 'blocknum' => 'Router/Block', - 'block_disp' => 'Router/Block', - 'mac_addr' => 'MAC address', - 'latitude' => 'Latitude', - 'longitude' => 'Longitude', - 'altitude' => 'Altitude', - 'vlan_profile' => 'VLAN profile', - 'authkey' => 'Authentication key', - }, 'fields' => \@fields, 'field_callback' => $callback, 'dummy' => $cgi->query_string, @@ -29,12 +15,16 @@ die "access denied" # If it's stupid but it works, it's still stupid. # -Kristian +my $conf = new FS::Conf; + my @fields = ( qw( description ip_addr speed_down speed_up blocknum ), { field=>'block_label', type=>'fixed' }, - qw( mac_addr latitude longitude altitude vlan_profile authkey ) + qw( mac_addr latitude longitude altitude vlan_profile performance_profile authkey plan_id ) ); +my $fixedblock = ''; + my $callback = sub { my ($cgi, $object, $fieldref) = @_; @@ -48,6 +38,8 @@ my $callback = sub { if ($columndef->columnflag eq 'F') { $fieldref->{'type'} = 'fixed'; $fieldref->{'value'} = $columndef->columnvalue; + $fixedblock = $fieldref->{value} + if $fieldref->{field} eq 'blocknum'; } if ($object->svcnum) { @@ -56,13 +48,26 @@ my $callback = sub { if $fieldref->{field} eq 'blocknum'; $fieldref->{value} = $object->addr_block->label - if $fieldref->{field} eq 'block_label'; + if $fieldref->{field} eq 'block_label' && $object->addr_block; } else { - $fieldref->{type} = 'hidden' if $fieldref->{field} eq 'block_label'; + if ($fieldref->{field} eq 'block_label') { + if ($fixedblock && $object->addr_block) { + $object->blocknum($fixedblock); + $fieldref->{value} = $object->addr_block->label; + }else{ + $fieldref->{type} = 'hidden'; + } + } if ($fieldref->{field} eq 'blocknum') { + if ( $fixedblock or $conf->exists('auto_router') ) { + $fieldref->{type} = 'hidden'; + $fieldref->{value} = $fixedblock; + return; + } + my $cust_pkg = qsearchs( 'cust_pkg', {pkgnum => $cgi->param('pkgnum')} ); die "No cust_pkg entry!" unless $cust_pkg; @@ -73,7 +78,8 @@ my $callback = sub { && $FS::CurrentUser::CurrentUser->agentnum($_->agentnum) } map { $_->addr_block } $object->allowed_routers; - my @options = map { $_->blocknum } @addr_block; + my @options = map { $_->blocknum } + sort { $a->label cmp $b->label } @addr_block; my %option_labels = map { ( $_->blocknum => $_->label ) } @addr_block; $fieldref->{type} = 'select'; $fieldref->{options} = \@options;