X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Ftype_pkgs.pm;h=65037552465b685ac9c43873b555520985845ba6;hp=07ad2bc2bb0b4e85982055c4e69cd3e129d73af3;hb=ad7f49821d40ffd099a45acc32ba91e0e211aede;hpb=f7fd2a3e34da751cbc02bbf215e99c6dc89adc15 diff --git a/FS/FS/type_pkgs.pm b/FS/FS/type_pkgs.pm index 07ad2bc2b..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,17 +82,12 @@ 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 } ); - $self->SUPER::check; } @@ -105,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