X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_pkg%2Fdiscount_Mixin.pm;h=e411c84e8038abc7a8f2e9b939b8107d2156a736;hb=e2d16c850d8857567023f10b8c57daf0570c6a8e;hp=ecbab09c95bfe8dd5573a3878f0b41b712e34cab;hpb=9527575801494bc501c555928e4bf922049b0abe;p=freeside.git diff --git a/FS/FS/part_pkg/discount_Mixin.pm b/FS/FS/part_pkg/discount_Mixin.pm index ecbab09c9..e411c84e8 100644 --- a/FS/FS/part_pkg/discount_Mixin.pm +++ b/FS/FS/part_pkg/discount_Mixin.pm @@ -4,6 +4,7 @@ use strict; use vars qw( %info ); use Time::Local qw( timelocal ); use List::Util qw( min ); +use FS::Record qw( qsearchs ); use FS::cust_pkg; use FS::cust_bill_pkg_discount; @@ -122,17 +123,13 @@ sub calc_discount { if ( $discount->percent > 0 ) { $amount = $discount->percent * $param->{'setup_charge'} / 100; - } elsif ( $discount->amount > 0 && ($discount->months || 0) == 1) { + } elsif ( $discount->amount > 0 ) { # apply the discount amount, up to a maximum of the setup charge $amount = min($discount->amount, $param->{'setup_charge'}); $discount_left = sprintf('%.2f', $discount->amount - $amount); # transfer remainder of discount, if any, to recur $param->{'discount_left_recur'}{$discount->discountnum} = $discount_left; - } else { - # I guess we don't allow multiple-month flat amount discounts to - # apply to setup? - next; - } + } } else {