use strict;
use vars qw( @ISA );
-use FS::Record qw( qsearch qsearchs);
+use FS::Record qw( qsearch qsearchs );
use FS::cust_main;
use FS::agent_type;
$error = $record->check;
+ $agent_type = $record->agent_type;
+
+ $hashref = $record->pkgpart_hashref;
+ #may purchase $pkgpart if $hashref->{$pkgpart};
+
=head1 DESCRIPTION
An FS::agent object represents an agent. Every customer has an agent. Agents
return $error if $error;
return "Unknown typenum!"
- unless qsearchs( 'agent_type', { 'typenum' => $self->typenum } );
+ unless $self->agent_type;
'';
}
+=item agent_type
+
+Returns the FS::agent_type object (see L<FS::agent_type>) for this agent.
+
+=cut
+
+sub agent_type {
+ my $self = shift;
+ qsearchs( 'agent_type', { 'typenum' => $self->typenum } );
+}
+
+=item pkgpart_hashref
+
+Returns a hash reference. The keys of the hash are pkgparts. The value is
+true iff this agent may purchase the specified package definition. See
+L<FS::part_pkg>.
+
+=cut
+
+sub pkgpart_hashref {
+ my $self = shift;
+ $self->agent_type->pkgpart_hashref;
+}
+
=back
=head1 VERSION
-$Id: agent.pm,v 1.3 1998-12-29 11:59:34 ivan Exp $
+$Id: agent.pm,v 1.5 1999-07-20 10:37:05 ivan Exp $
=head1 BUGS
=head1 SEE ALSO
-L<FS::Record>, L<FS::agent_type>, L<FS::cust_main>, schema.html from the base
-documentation.
+L<FS::Record>, L<FS::agent_type>, L<FS::cust_main>, L<FS::part_pkg>,
+schema.html from the base documentation.
=head1 HISTORY