=item columnname - column name in part_svc.svcdb table
+=item columnlabel - label for the column
+
=item columnvalue - default or fixed value for the column
-=item columnflag - null, D, F, X (virtual fields)
+=item columnflag - null or empty (no default), `D' for default, `F' for fixed (unchangeable), `S' for selectable choice, `M' for manual selection from inventory, `A' for automatic selection from inventory, or `H' for selection from a hardware class. For virtual fields, can also be 'X' for excluded.
+
+=item required - column value expected to be true
=back
$self->ut_numbern('columnnum')
|| $self->ut_number('svcpart')
|| $self->ut_alpha('columnname')
+ || $self->ut_textn('columnlabel')
|| $self->ut_anything('columnvalue')
+ || $self->ut_flag('required')
;
return $error if $error;
- $self->columnflag =~ /^([DFX])$/
+ $self->columnflag =~ /^([DFSMAHX]?)$/
or return "illegal columnflag ". $self->columnflag;
$self->columnflag(uc($1));
+ if ( $self->columnflag =~ /^[MA]$/ ) {
+ # split, check all values independently, and normalize
+ my @classnums = split(/\s*,\s*/, $self->columnvalue);
+ foreach (@classnums) {
+ $self->set('columnvalue', $_);
+ $error = $self->ut_foreign_key( 'columnvalue', 'inventory_class', 'classnum' );
+ return $error if $error;
+ }
+ $self->set('columnvalue', join(',', @classnums));
+ }
+ if ( $self->columnflag eq 'H' ) {
+ $error =
+ $self->ut_foreign_key( 'columnvalue', 'hardware_class', 'classnum' );
+ }
+ return $error if $error;
+
$self->SUPER::check;
}
=back
-=head1 VERSION
-
-$Id: part_svc_column.pm,v 1.2 2003-08-05 00:20:44 khoff Exp $
-
=head1 BUGS
=head1 SEE ALSO