X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_event%2FAction%2FMixin%2Fcredit_pkg.pm;h=a3c1d6efbe88e3da7ff1fdc95ed6eafd77f0d2e3;hb=cc3a43f7d4386297a8babebfdd49646f836db127;hp=aeda92f919aa18d0e1345c1457779876bf52c7a2;hpb=624b2d44625f69d71175c3348cae635d580c890b;p=freeside.git diff --git a/FS/FS/part_event/Action/Mixin/credit_pkg.pm b/FS/FS/part_event/Action/Mixin/credit_pkg.pm index aeda92f91..a3c1d6efb 100644 --- a/FS/FS/part_event/Action/Mixin/credit_pkg.pm +++ b/FS/FS/part_event/Action/Mixin/credit_pkg.pm @@ -16,18 +16,24 @@ sub option_fields { 'type' => 'input-percentage', 'default' => '100', }, - 'what' => { 'label' => 'Of', - 'type' => 'select', - #add additional ways to specify in the package def - 'options' => [ qw( base_recur_permonth unit_setup recur_cost_permonth setup_cost ) ], - 'labels' => { 'base_recur_permonth' => 'Base monthly fee', - 'unit_setup' => 'Setup fee', - 'recur_cost_permonth' => 'Monthly cost', - 'setup_cost' => 'Setup cost', - }, - }, + 'what' => { + 'label' => 'Of', + 'type' => 'select', + #add additional ways to specify in the package def + 'options' => [qw( + base_recur_permonth cust_bill_pkg_recur recur_cost_permonth + unit_setup setup_cost + )], + 'labels' => { + 'base_recur_permonth' => 'Base monthly fee', + 'cust_bill_pkg_recur' => 'Actual invoiced amount of most recent'. + ' recurring charge', + 'recur_cost_permonth' => 'Monthly cost', + 'unit_setup' => 'Setup fee', + 'setup_cost' => 'Setup cost', + }, + }, ); - } #my %no_cust_pkg = ( 'setup_cost' => 1 ); @@ -51,7 +57,7 @@ sub _calc_credit { } } - my $percent = $self->option('percent'); + my $percent = $self->_calc_credit_percent($cust_pkg); #my @arg = $no_cust_pkg{$what} ? () : ($cust_pkg); my @arg = ($what eq 'setup_cost') ? () : ($cust_pkg); @@ -60,4 +66,9 @@ sub _calc_credit { } +sub _calc_credit_percent { + my( $self, $cust_pkg ) = @_; + $self->option('percent'); +} + 1;