summaryrefslogtreecommitdiff
path: root/FS/FS/part_pkg
diff options
context:
space:
mode:
authormark <mark>2011-02-11 23:59:29 +0000
committermark <mark>2011-02-11 23:59:29 +0000
commit6a10d16ff4e806357abab206254aa38c80a749d3 (patch)
tree94dfb9705ba9d5aa8b3b0d1d96be6ba460115404 /FS/FS/part_pkg
parentca2b8a8c99585a4619eb657f2c7fca12a7304249 (diff)
rate selection by CDR type, RT#10991
Diffstat (limited to 'FS/FS/part_pkg')
-rw-r--r--FS/FS/part_pkg/voip_cdr.pm11
1 files changed, 5 insertions, 6 deletions
diff --git a/FS/FS/part_pkg/voip_cdr.pm b/FS/FS/part_pkg/voip_cdr.pm
index fea38c1..800f929 100644
--- a/FS/FS/part_pkg/voip_cdr.pm
+++ b/FS/FS/part_pkg/voip_cdr.pm
@@ -333,7 +333,7 @@ sub calc_usage {
my $disable_tollfree = $self->option('disable_tollfree');
my $ignore_unrateable = $self->option('ignore_unrateable', 'Hush!');
my $use_duration = $self->option('use_duration');
- my $region_group = ($rating_method eq 'prefix' && $self->option('min_included') > 0);
+ my $region_group = ($rating_method eq 'prefix' && ($self->option('min_included') || 0) > 0);
my $region_group_included_min = $region_group ? $self->option('min_included') : 0;
my $output_format = $self->option('output_format', 'Hush!')
@@ -502,6 +502,7 @@ sub calc_usage {
$rate_detail = $rate->dest_detail({ 'countrycode' => $countrycode,
'phonenum' => $number,
'weektime' => $weektime,
+ 'cdrtypenum' => $cdr->cdrtypenum,
});
if ( $rate_detail ) {
@@ -568,10 +569,7 @@ sub calc_usage {
if $seconds # don't granular-ize 0 billsec calls (bills them)
&& $granularity # 0 is per call
&& $seconds % $granularity;
- my $minutes = $seconds / 60;
- # XXX config?
- #$charge = sprintf('%.2f', ( $self->option('min_charge') * $minutes )
- #+ 0.00000001 ); #so 1.005 rounds to 1.01
+ my $minutes = $granularity ? ($seconds / 60) : 1;
$charge = sprintf('%.4f', ( $self->option('min_charge') * $minutes )
+ 0.0000000001 ); #so 1.00005 rounds to 1.0001
@@ -692,7 +690,8 @@ sub calc_usage {
# choose next rate_detail
$rate_detail = $rate->dest_detail({ 'countrycode' => $countrycode,
'phonenum' => $number,
- 'weektime' => $etime })
+ 'weektime' => $etime,
+ 'cdrtypenum' => $cdr->cdrtypenum })
if($seconds_left);
# we have now moved forward to $etime
$weektime = $etime;