summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorivan <ivan>2009-08-26 10:18:28 +0000
committerivan <ivan>2009-08-26 10:18:28 +0000
commit5f92e7e7cb4a87f4e1b823a4684497cbda498b23 (patch)
tree8c7ebf24505c41c847715eb22a5427f16b321ad0 /FS
parent1a8d05e7a4345862e9ffb71d00bb07dd178017f0 (diff)
add granularity to single_price CDR rating, RT#5495
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/part_pkg/voip_cdr.pm20
1 files changed, 15 insertions, 5 deletions
diff --git a/FS/FS/part_pkg/voip_cdr.pm b/FS/FS/part_pkg/voip_cdr.pm
index 9f150d6..ee00914 100644
--- a/FS/FS/part_pkg/voip_cdr.pm
+++ b/FS/FS/part_pkg/voip_cdr.pm
@@ -35,6 +35,8 @@ tie my %temporalities, 'Tie::IxHash',
'preceding' => "Preceding (past)",
;
+tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities();
+
%info = (
'name' => 'VoIP rating by plan of CDR records in an internal (or external) SQL table',
'shortname' => 'VoIP/telco CDR rating (standard)',
@@ -84,6 +86,11 @@ tie my %temporalities, 'Tie::IxHash',
'min_charge' => { 'name' => 'Charge per minute when using "single price per minute" rating method',
},
+ 'sec_granularity' => { 'name' => 'Granularity when using "single price per minute" rating method',
+ 'type' => 'select',
+ 'select_options' => \%granularity,
+ },
+
'ignore_unrateable' => { 'name' => 'Ignore calls without a rate in the rate tables. By default, the system will throw a fatal error upon encountering unrateable calls.',
'type' => 'checkbox',
},
@@ -199,7 +206,8 @@ tie my %temporalities, 'Tie::IxHash',
'fieldorder' => [qw(
setup_fee recur_fee recur_temporality unused_credit
recur_method cutoff_day
- rating_method ratenum min_charge ignore_unrateable
+ rating_method ratenum min_charge sec_granularity
+ ignore_unrateable
default_prefix
disable_src
domestic_prefix international_prefix
@@ -464,16 +472,18 @@ sub calc_usage {
# a little false laziness w/below
- my $granularity = 60;
+ my $granularity = length($self->option('sec_granularity'))
+ ? $self->option('sec_granularity')
+ : 60;
# length($cdr->billsec) ? $cdr->billsec : $cdr->duration;
my $seconds = $use_duration ? $cdr->duration : $cdr->billsec;
$seconds += $granularity - ( $seconds % $granularity )
if $seconds # don't granular-ize 0 billsec calls (bills them)
- ;#&& $granularity; # 0 is per call
- my $minutes = sprintf("%.1f", $seconds / 60);
- $minutes =~ s/\.0$// ;# if $granularity == 60;
+ && $granularity; # 0 is per call
+ my $minutes = $seconds / 60; # sprintf("%.1f",
+ #$minutes =~ s/\.0$// if $granularity == 60;
# XXX config?
#$charge = sprintf('%.2f', ( $self->option('min_charge') * $minutes )