X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Ftype_pkgs.pm;h=65037552465b685ac9c43873b555520985845ba6;hb=80511cb4158b98db01deec317e5408675487bc6e;hp=efba60dbd846c33a1d50e1c10a2bca9221c7ad23;hpb=c4d2226e0cc4bdd6d9f689b061b5f4f5b9609b0b;p=freeside.git diff --git a/FS/FS/type_pkgs.pm b/FS/FS/type_pkgs.pm index efba60dbd..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,18 +82,13 @@ 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 } ); - - return "Unknown pkgpart" - unless qsearchs( 'part_pkg', { 'pkgpart' => $self->pkgpart } ); - - ''; #no error + $self->SUPER::check; } =item part_pkg @@ -105,13 +102,20 @@ sub part_pkg { qsearchs( 'part_pkg', { 'pkgpart' => $self->pkgpart } ); } +=item agent_type + +Returns the FS::agent_type object associated with this record. + =cut -=back +sub agent_type { + my $self = shift; + qsearchs( 'agent_type', { 'typenum' => $self->typenum } ); +} -=head1 VERSION +=cut -$Id: type_pkgs.pm,v 1.2 2002-10-04 12:57:06 ivan Exp $ +=back =head1 BUGS