1 package FS::part_svc_column;
5 use FS::Record qw( fields );
11 FS::part_svc_column - Object methods for part_svc_column objects
15 use FS::part_svc_column;
17 $record = new FS::part_svc_column \%hash
18 $record = new FS::part_svc_column { 'column' => 'value' };
20 $error = $record->insert;
22 $error = $new_record->replace($old_record);
24 $error = $record->delete;
26 $error = $record->check;
30 An FS::part_svc_column record represents a service definition column
31 constraint. FS::part_svc_column inherits from FS::Record. The following
32 fields are currently supported:
36 =item columnnum - primary key (assigned automatcially for new records)
38 =item svcpart - service definition (see L<FS::part_svc>)
40 =item columnname - column name in part_svc.svcdb table
42 =item columnlabel - label for the column
44 =item columnvalue - default or fixed value for the column
46 =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.
56 Creates a new column constraint. To add the column constraint to the database, see L<"insert">.
60 sub table { 'part_svc_column'; }
64 Adds this service definition to the database. If there is an error, returns
65 the error, otherwise returns false.
69 Deletes this record from the database. If there is an error, returns the
70 error, otherwise returns false.
72 =item replace OLD_RECORD
74 Replaces OLD_RECORD with this one in the database. If there is an error,
75 returns the error, otherwise returns false.
79 Checks all fields to make sure this is a valid record. If there is an error,
80 returns the error, otherwise returns false. Called by the insert and replace
89 $self->ut_numbern('columnnum')
90 || $self->ut_number('svcpart')
91 || $self->ut_alpha('columnname')
92 || $self->ut_textn('columnlabel')
93 || $self->ut_anything('columnvalue')
95 return $error if $error;
97 $self->columnflag =~ /^([DFSMAHX]?)$/
98 or return "illegal columnflag ". $self->columnflag;
99 $self->columnflag(uc($1));
101 if ( $self->columnflag =~ /^[MA]$/ ) {
103 $self->ut_foreign_key( 'columnvalue', 'inventory_class', 'classnum' );
105 if ( $self->columnflag eq 'H' ) {
107 $self->ut_foreign_key( 'columnvalue', 'hardware_class', 'classnum' );
109 return $error if $error;
120 L<FS::Record>, L<FS::part_svc>, L<FS::part_pkg>, L<FS::pkg_svc>,
121 L<FS::cust_svc>, L<FS::svc_acct>, L<FS::svc_forward>, L<FS::svc_domain>,
122 schema.html from the base documentation.