X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_svc.pm;h=3871573460c00ddcf2a5b40149c9433f8f7f70c0;hb=ac155162693c27f9f26382358c302f548f381d5e;hp=81652c11516c72e12d761ae2865ae05f380250f4;hpb=34e816379204ad4b19d282f5478a566d1465f4ea;p=freeside.git diff --git a/FS/FS/part_svc.pm b/FS/FS/part_svc.pm index 81652c115..387157346 100644 --- a/FS/FS/part_svc.pm +++ b/FS/FS/part_svc.pm @@ -52,7 +52,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' @@ -708,6 +708,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; } } @@ -869,10 +874,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 } }); } @@ -894,6 +899,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,