X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fpart_svc.pm;h=d68a4618113d0211fa01bffef76d4c2a59f70412;hp=341559594b0a9040e12590e6d7e4052d82009b3d;hb=20f03d52cc6c930f610c0b4466eeeeda54fdbb40;hpb=ec34b8903d969fe8ac4ff6947a92e16e07f71fa0 diff --git a/FS/FS/part_svc.pm b/FS/FS/part_svc.pm index 341559594..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' @@ -707,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 @@ -873,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 } }); } @@ -898,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,