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
41 =item disabled - Disabled flag, empty or 'Y'
51 Creates a new package class. To add the package class to the database, see
56 sub table { 'pkg_class'; }
60 Adds this package class to the database. If there is an error, returns the
61 error, otherwise returns false.
65 Deletes this package class from the database. Only package classes with no
66 associated package definitions can be deleted. If there is an error, returns
67 the error, otherwise returns false.
74 return "Can't delete an pkg_class with part_pkg records!"
75 if qsearch( 'part_pkg', { 'classnum' => $self->classnum } );
80 =item replace OLD_RECORD
82 Replaces OLD_RECORD with this one in the database. If there is an error,
83 returns the error, otherwise returns false.
87 Checks all fields to make sure this is a valid package class. If there is an
88 error, returns the error, otherwise returns false. Called by the insert and
96 $self->ut_numbern('classnum')
97 or $self->ut_text('classname')
98 or $self->SUPER::check;
108 L<FS::Record>, L<FS::part_pkg>, schema.html from the base documentation.