diff options
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/agent.pm | 15 | ||||
-rw-r--r-- | FS/FS/cust_pkg.pm | 6 |
2 files changed, 18 insertions, 3 deletions
diff --git a/FS/FS/agent.pm b/FS/FS/agent.pm index 57093e329..0cd07ef15 100644 --- a/FS/FS/agent.pm +++ b/FS/FS/agent.pm @@ -626,6 +626,21 @@ sub num_prepay_credit { $sth->fetchrow_arrayref->[0]; } +=item num_sales + +Returns the number of non-disabled sales people for this agent. + +=cut + +sub num_sales { + my $self = shift; + my $sth = dbh->prepare( + "SELECT COUNT(*) FROM sales WHERE agentnum = ? + AND ( disabled = '' OR disabled IS NULL )" + ) or die dbh->errstr; + $sth->execute($self->agentnum) or die $sth->errstr; + $sth->fetchrow_arrayref->[0]; +} =back diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index 3948c2ffd..676757ece 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -1,9 +1,9 @@ package FS::cust_pkg; - -use strict; -use base qw( FS::otaker_Mixin FS::cust_main_Mixin +use base qw( FS::otaker_Mixin FS::cust_main_Mixin FS::Sales_Mixin FS::contact_Mixin FS::location_Mixin FS::m2m_Common FS::option_Common ); + +use strict; use vars qw($disable_agentcheck $DEBUG $me); use Carp qw(cluck); use Scalar::Util qw( blessed ); |