X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fsvc_broadband.cgi;h=d4baf35a0a4b106d2c5664fa78b9ba1bea7993a6;hb=7aef2e455fe8a4722036f231ee8609ac63b2a9c9;hp=ae7f50fca0e80056a618e941f6e0d6e0d19e06bc;hpb=0fb307c305e4bc2c9c27dc25a3308beae3a4d33c;p=freeside.git diff --git a/httemplate/edit/svc_broadband.cgi b/httemplate/edit/svc_broadband.cgi index ae7f50fca..d4baf35a0 100644 --- a/httemplate/edit/svc_broadband.cgi +++ b/httemplate/edit/svc_broadband.cgi @@ -1,12 +1,13 @@ -<% include('elements/svc_Common.html', +<& elements/svc_Common.html, 'post_url' => popurl(1). 'process/svc_broadband.cgi', 'name' => 'broadband service', 'table' => 'svc_broadband', 'fields' => \@fields, 'field_callback' => $callback, 'dummy' => $cgi->query_string, - ) -%> + 'onsubmit' => 'validate_coords', + 'html_foot' => $js, +&> <%init> die "access denied" @@ -17,12 +18,100 @@ die "access denied" my $conf = new FS::Conf; +my $js = < + function validate_coords(f){ +END +; +if ( $conf->exists('svc_broadband-require-nw-coordinates') ) { +$js .= < 59 ) { + s /= 1000; + } else { + s /= 60; + } + s /= 60; + + m /= 60; + if ( m > 59 ) { + alert('Invalid coordinate with minutes > 59'); + return false; + } + + var tmp = parseInt(d)+parseInt(m)+parseInt(s); + tmp = tmp.toFixed(8); + coord = (neg ? -1 : 1) * tmp; + + if(coord < lower) { + alert('Error: invalid coordinate < '+lower); + return false; + } + if(coord > upper) { + alert('Error: invalid coordinate > '+upper); + return false; + } + + return true; +END +; +} +$js .= < +END +; + my @fields = ( qw( description ip_addr speed_down speed_up blocknum ), { field=>'block_label', type=>'fixed' }, - qw( mac_addr latitude longitude altitude vlan_profile performance_profile authkey plan_id ) + qw( mac_addr latitude longitude altitude vlan_profile + performance_profile authkey plan_id ), ); +if ( $conf->exists('svc_broadband-radius') ) { + push @fields, + { field => 'usergroup', + type => 'select-radius_group', + multiple => 1, + } +} + + my $fixedblock = ''; my $callback = sub { @@ -36,10 +125,17 @@ my $callback = sub { my $columndef = $part_svc->part_svc_column($fieldref->{'field'}); if ($columndef->columnflag eq 'F') { - $fieldref->{'type'} = 'fixed'; + $fieldref->{'type'} = length($columndef->columnvalue) + ? 'fixed' + : 'hidden'; $fieldref->{'value'} = $columndef->columnvalue; $fixedblock = $fieldref->{value} if $fieldref->{field} eq 'blocknum'; + + if ( $fieldref->{field} eq 'usergroup' ) { + $fieldref->{'formatted_value'} = + [ $object->radius_groups('long_description') ]; + } } if ($object->svcnum) {