projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix cancellation errors with updated flat_introrate, RT#5865
[freeside.git]
/
FS
/
FS
/
part_pkg
/
flat.pm
diff --git
a/FS/FS/part_pkg/flat.pm
b/FS/FS/part_pkg/flat.pm
index
d1863f4
..
02ac6ae
100644
(file)
--- a/
FS/FS/part_pkg/flat.pm
+++ b/
FS/FS/part_pkg/flat.pm
@@
-162,11
+162,11
@@
sub base_recur {
}
sub base_recur_permonth {
}
sub base_recur_permonth {
- my($self, $cust_pkg) = @_;
#$cust_pkg?
+ my($self, $cust_pkg) = @_;
return 0 unless $self->freq =~ /^\d+$/ && $self->freq > 0;
return 0 unless $self->freq =~ /^\d+$/ && $self->freq > 0;
- sprintf('%.2f', $self->base_recur / $self->freq );
+ sprintf('%.2f', $self->base_recur
($cust_pkg)
/ $self->freq );
}
sub calc_remain {
}
sub calc_remain {
@@
-184,7
+184,7
@@
sub calc_remain {
#my $last_bill = $cust_pkg->last_bill || 0;
my $last_bill = $cust_pkg->get('last_bill') || 0; #->last_bill falls back to setup
#my $last_bill = $cust_pkg->last_bill || 0;
my $last_bill = $cust_pkg->get('last_bill') || 0; #->last_bill falls back to setup
- return 0 if ! $self->base_recur
+ return 0 if ! $self->base_recur
($cust_pkg)
|| ! $self->option('unused_credit', 1)
|| ! $last_bill
|| ! $next_bill
|| ! $self->option('unused_credit', 1)
|| ! $last_bill
|| ! $next_bill
@@
-202,7
+202,7
@@
sub calc_remain {
my $freq_sec = $1 * $sec{$2||'m'};
return 0 unless $freq_sec;
my $freq_sec = $1 * $sec{$2||'m'};
return 0 unless $freq_sec;
- sprintf("%.2f", $self->base_recur * ( $next_bill - $time ) / $freq_sec );
+ sprintf("%.2f", $self->base_recur
($cust_pkg)
* ( $next_bill - $time ) / $freq_sec );
}
}
@@
-216,7
+216,7
@@
sub is_prepaid {
sub usage_valuehash {
my $self = shift;
sub usage_valuehash {
my $self = shift;
- map { $_, $self->option($_) }
+ map { $_, $self->option($_) }
grep { $self->option($_, 'hush') }
qw(seconds upbytes downbytes totalbytes);
}
grep { $self->option($_, 'hush') }
qw(seconds upbytes downbytes totalbytes);
}