sales commission events on invoices, #25847
[freeside.git] / FS / FS / part_event / Action / Mixin / credit_agent_pkg_class.pm
index cb61f1b..488132a 100644 (file)
@@ -1,21 +1,16 @@
 package FS::part_event::Action::Mixin::credit_agent_pkg_class;
-use base qw( FS::part_event::Action::Mixin::credit_pkg );
+
+# calculates a credit percentage on a specific package for use with 
+# credit_pkg or credit_bill, based on an agent's commission table
 
 use strict;
 use FS::Record qw(qsearchs);
 
-sub option_fields {
-  my $class = shift;
-  my %option_fields = $class->SUPER::option_fields;
-  delete $option_fields{'percent'};
-  %option_fields;
-}
-
 sub _calc_credit_percent {
-  my( $self, $cust_pkg ) = @_;
+  my( $self, $cust_pkg, $agent ) = @_;
 
   my $agent_pkg_class = qsearchs( 'agent_pkg_class', {
-    'agentnum' => $self->cust_main($cust_pkg)->agentnum,
+    'agentnum' => $agent->agentnum,
     'classnum' => $cust_pkg->part_pkg->classnum,
   });