X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fpkg_class.pm;h=254282fbfe941dc46856b2047747555d4c291073;hp=bab6e5e5638dca4995c819b292a70cc981930eb0;hb=f13afe5e228a220311557e1ca6dacbf847c26baf;hpb=795a85c10d898120a2a6341c4df32fb60b069a64 diff --git a/FS/FS/pkg_class.pm b/FS/FS/pkg_class.pm index bab6e5e56..254282fbf 100644 --- a/FS/FS/pkg_class.pm +++ b/FS/FS/pkg_class.pm @@ -2,8 +2,9 @@ package FS::pkg_class; use strict; use vars qw( @ISA ); -use FS::Record qw( qsearch ); +use FS::Record qw( qsearchs qsearch ); use FS::part_pkg; +use FS::pkg_category; @ISA = qw( FS::Record ); @@ -38,6 +39,8 @@ from FS::Record. The following fields are currently supported: =item classname - Text name of this package class +=item categorynum - Number of associated pkg_category (see L) + =item disabled - Disabled flag, empty or 'Y' =back @@ -95,10 +98,35 @@ sub check { $self->ut_numbern('classnum') or $self->ut_text('classname') + or $self->ut_foreign_keyn('categorynum', 'pkg_category', 'categorynum') or $self->SUPER::check; } +=item pkg_category + +Returns the pkg_category record associated with this class, or false if there +is none. + +=cut + +sub pkg_category { + my $self = shift; + qsearchs('pkg_category', { 'categorynum' => $self->categorynum } ); +} + +=item categoryname + +Returns the category name associated with this class, or false if there +is none. + +=cut + +sub categoryname { + my $pkg_category = shift->pkg_category; + $pkg_category->categoryname if $pkg_category; +} + =back =head1 BUGS