[freeside-commits] freeside/FS/FS/part_pkg voip_cdr.pm,1.76,1.77
Ivan,,,
ivan at wavetail.420.am
Wed Aug 26 03:18:30 PDT 2009
Update of /home/cvs/cvsroot/freeside/FS/FS/part_pkg
In directory wavetail.420.am:/tmp/cvs-serv13917
Modified Files:
voip_cdr.pm
Log Message:
add granularity to single_price CDR rating, RT#5495
Index: voip_cdr.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/voip_cdr.pm,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -d -r1.76 -r1.77
--- voip_cdr.pm 17 Aug 2009 20:48:27 -0000 1.76
+++ voip_cdr.pm 26 Aug 2009 10:18:28 -0000 1.77
@@ -35,6 +35,8 @@
'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 @@
'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 @@
'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 @@
# 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 )
More information about the freeside-commits
mailing list