diff options
author | ivan <ivan> | 2010-04-01 08:10:05 +0000 |
---|---|---|
committer | ivan <ivan> | 2010-04-01 08:10:05 +0000 |
commit | 2946a850409f34e56fc484e940a2f938101fb60e (patch) | |
tree | 80d5b6894da99aa00d84c80d6eab733480109d61 /FS | |
parent | b66775c3f693b5204d8f88afba17cb2aeae05120 (diff) |
fix nasty discount fallout (i hope)
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/part_pkg/flat.pm | 12 | ||||
-rw-r--r-- | FS/FS/part_pkg/subscription.pm | 6 |
2 files changed, 8 insertions, 10 deletions
diff --git a/FS/FS/part_pkg/flat.pm b/FS/FS/part_pkg/flat.pm index 8cffaffa7..6db6eee24 100644 --- a/FS/FS/part_pkg/flat.pm +++ b/FS/FS/part_pkg/flat.pm @@ -158,8 +158,7 @@ sub unit_setup { } sub calc_recur { - my $self = shift; - my($cust_pkg) = @_; + my($self, $cust_pkg, $sdate, $details, $param ) = @_; #my $last_bill = $cust_pkg->last_bill; my $last_bill = $cust_pkg->get('last_bill'); #->last_bill falls back to setup @@ -167,18 +166,17 @@ sub calc_recur { return 0 if $self->option('recur_temporality', 1) eq 'preceding' && $last_bill == 0; - my $br = $self->base_recur(@_); + my $br = $self->base_recur($cust_pkg); - my $discount = $self->calc_discount(@_); + my $discount = $self->calc_discount($cust_pkg, $sdate, $details, $param); sprintf('%.2f', $br - $discount); } sub calc_discount { - my $self = shift; - my($cust_pkg, $sdate, $details, $param ) = @_; + my($self, $cust_pkg, $sdate, $details, $param ) = @_; - my $br = $self->base_recur(@_); + my $br = $self->base_recur($cust_pkg); my $tot_discount = 0; #UI enforces just 1 for now, will need ordering when they can be stacked diff --git a/FS/FS/part_pkg/subscription.pm b/FS/FS/part_pkg/subscription.pm index 825f5cad6..a5e026224 100644 --- a/FS/FS/part_pkg/subscription.pm +++ b/FS/FS/part_pkg/subscription.pm @@ -91,7 +91,7 @@ use FS::part_pkg::flat; ); sub calc_recur { - my($self, $cust_pkg, $sdate ) = @_; + my($self, $cust_pkg, $sdate, $details, $param ) = @_; my $cutoff_day = $self->option('cutoff_day', 1) || 1; my $mnow = $$sdate; my ($sec,$min,$hour,$mday,$mon,$year) = (localtime($mnow) )[0,1,2,3,4,5]; @@ -103,9 +103,9 @@ sub calc_recur { $$sdate = timelocal(0,0,0,$cutoff_day,$mon,$year); - my $br = $self->base_recur(@_); + my $br = $self->base_recur($cust_pkg); - my $discount = $self->calc_discount(@_); + my $discount = $self->calc_discount($cust_pkg, $sdate, $details, $param); sprintf('%.2f', $br - $discount); } |