Add the ability to link customer service definition fields to inventory
[freeside.git] / FS / FS / part_svc_column.pm
index 885155b..fb08eaa 100644 (file)
@@ -41,7 +41,7 @@ fields are currently supported:
 
 =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), `M' for manual selection from inventory, or `A' for automatic selection from inventory.  For virtual fields, can also be 'X' for excluded.
 
 =back
 
@@ -91,19 +91,21 @@ sub check {
   ;
   return $error if $error;
 
-  $self->columnflag =~ /^([DFX])$/
+  $self->columnflag =~ /^([DFMAX])$/
     or return "illegal columnflag ". $self->columnflag;
   $self->columnflag(uc($1));
 
+  if ( $self->columnflag =~ /^[MA]$/ ) {
+    $error =
+      $self->ut_foreign_key( 'columnvalue', 'inventory_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