X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Ftype_pkgs.pm;h=65037552465b685ac9c43873b555520985845ba6;hp=bf34e7cdaba6957bf40b4d2ab088d2272c2b5867;hb=aed8ec35ccb9cdeb7ea0cb6ff2946f9d83d582f6;hpb=673b9a458d9138523026963df6fa3b4683e09bae diff --git a/FS/FS/type_pkgs.pm b/FS/FS/type_pkgs.pm index bf34e7cda..650375524 100644 --- a/FS/FS/type_pkgs.pm +++ b/FS/FS/type_pkgs.pm @@ -83,17 +83,11 @@ sub check { my $error = $self->ut_numbern('typepkgnum') - || $self->ut_number('typenum') - || $self->ut_number('pkgpart') + || $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 } ); - $self->SUPER::check; } @@ -108,6 +102,17 @@ sub part_pkg { qsearchs( 'part_pkg', { 'pkgpart' => $self->pkgpart } ); } +=item agent_type + +Returns the FS::agent_type object associated with this record. + +=cut + +sub agent_type { + my $self = shift; + qsearchs( 'agent_type', { 'typenum' => $self->typenum } ); +} + =cut =back