X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fpart_svc.pm;h=d68a4618113d0211fa01bffef76d4c2a59f70412;hp=dcc78435b0afac3ba635797bbd496dd4ab1ce77d;hb=8d0e8149e7b19ad8543ac6c8c663be63dbc34762;hpb=f413badbfe4676563d11b528838a21d9ceb8da14 diff --git a/FS/FS/part_svc.pm b/FS/FS/part_svc.pm index dcc78435b..d68a46181 100644 --- a/FS/FS/part_svc.pm +++ b/FS/FS/part_svc.pm @@ -57,7 +57,7 @@ FS::Record. The following fields are currently supported: =item svcdb - table used for this service. See L, L, and L, among others. -=item classnum - Optional service class (see L) +=item classnum - Optional service class (see L) =item disabled - Disabled flag, empty or `Y' @@ -519,6 +519,18 @@ sub part_export_dsl_pull { grep $_->can('dsl_pull'), $self->part_export; } +=item part_export_partsvc + +Returns a list of any exports (see L) for this service that +are capable of pushing a change after part svc is changed. + +=cut + +sub part_export_partsvc { + my $self = shift; + grep $_->can('export_partsvc'), $self->part_export; +} + =item cust_svc [ PKGPART ] Returns a list of associated customer services (FS::cust_svc records). @@ -695,6 +707,11 @@ sub _svc_defs { warn "skipping disabled service FS::$mod" if $DEBUG; next; } + + foreach ("FS::$mod"->virtual_fields_hash) { + $info->{'fields'}->{$_->{'name'}} = $_->{'label'}; + } + $info{$mod} = $info; # all svc_* modules are required to have h_svc_* modules for invoice @@ -861,10 +878,10 @@ sub process { map { my $f = $svcdb.'__'.$_; my $flag = $param->{ $f.'_flag' } || ''; #silence warnings - if ( $flag =~ /^[MAH]$/ ) { + if ( $flag =~ /^[MAHP]$/ ) { $param->{ $f } = delete( $param->{ $f.'_classnum' } ); } - if ( ( $flag =~ /^[MAHS]$/ or $_ eq 'usergroup' ) + if ( ( $flag =~ /^[MAHSP]$/ or $_ eq 'usergroup' ) and ref($param->{ $f }) ) { $param->{ $f } = join(',', @{ $param->{ $f } }); } @@ -886,6 +903,18 @@ sub process { $exportnums{$exportnum} = $role; } } + + ## make sure export required fields are marked required. + my @required_fields; + foreach (keys %exportnums) { + my $export = qsearchs('part_export', { 'exportnum' => $_ }) + if $exportnums{$_}; + if ($export) { + push @required_fields, $export->required_fields if $export->can('required_fields'); + } + } + foreach (@required_fields) { $new->set($_, 'Y'); } + my $error; if ( $param->{'svcpart'} ) { $error = $new->replace( $old, @@ -909,6 +938,11 @@ sub process { ); die "$error\n" if $error; + + foreach my $part_svc_export ( $new->part_export_partsvc ) { + $error = $part_svc_export->export_partsvc($new); + } + return $error if $error; } =item process_bulk_cust_svc