projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of git.freeside.biz:/home/git/freeside
[freeside.git]
/
FS
/
FS
/
discount_plan.pm
diff --git
a/FS/FS/discount_plan.pm
b/FS/FS/discount_plan.pm
index
3ae44c8
..
6a45676
100644
(file)
--- a/
FS/FS/discount_plan.pm
+++ b/
FS/FS/discount_plan.pm
@@
-80,19
+80,24
@@
sub new {
$self->{discounted} += $setup;
}
$self->{discounted} += $setup;
}
- if ( $discount->percent ) {
+ if ( $discount->percent
> 0
) {
$discountable += $months * $permonth;
$discountable -= ($discountable * $discount->percent / 100);
$discountable -= ($permonth - $recur); # correct for prorate
$self->{discounted} += $discountable;
}
$discountable += $months * $permonth;
$discountable -= ($discountable * $discount->percent / 100);
$discountable -= ($permonth - $recur); # correct for prorate
$self->{discounted} += $discountable;
}
- els
e
{
+ els
if ( $discount->amount > 0 )
{
$discountable += $recur;
$discountable -= $discount->amount * $recur/$permonth;
$discountable += ($months - 1) * max($permonth - $discount->amount,0);
$discountable += $recur;
$discountable -= $discount->amount * $recur/$permonth;
$discountable += ($months - 1) * max($permonth - $discount->amount,0);
+ $self->{discounted} += $discountable;
+ }
+ else {
+ warn "discountnum ".$discount->discountnum.
+ " has no amount or percentage, ignored\n";
+ $self->{discounted} = $self->{base};
}
}
- $self->{discounted} += $discountable;
push @{ $self->{pkgnums} }, $cust_pkg->pkgnum;
}
else { #no discount
push @{ $self->{pkgnums} }, $cust_pkg->pkgnum;
}
else { #no discount