X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcdr.pm;h=5658be94bede972a1b9cf22f05528fc94485f9b0;hb=c27f80ec10180391d00286bf50dfbf09a96c1b00;hp=b16cb8648caa07d28907fbbbc8c723b35d1a5744;hpb=e19de946a48c91ed05a9267b4425ff5dd98da1e5;p=freeside.git diff --git a/FS/FS/cdr.pm b/FS/FS/cdr.pm index b16cb8648..5658be94b 100644 --- a/FS/FS/cdr.pm +++ b/FS/FS/cdr.pm @@ -680,8 +680,19 @@ sub rate_prefix { # (or calling station id for toll free calls) ### + my $eff_ratenum = $self->is_tollfree('accountcode') + ? $part_pkg->option_cacheable('accountcode_tollfree_ratenum') + : ''; + my( $to_or_from, $column ); - if ( $self->is_tollfree && ! $part_pkg->option_cacheable('disable_tollfree') ) + if( + ( $self->is_tollfree + && ! $part_pkg->option_cacheable('disable_tollfree') + ) + or ( $eff_ratenum + && $part_pkg->option_cacheable('accountcode_tollfree_field') eq 'src' + ) + ) { #tollfree call $to_or_from = 'from'; $column = 'src'; @@ -702,10 +713,6 @@ sub rate_prefix { #asterisks here causes inserting the detail to barf, so: $pretty_dst =~ s/\*//g; - my $eff_ratenum = $self->is_tollfree('accountcode') - ? $part_pkg->option_cacheable('accountcode_tollfree_ratenum') - : ''; - my $ratename = ''; my $intrastate_ratenum = $part_pkg->option_cacheable('intrastate_ratenum'); if ( $intrastate_ratenum && !$self->is_tollfree ) { @@ -904,7 +911,7 @@ sub rate_prefix { #${$opt{region_group_included_min}} -= $minutes # if $region_group && $rate_detail->region_group; - if ( $included_min->{$regionnum}{$ratetimenum} > $minutes ) { + if ( $included_min->{$regionnum}{$ratetimenum} >= $minutes ) { $charge_sec = 0; $included_min->{$regionnum}{$ratetimenum} -= $minutes; } else {