Merge branch 'master' of git.freeside.biz:/home/git/freeside
[freeside.git] / FS / FS / part_event / Action / pkg_employee_credit.pm
index 28fd025..6cbe9bc 100644 (file)
@@ -1,13 +1,14 @@
 package FS::part_event::Action::pkg_employee_credit;
 
 use strict;
-use base qw( FS::part_event::Action::pkg_referral_credit );
+use base qw( FS::part_event::Action::Mixin::credit_flat
+             FS::part_event::Action );
 
 sub description { 'Credit the ordering employee a specific amount'; }
 
 #a little false laziness w/pkg_referral_credit
 sub do_action {
-  my( $self, $cust_pkg ) = @_;
+  my( $self, $cust_pkg, $cust_event ) = @_;
 
   my $cust_main = $self->cust_main($cust_pkg);
 
@@ -18,7 +19,7 @@ sub do_action {
   my $employee_cust_main = $employee->user_cust_main;
     #? or return "No customer record for employee ". $employee->username;
 
-  my $amount    = $self->_calc_credit($cust_pkg);
+  my $amount    = $self->_calc_credit($cust_pkg, $employee);
   return '' unless $amount > 0;
 
   my $reasonnum = $self->option('reasonnum');
@@ -26,8 +27,9 @@ sub do_action {
   my $error = $employee_cust_main->credit(
     $amount, 
     \$reasonnum,
-    'addlinfo' =>
-      'for customer #'. $cust_main->display_custnum. ': '.$cust_main->name,
+    'eventnum' => $cust_event->eventnum,
+    'addlinfo' => 'for customer #'. $cust_main->display_custnum.
+                               ': '.$cust_main->name,
   );
   die "Error crediting customer ". $employee_cust_main->custnum.
       " for employee commission: $error"