X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Ftype_pkgs.pm;h=65037552465b685ac9c43873b555520985845ba6;hb=f9a181e4c2e505df84de16190ee3b75011326f3f;hp=8e0d4ef5655b44a99e7c9beca3f2cf8aeed2bdaa;hpb=6cd87c0d3b5280446301c647fa5f1ec5a593fa3f;p=freeside.git diff --git a/FS/FS/type_pkgs.pm b/FS/FS/type_pkgs.pm index 8e0d4ef56..650375524 100644 --- a/FS/FS/type_pkgs.pm +++ b/FS/FS/type_pkgs.pm @@ -35,6 +35,8 @@ FS::Record. The following fields are currently supported: =over 4 +=item typepkgnum - primary key + =item typenum - Agent type, see L =item pkgpart - Billing item definition, see L @@ -80,25 +82,40 @@ sub check { my $self = shift; my $error = - $self->ut_number('typenum') - || $self->ut_number('pkgpart') + $self->ut_numbern('typepkgnum') + || $self->ut_foreign_key('typenum', 'agent_type', 'typenum' ) + || $self->ut_foreign_key('pkgpart', 'part_pkg', 'pkgpart' ) ; return $error if $error; - return "Unknown typenum" - unless qsearchs( 'agent_type', { 'typenum' => $self->typenum } ); + $self->SUPER::check; +} + +=item part_pkg + +Returns the FS::part_pkg object associated with this record. - return "Unknown pkgpart" - unless qsearchs( 'part_pkg', { 'pkgpart' => $self->pkgpart } ); +=cut - ''; #no error +sub part_pkg { + my $self = shift; + qsearchs( 'part_pkg', { 'pkgpart' => $self->pkgpart } ); } -=back +=item agent_type -=head1 VERSION +Returns the FS::agent_type object associated with this record. -$Id: type_pkgs.pm,v 1.1 1999-08-04 09:03:53 ivan Exp $ +=cut + +sub agent_type { + my $self = shift; + qsearchs( 'agent_type', { 'typenum' => $self->typenum } ); +} + +=cut + +=back =head1 BUGS