5 use FS::Record qw( qsearch );
8 @ISA = qw( FS::Record );
12 FS::pkg_class - Object methods for pkg_class records
18 $record = new FS::pkg_class \%hash;
19 $record = new FS::pkg_class { 'column' => 'value' };
21 $error = $record->insert;
23 $error = $new_record->replace($old_record);
25 $error = $record->delete;
27 $error = $record->check;
31 An FS::pkg_class object represents an package class. Every package definition
32 (see L<FS::part_pkg>) has, optionally, a package class. FS::pkg_class inherits
33 from FS::Record. The following fields are currently supported:
37 =item classnum - primary key (assigned automatically for new package classes)
39 =item classname - Text name of this package class
49 Creates a new package class. To add the package class to the database, see
54 sub table { 'pkg_class'; }
58 Adds this package class to the database. If there is an error, returns the
59 error, otherwise returns false.
63 Deletes this package class from the database. Only package classes with no
64 associated package definitions can be deleted. If there is an error, returns
65 the error, otherwise returns false.
72 return "Can't delete an pkg_class with part_pkg records!"
73 if qsearch( 'part_pkg', { 'classnum' => $self->classnum } );
78 =item replace OLD_RECORD
80 Replaces OLD_RECORD with this one in the database. If there is an error,
81 returns the error, otherwise returns false.
85 Checks all fields to make sure this is a valid package class. If there is an
86 error, returns the error, otherwise returns false. Called by the insert and
94 $self->ut_numbern('classnum')
95 or $self->ut_text('classname')
96 or $self->SUPER::check;
106 L<FS::Record>, L<FS::part_pkg>, schema.html from the base documentation.