summaryrefslogtreecommitdiff
path: root/FS/FS
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2013-08-18 02:01:19 -0700
committerIvan Kohler <ivan@freeside.biz>2013-08-18 02:01:19 -0700
commit5c0cfcb8dec7c4f3a7aecea4c550ffb4bfb774c3 (patch)
tree552c633c19398d8658dbe7c2a23a4ac06948fe2e /FS/FS
parent5f2093d63b321716766535a0ff3e7420882a8888 (diff)
continue sales person work: customer and package selection, commissions, reporting. RT#23402
Diffstat (limited to 'FS/FS')
-rw-r--r--FS/FS/agent.pm15
-rw-r--r--FS/FS/cust_pkg.pm6
2 files changed, 18 insertions, 3 deletions
diff --git a/FS/FS/agent.pm b/FS/FS/agent.pm
index 57093e3..0cd07ef 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 3948c2f..676757e 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 );