X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_event%2FAction%2Fpkg_referral_credit.pm;h=9d7bbf8b39e73631f45674bca7740d59f8a031dc;hb=ac038da87ce36f915baa38d75c028efe618d4f85;hp=e7c92d6501aa3671175fa4735545b4cbc81991f3;hpb=fb4ab1073f0d15d660c6cdc4e07afebf68ef3924;p=freeside.git diff --git a/FS/FS/part_event/Action/pkg_referral_credit.pm b/FS/FS/part_event/Action/pkg_referral_credit.pm index e7c92d650..9d7bbf8b3 100644 --- a/FS/FS/part_event/Action/pkg_referral_credit.pm +++ b/FS/FS/part_event/Action/pkg_referral_credit.pm @@ -1,7 +1,8 @@ package FS::part_event::Action::pkg_referral_credit; use strict; -use base qw( FS::part_event::Action ); +use base qw( FS::part_event::Action::Mixin::credit_flat + FS::part_event::Action ); sub description { 'Credit the referring customer a specific amount'; } @@ -9,19 +10,6 @@ sub eventtable_hashref { { 'cust_pkg' => 1 }; } -sub option_fields { - ( - 'reasonnum' => { 'label' => 'Credit reason', - 'type' => 'select-reason', - 'reason_class' => 'R', - }, - 'amount' => { 'label' => 'Credit amount', - 'type' => 'money', - }, - ); - -} - sub do_action { my( $self, $cust_pkg, $cust_event ) = @_; @@ -35,7 +23,7 @@ sub do_action { return 'Referring customer is cancelled' if $referring_cust_main->status eq 'cancelled'; - my $amount = $self->_calc_credit($cust_pkg); + my $amount = $self->_calc_credit($cust_pkg, $referring_cust_main); return '' unless $amount > 0; my $reasonnum = $self->option('reasonnum'); @@ -53,10 +41,4 @@ sub do_action { } -sub _calc_credit { - my( $self, $cust_pkg ) = @_; - - $self->option('amount'); -} - 1;