-# my @rows = map { /^${svcdb}__(.*)$/; $1 }
-# grep ! /_flag$/,
-# grep /^${svcdb}__/,
-# fields('part_svc');
- foreach my $field (
- grep { $_ ne 'svcnum'
- && ( defined( $self->getfield($svcdb.'__'.$_.'_flag') )
- || $self->getfield($svcdb.'__'.$_.'_label') !~ /^\s*$/ )
- } (fields($svcdb), @fields)
- ) {
- my $part_svc_column = $self->part_svc_column($field);
- my $previous = qsearchs('part_svc_column', {
- 'svcpart' => $self->svcpart,
- 'columnname' => $field,
- } );
+ foreach my $field (fields($svcdb), @fields) {
+ next if $field eq 'svcnum';
+ my $prefix = $svcdb.'__';
+ if ( defined( $self->getfield($prefix.$field.'_flag'))
+ or defined($self->getfield($prefix.$field.'_required'))
+ or length($self->getfield($prefix.$field.'_label'))
+ ) {
+ my $part_svc_column = $self->part_svc_column($field);
+ my $previous = qsearchs('part_svc_column', {
+ 'svcpart' => $self->svcpart,
+ 'columnname' => $field,
+ } );
+
+ my $flag = $self->getfield($prefix.$field.'_flag');
+ my $label = $self->getfield($prefix.$field.'_label');
+ my $required = $self->getfield($prefix.$field.'_required') ? 'Y' : '';
+ if ( uc($flag) =~ /^([A-Z])$/ || $label !~ /^\s*$/ ) {