summaryrefslogtreecommitdiff
path: root/FS/FS/Agent_Mixin.pm
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2013-08-17 22:36:35 -0700
committerIvan Kohler <ivan@freeside.biz>2013-08-17 22:36:35 -0700
commit35125976b65791c4b3f88827639ff44f1b13eb17 (patch)
treee5eb16ea8dfd0a87e516c59d69e08c90e0557b92 /FS/FS/Agent_Mixin.pm
parent34411d71bd3d03966408a9747b542a7d3df08c5d (diff)
continue sales person work: customer and package selection, commissions, reporting. RT#23402
Diffstat (limited to 'FS/FS/Agent_Mixin.pm')
-rw-r--r--FS/FS/Agent_Mixin.pm42
1 files changed, 42 insertions, 0 deletions
diff --git a/FS/FS/Agent_Mixin.pm b/FS/FS/Agent_Mixin.pm
new file mode 100644
index 000000000..0f84ba96a
--- /dev/null
+++ b/FS/FS/Agent_Mixin.pm
@@ -0,0 +1,42 @@
+package FS::Agent_Mixin;
+
+use strict;
+use FS::Record qw( qsearchs );
+use FS::agent;
+
+=head1 NAME
+
+FS::Agent_Mixin - Mixin class for objects that have an agent.
+
+=over 4
+
+=item agent
+
+Returns the agent (see L<FS::agent>) for this object.
+
+=cut
+
+sub agent {
+ my $self = shift;
+ qsearchs( 'agent', { 'agentnum' => $self->agentnum } );
+}
+
+=item agent_name
+
+Returns the agent name (see L<FS::agent>) for this object.
+
+=cut
+
+sub agent_name {
+ my $self = shift;
+ $self->agent->agent;
+}
+
+=back
+
+=head1 BUGS
+
+=cut
+
+1;
+