summaryrefslogtreecommitdiff
path: root/httemplate/edit/process
diff options
context:
space:
mode:
authorChristopher Burger <burgerc@freeside.biz>2018-07-27 08:05:10 -0400
committerChristopher Burger <burgerc@freeside.biz>2018-07-27 08:05:10 -0400
commit25efd7207d9ea9be4bea1093917c0d8dc4b1e87a (patch)
tree489cc6e017136440646a7e205dd8f6e77654b0bd /httemplate/edit/process
parent0d4a18f844844d3020f7dc3052baafed44cda564 (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/edit/process')
-rw-r--r--httemplate/edit/process/elements/process.html9
-rwxr-xr-xhttemplate/edit/process/part_pkg.cgi32
2 files changed, 41 insertions, 0 deletions
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;