projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2a28286
)
fix fixed-amount discounts against packages with pkg add-ons, RT#9669
author
ivan
<ivan>
Thu, 19 Aug 2010 10:15:21 +0000
(10:15 +0000)
committer
ivan
<ivan>
Thu, 19 Aug 2010 10:15:21 +0000
(10:15 +0000)
FS/FS/cust_main.pm
patch
|
blob
|
history
FS/FS/part_pkg/flat.pm
patch
|
blob
|
history
diff --git
a/FS/FS/cust_main.pm
b/FS/FS/cust_main.pm
index
ac5e456
..
c0fb5d2
100644
(file)
--- a/
FS/FS/cust_main.pm
+++ b/
FS/FS/cust_main.pm
@@
-3473,6
+3473,7
@@
sub _make_lines {
my %param = ( 'precommit_hooks' => $precommit_hooks,
'increment_next_bill' => $increment_next_bill,
'discounts' => \@discounts,
my %param = ( 'precommit_hooks' => $precommit_hooks,
'increment_next_bill' => $increment_next_bill,
'discounts' => \@discounts,
+ 'real_pkgpart' => $real_pkgpart,
);
my $method = $options{cancel} ? 'calc_cancel' : 'calc_recur';
);
my $method = $options{cancel} ? 'calc_cancel' : 'calc_recur';
diff --git
a/FS/FS/part_pkg/flat.pm
b/FS/FS/part_pkg/flat.pm
index
cc23105
..
648a83d
100644
(file)
--- a/
FS/FS/part_pkg/flat.pm
+++ b/
FS/FS/part_pkg/flat.pm
@@
-154,7
+154,7
@@
sub calc_setup {
sub unit_setup {
my($self, $cust_pkg, $sdate, $details ) = @_;
sub unit_setup {
my($self, $cust_pkg, $sdate, $details ) = @_;
- $self->option('setup_fee');
+ $self->option('setup_fee')
|| 0
;
}
sub calc_recur {
}
sub calc_recur {
@@
-185,7
+185,8
@@
sub calc_discount {
my $discount = $cust_pkg_discount->discount;
#UI enforces one or the other (for now? probably for good)
my $amount = 0;
my $discount = $cust_pkg_discount->discount;
#UI enforces one or the other (for now? probably for good)
my $amount = 0;
- $amount += $discount->amount;
+ $amount += $discount->amount
+ if $cust_pkg->pkgpart == $param->{real_pkgpart};
$amount += sprintf('%.2f', $discount->percent * $br / 100 );
my $chg_months = $param->{'months'} || $cust_pkg->part_pkg->freq;
$amount += sprintf('%.2f', $discount->percent * $br / 100 );
my $chg_months = $param->{'months'} || $cust_pkg->part_pkg->freq;