diff options
author | jeff <jeff> | 2008-06-19 03:18:19 +0000 |
---|---|---|
committer | jeff <jeff> | 2008-06-19 03:18:19 +0000 |
commit | f13afe5e228a220311557e1ca6dacbf847c26baf (patch) | |
tree | 9cd6b6e511234d72dfa9e8dd8278a721e5ad03eb /FS/FS/pkg_class.pm | |
parent | 795a85c10d898120a2a6341c4df32fb60b069a64 (diff) |
package categories (meta package classes) and grouping invoices by them
Diffstat (limited to 'FS/FS/pkg_class.pm')
-rw-r--r-- | FS/FS/pkg_class.pm | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/FS/FS/pkg_class.pm b/FS/FS/pkg_class.pm index bab6e5e..254282f 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<FS::pkg_category>) + =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 |