package FS::pkg_class;
use strict;
-use vars qw( @ISA );
-use FS::Record qw( qsearch );
+use FS::class_Common;
+use base qw( FS::class_Common );
use FS::part_pkg;
-
-@ISA = qw( FS::Record );
+use FS::pkg_category;
=head1 NAME
=over 4
-=item classnum - primary key (assigned automatically for new package classes)
+=item classnum
+
+primary key (assigned automatically for new package classes)
+
+=item classname
+
+Text name of this package class
+
+=item categorynum
-=item classname - Text name of this package class
+Number of associated pkg_category (see L<FS::pkg_category>)
-=item disabled - Disabled flag, empty or 'Y'
+=item disabled
+
+Disabled flag, empty or 'Y'
=back
=cut
sub table { 'pkg_class'; }
+sub _target_table { 'part_pkg'; }
=item insert
associated package definitions can be deleted. If there is an error, returns
the error, otherwise returns false.
-=cut
-
-sub delete {
- my $self = shift;
-
- return "Can't delete an pkg_class with part_pkg records!"
- if qsearch( 'part_pkg', { 'classnum' => $self->classnum } );
-
- $self->SUPER::delete;
-}
-
-=item replace OLD_RECORD
+=item replace [ OLD_RECORD ]
Replaces OLD_RECORD with this one in the database. If there is an error,
returns the error, otherwise returns false.
error, returns the error, otherwise returns false. Called by the insert and
replace methods.
+=item pkg_category
+
+=item category
+
+Returns the pkg_category record associated with this class, or false if there
+is none.
+
=cut
-sub check {
+sub pkg_category {
my $self = shift;
+ $self->category;
+}
- $self->ut_numbern('classnum')
- or $self->ut_text('classname')
- or $self->SUPER::check;
+=item categoryname
-}
+Returns the category name associated with this class, or false if there
+is none.
=back
=head1 SEE ALSO
-L<FS::Record>, L<FS::part_pkg>, schema.html from the base documentation.
+L<FS::part_pkg>, L<FS::Record>
=cut
1;
-