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,
});