1 package FS::part_event::Action::pkg_employee_credit;
4 use base qw( FS::part_event::Action::Mixin::credit_flat
5 FS::part_event::Action );
7 sub description { 'Credit the ordering employee a specific amount'; }
9 #a little false laziness w/pkg_referral_credit
11 my( $self, $cust_pkg, $cust_event ) = @_;
13 my $cust_main = $self->cust_main($cust_pkg);
15 my $employee = $cust_pkg->access_user;
16 return "No customer record for employee ". $employee->username
17 unless $employee->user_custnum;
19 my $employee_cust_main = $employee->user_cust_main;
20 #? or return "No customer record for employee ". $employee->username;
23 my $amount = $self->_calc_credit($cust_pkg, $employee, \$warning);
24 return $warning unless $amount > 0;
26 my $reasonnum = $self->option('reasonnum');
28 my $error = $employee_cust_main->credit(
31 'eventnum' => $cust_event->eventnum,
32 'addlinfo' => 'for customer #'. $cust_main->display_custnum.
33 ': '.$cust_main->name,
35 die "Error crediting customer ". $employee_cust_main->custnum.
36 " for employee commission: $error"