X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fpkg_class.pm;h=8b66c1615b8e048c22e337419f7eb97cb2167536;hp=bab6e5e5638dca4995c819b292a70cc981930eb0;hb=5372897f367498972c96f5494e142e6e11b29eb8;hpb=9509e5bfb7f9331303153cac24d7bfecbe2ea9f1 diff --git a/FS/FS/pkg_class.pm b/FS/FS/pkg_class.pm index bab6e5e56..8b66c1615 100644 --- a/FS/FS/pkg_class.pm +++ b/FS/FS/pkg_class.pm @@ -1,11 +1,10 @@ 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 @@ -34,11 +33,23 @@ from FS::Record. The following fields are currently supported: =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 + +Number of associated pkg_category (see L) -=item classname - Text name of this package class +=item disabled -=item disabled - Disabled flag, empty or 'Y' +Disabled flag, empty or 'Y' + +=item fcc_ds0s - Optional DS0 equivalency number for FCC form 477 =back @@ -54,6 +65,13 @@ L<"insert">. =cut sub table { 'pkg_class'; } +sub _target_table { 'part_pkg'; } + +sub check { + my $self = shift; + $self->ut_numbern('fcc_ds0s') + || $self->SUPER::check; +} =item insert @@ -66,18 +84,7 @@ Deletes this package class from the database. Only package classes with no 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. @@ -88,16 +95,24 @@ Checks all fields to make sure this is a valid package class. If there is an 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 @@ -105,9 +120,8 @@ sub check { =head1 SEE ALSO -L, L, schema.html from the base documentation. +L, L =cut 1; -