X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcdr.pm;h=a2b9a8ccbfd18c8bc48b0fdab830c622e1c4301b;hb=5c1f29673647a123c6ccb0e999676f286ce0b9f6;hp=e40b0921a454e2a5e810b4b8e1947ea3a4f4a98d;hpb=9d4be18318e5f4baaaa7fd5f995bc307a8dc7f2b;p=freeside.git diff --git a/FS/FS/cdr.pm b/FS/FS/cdr.pm index e40b0921a..a2b9a8ccb 100644 --- a/FS/FS/cdr.pm +++ b/FS/FS/cdr.pm @@ -469,9 +469,9 @@ Sets the status and rated price. Available options are: inbound, rated_pretty_dst, rated_regionname, rated_seconds, rated_minutes, rated_granularity, rated_ratedetailnum, -rated_classnum, rated_ratename, and set_rate_cost (if true, will set -a recalculated L in the rated_cost field after the other -fields are set; does not work with inbound.) +rated_classnum, rated_ratename. If rated_ratedetailnum is provided, +will also set a recalculated L in the rated_cost field +after the other fields are set (does not work with inbound.) If there is an error, returns the error, otherwise returns false. @@ -509,7 +509,7 @@ sub set_status_and_rated_price { qw( pretty_dst regionname seconds minutes granularity ratedetailnum classnum ratename ); $self->svcnum($svcnum) if $svcnum; - $self->rated_cost($self->rate_cost) if $opt{'set_rate_cost'}; + $self->rated_cost($self->rate_cost) if $opt{'rated_ratedetailnum'}; return $self->replace(); @@ -546,6 +546,9 @@ sub parse_number { my $field = $options{column} || 'dst'; my $intl = $options{international_prefix} || '011'; + # Still, don't break anyone's CDR rating if they have an empty string in + # there. Require an explicit statement that there's no prefix. + $intl = '' if lc($intl) eq 'none'; my $countrycode = ''; my $number = $self->$field(); @@ -924,8 +927,10 @@ sub rate_prefix { # by default, set the included minutes for this region/time to # what's in the rate_detail - $included_min->{$regionnum}{$ratetimenum} = $rate_detail->min_included - unless exists $included_min->{$regionnum}{$ratetimenum}; + if (!exists( $included_min->{$regionnum}{$ratetimenum} )) { + $included_min->{$regionnum}{$ratetimenum} = + ($rate_detail->min_included * $cust_pkg->quantity || 1); + } if ( $included_min->{$regionnum}{$ratetimenum} >= $minutes ) { $charge_sec = 0; @@ -1010,7 +1015,6 @@ sub rate_prefix { 'rated_ratedetailnum' => $rate_detail->ratedetailnum, 'rated_classnum' => $rate_detail->classnum, #rated_ratedetailnum? 'rated_ratename' => $ratename, #not rate_detail - Intrastate/Interstate - 'set_rate_cost' => 1, ); } @@ -1260,6 +1264,10 @@ my %export_names = ( 'name' => 'Number of calls, one line per service', 'invoice_header' => 'Caller,Rate,Messages,Price', }, + 'sum_duration' => { + 'name' => 'Summary, one line per service', + 'invoice_header' => 'Caller,Rate,Calls,Minutes,Price', + }, 'sum_duration_prefix' => { 'name' => 'Summary, one line per destination prefix', 'invoice_header' => 'Caller,Rate,Calls,Minutes,Price', @@ -1268,6 +1276,10 @@ my %export_names = ( 'name' => 'Summary, one line per usage class', 'invoice_header' => 'Caller,Class,Calls,Price', }, + 'sum_duration_accountcode' => { + 'name' => 'Summary, one line per accountcode', + 'invoice_header' => 'Caller,Rate,Calls,Minutes,Price', + }, ); my %export_formats = ();