1 package FS::pkg_category;
5 use FS::Record qw( qsearch );
8 @ISA = qw( FS::Record );
12 FS::pkg_category - Object methods for pkg_category records
18 $record = new FS::pkg_category \%hash;
19 $record = new FS::pkg_category { '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_category object represents an package category. Every package class
32 (see L<FS::pkg_class>) has, optionally, a package category. FS::pkg_category
33 inherits from FS::Record. The following fields are currently supported:
37 =item categorynum - primary key (assigned automatically for new package categoryes)
39 =item categoryname - Text name of this package category
41 =item disabled - Disabled flag, empty or 'Y'
51 Creates a new package category. To add the package category to the database, see
56 sub table { 'pkg_category'; }
60 Adds this package category to the database. If there is an error, returns the
61 error, otherwise returns false.
65 Deletes this package category from the database. Only package categoryes 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_category with pkg_class records!"
75 if qsearch( 'pkg_class', { 'categorynum' => $self->categorynum } );
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 category. If there is an
88 error, returns the error, otherwise returns false. Called by the insert and
96 $self->ut_numbern('categorynum')
97 or $self->ut_text('categoryname')
98 or $self->SUPER::check;
108 L<FS::Record>, L<FS::part_pkg>, schema.html from the base documentation.