continue sales person work: customer and package selection, commissions, reporting...
[freeside.git] / FS / FS / Agent_Mixin.pm
diff --git a/FS/FS/Agent_Mixin.pm b/FS/FS/Agent_Mixin.pm
new file mode 100644 (file)
index 0000000..0f84ba9
--- /dev/null
@@ -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;
+