summaryrefslogtreecommitdiff
path: root/FS/FS/part_pkg
diff options
context:
space:
mode:
authorivan <ivan>2005-04-13 03:38:34 +0000
committerivan <ivan>2005-04-13 03:38:34 +0000
commit401318addf234181c96c2e601e29987807975dc1 (patch)
tree36b23c08f6584bf426e897022211693623fd74c7 /FS/FS/part_pkg
parentba6db3949242ec66556f193da0779c9082c0d0aa (diff)
fix bug in flat_commission price plan, thanks to Troy Hammonds
Diffstat (limited to 'FS/FS/part_pkg')
-rw-r--r--FS/FS/part_pkg/flat_comission_cust.pm9
1 files changed, 6 insertions, 3 deletions
diff --git a/FS/FS/part_pkg/flat_comission_cust.pm b/FS/FS/part_pkg/flat_comission_cust.pm
index 27a93ff..9f2e6ca 100644
--- a/FS/FS/part_pkg/flat_comission_cust.pm
+++ b/FS/FS/part_pkg/flat_comission_cust.pm
@@ -38,13 +38,16 @@ sub calc_recur {
my $amount = $self->option('comission_amount');
my $num_active = scalar(
- $cust_pkg->cust_main->referral_cust_pkgcust_main_ncancelled(
+ $cust_pkg->cust_main->referral_cust_main_ncancelled(
$self->option('comission_depth')
)
);
- my $error = $cust_pkg->cust_main->credit( $amount*$num_active, "commission" );
- die $error if $error;
+ if ( $amount && $num_active ) {
+ my $error =
+ $cust_pkg->cust_main->credit( $amount*$num_active, "commission" );
+ die $error if $error;
+ }
$self->option('recur_fee');
}