From 401318addf234181c96c2e601e29987807975dc1 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 13 Apr 2005 03:38:34 +0000 Subject: [PATCH] fix bug in flat_commission price plan, thanks to Troy Hammonds --- CREDITS | 4 ++-- FS/FS/part_pkg/flat_comission_cust.pm | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CREDITS b/CREDITS index 048fbf508..e2ebcd282 100644 --- a/CREDITS +++ b/CREDITS @@ -134,8 +134,8 @@ probably overlooked. Rebecca Cardennis created the great new logo first released with 1.4.2beta1 and 1.5.0pre6. -Troy Hammonds sent in RADIUS session history viewing -code and other things I'm probably forgetting. +Troy Hammonds sent in RADIUS session history viewing, +many bugfixes and other things I'm probably forgetting. Contains the "Javascript Remote Scripting (JSRS)" client library by Brent Ashley diff --git a/FS/FS/part_pkg/flat_comission_cust.pm b/FS/FS/part_pkg/flat_comission_cust.pm index 27a93ff79..9f2e6ca0b 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'); } -- 2.11.0