X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_event%2FAction%2Fpkg_employee_credit.pm;h=838d1754a74c4900128d82571c36eff77f26093d;hb=cd3719db530b4bffc1f2fe860bbc7a52f4b2235c;hp=28fd0256ac7f92a1b8b45e2569fdd03030d613bb;hpb=2848f5b5675c28051c3ddbc9b9fb302423a43ca4;p=freeside.git diff --git a/FS/FS/part_event/Action/pkg_employee_credit.pm b/FS/FS/part_event/Action/pkg_employee_credit.pm index 28fd0256a..838d1754a 100644 --- a/FS/FS/part_event/Action/pkg_employee_credit.pm +++ b/FS/FS/part_event/Action/pkg_employee_credit.pm @@ -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,16 +19,18 @@ 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); - return '' unless $amount > 0; + my $warning = ''; + my $amount = $self->_calc_credit($cust_pkg, $employee, \$warning); + return $warning unless $amount > 0; my $reasonnum = $self->option('reasonnum'); 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"