diff options
author | Christopher Burger <burgerc@freeside.biz> | 2018-07-27 08:05:10 -0400 |
---|---|---|
committer | Christopher Burger <burgerc@freeside.biz> | 2018-07-27 08:05:10 -0400 |
commit | 25efd7207d9ea9be4bea1093917c0d8dc4b1e87a (patch) | |
tree | 489cc6e017136440646a7e205dd8f6e77654b0bd /httemplate | |
parent | 0d4a18f844844d3020f7dc3052baafed44cda564 (diff) |
RT# 78356 - added speed test fields for broadband service and new modifier to get speed from fcc_477 form in package
Diffstat (limited to 'httemplate')
-rwxr-xr-x | httemplate/browse/part_svc.cgi | 1 | ||||
-rw-r--r-- | httemplate/edit/elements/part_svc_column.html | 19 | ||||
-rw-r--r-- | httemplate/edit/elements/svc_Common.html | 10 | ||||
-rwxr-xr-x | httemplate/edit/part_svc.cgi | 4 | ||||
-rw-r--r-- | httemplate/edit/process/elements/process.html | 9 | ||||
-rwxr-xr-x | httemplate/edit/process/part_pkg.cgi | 32 | ||||
-rw-r--r-- | httemplate/edit/svc_broadband.cgi | 3 |
7 files changed, 74 insertions, 4 deletions
diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi index b9474636d..222433db3 100755 --- a/httemplate/browse/part_svc.cgi +++ b/httemplate/browse/part_svc.cgi @@ -251,6 +251,7 @@ my %flag = ( 'A' => 'Automatically filled in from inventory', 'H' => 'Selected from hardware class', 'X' => 'Excluded', + 'P' => 'From package 477 information', ); my %search; diff --git a/httemplate/edit/elements/part_svc_column.html b/httemplate/edit/elements/part_svc_column.html index 816f3428b..bdbce7c79 100644 --- a/httemplate/edit/elements/part_svc_column.html +++ b/httemplate/edit/elements/part_svc_column.html @@ -15,6 +15,7 @@ To be called from part_svc.cgi. # don't allow the 'inventory' flags (M, A) to be chosen for # fields that aren't free-text my $inv_sub = sub { $_[0]->{disable_inventory} || $_[0]->{type} ne 'text' }; + tie my %flag, 'Tie::IxHash', '' => { 'desc' => 'No default', 'condition' => sub { 0 } }, 'D' => { 'desc' => 'Default', @@ -38,6 +39,9 @@ tie my %flag, 'Tie::IxHash', 'H' => { 'desc' => 'Select from hardware class', 'condition' => sub { $_[0]->{type} ne 'select-hardware' }, }, + 'P' => { 'desc' => 'From package FCC 477 information', + 'condition' => sub { $_[0]->{type} ne 'fcc_477_speed' }, # get values from package fcc 477 information + }, 'X' => { 'desc' => 'Excluded', 'condition' => sub { 1 }, # obsolete }, @@ -202,6 +206,20 @@ my %communigate_fields = ( % $mode = 'hardware'; % $multiple = 0; % } +% +% if ( $def->{'type'} eq 'fcc_477_speed' ) { +% if ($field eq 'speed_up') { + <SPAN ID="<% $name %>_select"> + upstream speed + <INPUT TYPE="hidden" ID="<% $name %>_select" NAME="<% $name %>_classnum" VALUE="up"> + </SPAN> +% } elsif ($field eq 'speed_down') { + <SPAN ID="<% $name %>_select"> + downstream speed + <INPUT TYPE="hidden" ID="<% $name %>_select" NAME="<% $name %>_classnum" VALUE="down"> + </SPAN> +% } +% } else { <& /elements/select-table.html, 'field' => $name.'_classnum', 'id' => $name.'_select', @@ -211,6 +229,7 @@ my %communigate_fields = ( 'empty_label' => "Select $mode class", 'multiple' => $multiple, &> +% } % } </TD> <TD> diff --git a/httemplate/edit/elements/svc_Common.html b/httemplate/edit/elements/svc_Common.html index a4e345e40..e1c309080 100644 --- a/httemplate/edit/elements/svc_Common.html +++ b/httemplate/edit/elements/svc_Common.html @@ -169,6 +169,16 @@ ]; } # shouldn't this be enforced for all 'S' fields? + elsif ( $flag eq 'P' ) { #form fcc_477 values + $f->{type} = 'fixed'; + my $cust_pkg = FS::Record::qsearchs({ + 'table' => 'cust_pkg', + 'hashref' => { 'pkgnum' => $object->{Hash}->{pkgnum} } + }); + my $fcc_record = $cust_pkg->fcc_477_record('broadband_'.$columndef->columnvalue.'stream') if $cust_pkg; + $f->{'value'} = $fcc_record->{Hash}->{optionvalue} ? $fcc_record->{Hash}->{optionvalue} * 1000 : ''; + } # end 477 values + if ( $f->{'type'} =~ /^select-svc/ ) { $f->{'include_opt_callback'} = diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index fed21256f..49c1c03d8 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -107,7 +107,7 @@ function flag_changed(obj) { select.multiple = false; } } - } else if ( newflag == 'M' || newflag == 'A' || newflag == 'H' ) { + } else if ( newflag == 'M' || newflag == 'A' || newflag == 'H' || newflag == 'P' ) { // these all require a class selection if ( select ) { select.disabled = false; @@ -120,7 +120,7 @@ function flag_changed(obj) { } var required = document.getElementById(layer + '__' + field + '_required'); if (required && !required.disabledinit) { - if (newflag == "F") { + if (newflag == "F" || newflag =="P") { required.checked = false; required.disabled = true; } else { diff --git a/httemplate/edit/process/elements/process.html b/httemplate/edit/process/elements/process.html index 8c307f0b6..c197eb123 100644 --- a/httemplate/edit/process/elements/process.html +++ b/httemplate/edit/process/elements/process.html @@ -89,6 +89,9 @@ Example: # for use with tables that are FS::option_Common (among other things) 'args_callback' => sub { my( $cgi, $object ) = @_; }, + # if no errors after package insert or replace will update services attached to package. + 'update_svc' => sub { my( $cgi, $object ) = @_; }, + 'debug' => 1, #turns on debugging output #agent virtualization @@ -438,6 +441,12 @@ foreach my $value ( @values ) { } } + if ( !$error and $opt{'update_svc'} ) { + my @args = (); + @args = &{ $opt{'args_callback'} }( $cgi, $new ) if $opt{'args_callback'}; + $error = &{ $opt{'update_svc'} }( $cgi, $new, @args ); + } + if ( $error ) { $cgi->param('error', $error); diff --git a/httemplate/edit/process/part_pkg.cgi b/httemplate/edit/process/part_pkg.cgi index c4d150ba1..6bab20278 100755 --- a/httemplate/edit/process/part_pkg.cgi +++ b/httemplate/edit/process/part_pkg.cgi @@ -9,6 +9,7 @@ 'edit_ext' => 'cgi', 'precheck_callback' => $precheck_callback, 'args_callback' => $args_callback, + 'update_svc' => $update_svc, 'process_locale' => 'pkg', 'process_m2m' => \@process_m2m, 'process_o2m' => \@process_o2m, @@ -199,6 +200,37 @@ my $args_callback = sub { }; +## update services upon package change. +my $update_svc = sub { + my $cgi = shift @_; + my $new = shift @_; + my %args = @_; + my $error; + + my @svcs = $new->pkg_svc(); + + foreach my $svc_part(@svcs) { + my @part_svc_column = qsearch('part_svc_column',{ 'svcpart' => $svc_part->{Hash}->{svcpart}, 'columnflag' => 'P' }); + + if ($svc_part->{Hash}->{svcdb} eq "svc_broadband" && (keys $args{fcc_options}) && @part_svc_column ) { + ## find provisioned services to update + my @svc_svcdb = qsearch({ + 'table' => 'svc_broadband', + 'select' => 'svc_broadband.*, cust_svc.svcpart', + 'addl_from' => 'LEFT JOIN cust_svc USING (svcnum) LEFT JOIN cust_pkg USING (pkgnum)', + 'extra_sql' => " WHERE cust_svc.svcpart = '".$svc_part->{Hash}->{svcpart}."' AND cust_pkg.pkgpart = '".$svc_part->{Hash}->{pkgpart}."'", + }); + foreach my $svc (@svc_svcdb) { + #my $svc_new = $svc; + $svc->{Hash}->{speed_down} = $args{fcc_options}->{broadband_downstream} * 1000; + $svc->{Hash}->{speed_up} = $args{fcc_options}->{broadband_upstream} * 1000; + $error = $svc->replace(); + } + } + } + return $error; +}; + my $redirect_callback = sub { #my( $cgi, $new ) = @_; return '' unless $custnum; diff --git a/httemplate/edit/svc_broadband.cgi b/httemplate/edit/svc_broadband.cgi index 81c694aa5..bcf55fe11 100644 --- a/httemplate/edit/svc_broadband.cgi +++ b/httemplate/edit/svc_broadband.cgi @@ -100,7 +100,7 @@ END ; my @fields = ( - qw( description speed_down speed_up ), + qw( description speed_down speed_up speed_test_down speed_test_up speed_test_latency), { field=>'sectornum', type=>'select-tower_sector', }, { field=>'routernum', type=>'select-router_block_ip', include_opt_callback => sub { @@ -179,7 +179,6 @@ my $svc_field_callback = sub { my $columndef = $part_svc->part_svc_column($fieldref->{'field'}); if ($fieldref->{field} eq 'usergroup' && $columndef->columnflag eq 'F') { - $fieldref->{'formatted_value'} = [ $object->radius_groups('long_description') ]; } |