X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fagent.pm;h=d6171c672ddbe0cca7900cb1fb683c5134d06eca;hb=755159a8654a2eda89badd1498f8def3a472cb15;hp=1dd6796cbd710988044abd9f55f0012ab19a109f;hpb=8de8d7f1a7c7049698cd12a13bd9f9680fbfa5ae;p=freeside.git diff --git a/FS/FS/agent.pm b/FS/FS/agent.pm index 1dd6796cb..d6171c672 100644 --- a/FS/FS/agent.pm +++ b/FS/FS/agent.pm @@ -1,7 +1,7 @@ package FS::agent; use strict; -use vars qw( @ISA ); +use base qw( FS::Commission_Mixin FS::m2m_Common FS::Record ); #use Crypt::YAPassGen; use Business::CreditCard 0.28; use FS::Record qw( dbh qsearch qsearchs ); @@ -12,8 +12,6 @@ use FS::reg_code; use FS::TicketSystem; use FS::Conf; -@ISA = qw( FS::m2m_Common FS::Record ); - =head1 NAME FS::agent - Object methods for agent records @@ -609,6 +607,28 @@ sub num_cancel_cust_pkg { shift->num_pkg_sql(FS::cust_pkg->cancel_sql); } +=item num_on_hold_cust_pkg + +Returns the number of inactive customer packages (one-time packages otherwise +unsuspended/uncancelled) for this agent. + +=cut + +sub num_on_hold_cust_pkg { + shift->num_pkg_sql(FS::cust_pkg->on_hold_sql); +} + +=item num_not_yet_billed_cust_pkg + +Returns the number of inactive customer packages (one-time packages otherwise +unsuspended/uncancelled) for this agent. + +=cut + +sub num_not_yet_billed_cust_pkg { + shift->num_pkg_sql(FS::cust_pkg->not_yet_billed_sql); +} + =item generate_reg_codes NUM PKGPART_ARRAYREF Generates the specified number of registration codes, allowing purchase of the @@ -700,6 +720,16 @@ sub num_sales { $sth->fetchrow_arrayref->[0]; } +sub commission_where { + my $self = shift; + 'cust_credit.commission_agentnum = ' . $self->agentnum; +} + +sub sales_where { + my $self = shift; + 'cust_main.agentnum = ' . $self->agentnum; +} + =back =head1 BUGS