X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Ftype_pkgs.pm;h=8cc2345ff7a33c521324348f1bfc5052ad0dc582;hp=bf34e7cdaba6957bf40b4d2ab088d2272c2b5867;hb=5372897f367498972c96f5494e142e6e11b29eb8;hpb=9509e5bfb7f9331303153cac24d7bfecbe2ea9f1 diff --git a/FS/FS/type_pkgs.pm b/FS/FS/type_pkgs.pm index bf34e7cda..8cc2345ff 100644 --- a/FS/FS/type_pkgs.pm +++ b/FS/FS/type_pkgs.pm @@ -1,12 +1,7 @@ package FS::type_pkgs; +use base qw( FS::Record ); use strict; -use vars qw( @ISA ); -use FS::Record qw( qsearchs ); -use FS::agent_type; -use FS::part_pkg; - -@ISA = qw( FS::Record ); =head1 NAME @@ -83,17 +78,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; } @@ -101,12 +90,9 @@ sub check { Returns the FS::part_pkg object associated with this record. -=cut +=item agent_type -sub part_pkg { - my $self = shift; - qsearchs( 'part_pkg', { 'pkgpart' => $self->pkgpart } ); -} +Returns the FS::agent_type object associated with this record. =cut @@ -116,7 +102,7 @@ sub part_pkg { =head1 SEE ALSO -L, L, L, schema.html from the base +L, L, L, schema.html from the base documentation. =cut