summaryrefslogtreecommitdiff
path: root/FS/FS
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2013-08-17 23:19:19 -0700
committerIvan Kohler <ivan@freeside.biz>2013-08-17 23:19:19 -0700
commit5f2093d63b321716766535a0ff3e7420882a8888 (patch)
treeebcaed28a5b818c945b3f75b64ac7c0a19fd3072 /FS/FS
parentd5fa12d1022afb592e80803971e90d18eac414e0 (diff)
continue sales person work: customer and package selection, commissions, reporting. RT#23402
Diffstat (limited to 'FS/FS')
-rw-r--r--FS/FS/Sales_Mixin.pm43
-rw-r--r--FS/FS/cust_main.pm2
2 files changed, 44 insertions, 1 deletions
diff --git a/FS/FS/Sales_Mixin.pm b/FS/FS/Sales_Mixin.pm
new file mode 100644
index 0000000..3b30ac9
--- /dev/null
+++ b/FS/FS/Sales_Mixin.pm
@@ -0,0 +1,43 @@
+package FS::Sales_Mixin;
+
+use strict;
+use FS::Record qw( qsearchs );
+use FS::sales;
+
+=head1 NAME
+
+FS::Agent_Mixin - Mixin class for objects that have an sales person.
+
+=over 4
+
+=item sales
+
+Returns the sales person (see L<FS::sales>) for this object.
+
+=cut
+
+sub sales {
+ my $self = shift;
+ qsearchs( 'sales', { 'salesnum' => $self->salesnum } );
+}
+
+=item salesperson
+
+Returns the sales person name for this object, if any.
+
+=cut
+
+sub salesperson {
+ my $self = shift;
+ my $sales = $self->sales or return '';
+ $sales->salesperson;
+}
+
+=back
+
+=head1 BUGS
+
+=cut
+
+1;
+
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 8e7c3e7..ef6628f 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -9,7 +9,7 @@ use base qw( FS::cust_main::Packages FS::cust_main::Status
FS::cust_main::Billing_ThirdParty
FS::cust_main::Location
FS::otaker_Mixin FS::payinfo_Mixin FS::cust_main_Mixin
- FS::geocode_Mixin FS::Quotable_Mixin
+ FS::geocode_Mixin FS::Quotable_Mixin FS::Sales_Mixin
FS::o2m_Common
FS::Record
);