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
=over 4
+=item typepkgnum - primary key
+
=item typenum - Agent type, see L<FS::agent_type>
=item pkgpart - Billing item definition, see L<FS::part_pkg>
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;
}
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