X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=site_perl%2Fagent.pm;h=dab157b3f0821ec3a584b57a970fbae6c3bfe214;hb=1e3eae905b861761f93643aa5fce14a8be5d9ed2;hp=7632d2fca75f5848af38435d3661038c7797929e;hpb=1f2d8690193476319d61b20b78461eb1a3ff106e;p=freeside.git diff --git a/site_perl/agent.pm b/site_perl/agent.pm index 7632d2fca..dab157b3f 100644 --- a/site_perl/agent.pm +++ b/site_perl/agent.pm @@ -2,7 +2,7 @@ package FS::agent; 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; @@ -27,6 +27,11 @@ FS::agent - Object methods for agent records $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 @@ -106,24 +111,48 @@ sub check { 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) 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. + +=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, L, L, schema.html from the base -documentation. +L, L, L, L, +schema.html from the base documentation. =head1 HISTORY