RT#39638: VoIP Usage cost reporting
[freeside.git] / FS / FS / cdr.pm
index cdca6fc..f8fea35 100644 (file)
@@ -214,6 +214,7 @@ sub table_info {
         #'upstream_rateplanid'   => '',
         #'ratedetailnum'         => '',
         'rated_price'           => 'Rated price',
+        'rated_cost'            => 'Rated cost',
         #'distance'              => '',
         #'islocal'               => '',
         #'calltypenum'           => '',
@@ -463,7 +464,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.
+rated_classnum, rated_ratename, and set_rate_cost (if true, will set
+a recalculated L</rate_cost> 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.
 
@@ -501,6 +504,8 @@ 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'};
+
     return $self->replace();
 
   }
@@ -1000,6 +1005,7 @@ 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,
   );
 
 }