X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=site_perl%2Fagent_type.pm;h=6ea3d2a70f652c5f987a7c8f6b168ff1aa1c9bb6;hb=19c3d2717fb417187fb0f020a7ba2b065f3f8e30;hp=54a91c8bf0dba3509de2f1d55cb6cdfd8aba8796;hpb=1f2d8690193476319d61b20b78461eb1a3ff106e;p=freeside.git diff --git a/site_perl/agent_type.pm b/site_perl/agent_type.pm index 54a91c8bf..6ea3d2a70 100644 --- a/site_perl/agent_type.pm +++ b/site_perl/agent_type.pm @@ -3,6 +3,8 @@ package FS::agent_type; use strict; use vars qw( @ISA ); use FS::Record qw( qsearch ); +use FS::agent; +use FS::type_pkgs; @ISA = qw( FS::Record ); @@ -25,6 +27,13 @@ FS::agent_type - Object methods for agent_type records $error = $record->check; + $hashref = $record->pkgpart_hashref; + #may purchase $pkgpart if $hashref->{$pkgpart}; + + @type_pkgs = $record->type_pkgs; + + @pkgparts = $record->pkgpart; + =head1 DESCRIPTION An FS::agent_type object represents an agent type. Every agent (see @@ -97,11 +106,49 @@ sub check { } +=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; + my %pkgpart; + $pkgpart{$_}++ foreach $self->pkgpart; + \%pkgpart; +} + +=item type_pkgs + +Returns all FS::type_pkgs objects (see L) for this agent type. + +=cut + +sub type_pkgs { + my $self = shift; + qsearch('type_pkgs', { 'typenum' => $self->typenum } ); +} + +=item pkgpart + +Returns the pkgpart of all package definitions (see L) for this +agent type. + +=cut + +sub pkgpart { + my $self = shift; + map $_->pkgpart, $self->type_pkgs; +} + =back =head1 VERSION -$Id: agent_type.pm,v 1.2 1998-12-29 11:59:35 ivan Exp $ +$Id: agent_type.pm,v 1.3 1999-07-20 10:37:05 ivan Exp $ =head1 BUGS @@ -126,7 +173,11 @@ Changed 'type' to 'atype' because Pg6.3 reserves the type word pod, added check in delete ivan@sisd.com 98-sep-21 $Log: agent_type.pm,v $ -Revision 1.2 1998-12-29 11:59:35 ivan +Revision 1.3 1999-07-20 10:37:05 ivan +cleaned up the new one-screen signup bits in htdocs/edit/cust_main.cgi to +prepare for a signup server + +Revision 1.2 1998/12/29 11:59:35 ivan mostly properly OO, some work still to be done with svc_ stuff