in selfservice display of phone usage, avoid double-counting calls to tollfree number...
authorMark Wells <mark@freeside.biz>
Thu, 1 May 2014 00:12:25 +0000 (17:12 -0700)
committerMark Wells <mark@freeside.biz>
Thu, 1 May 2014 00:12:25 +0000 (17:12 -0700)
FS/FS/ClientAPI/MyAccount.pm
FS/FS/svc_phone.pm

index c75a56b..f21ff54 100644 (file)
@@ -1820,6 +1820,7 @@ sub list_svcs {
                     'inbound' => ( $_ eq 'inbound' ? 1 : 0 ),
                     'begin'   => ($cust_pkg->last_bill || 0),
                     'nonzero' => 1,
+                    'disable_charged_party' => 1,
                   );
                   $hash{$_} = $sum_cdr->hashref;
                 }
@@ -2103,7 +2104,12 @@ sub _list_cdr_usage {
   # we have to return the results all at once...
   my($svc_phone, $begin, $end, %opt) = @_;
   map [ $_->downstream_csv(%opt, 'keeparray' => 1) ],
-    $svc_phone->get_cdrs( 'begin'=>$begin, 'end'=>$end, %opt );
+    $svc_phone->get_cdrs(
+      'begin'=>$begin,
+      'end'=>$end,
+      'disable_charged_party' => 1,
+      %opt
+    );
 }
 
 sub list_cdr_usage {
index 73bb772..9a7bc47 100644 (file)
@@ -725,8 +725,8 @@ Accepts the following options:
 
 =item status => "" (or "processing-tiered", "done"): Return only CDRs with that processing status.
 
-=item inbound => 1: Return CDRs for inbound calls.  With "status", will filter 
-on inbound processing status.
+=item inbound => 1: Return CDRs for inbound calls (that is, those that match
+on 'dst').  With "status", will filter on inbound processing status.
 
 =item default_prefix => "XXX": Also accept the phone number of the service prepended 
 with the chosen prefix.
@@ -737,7 +737,9 @@ with the chosen prefix.
 
 =item calltypenum: Only return CDRs with this call type.
 
-=item disable_src => 1: Only match on "charged_party", not "src".
+=item disable_src => 1: Only match on 'charged_party', not 'src'.
+
+=item disable_charged_party => 1: Only match on 'src', not 'charged_party'.
 
 =item nonzero: Only return CDRs where duration > 0.
 
@@ -777,8 +779,8 @@ sub psearch_cdrs {
 
   } else {
 
-    @fields = ( 'charged_party' );
-    push @fields, 'src' if !$options{'disable_src'};
+    push @fields, 'charged_party' unless $options{'disable_charged_party'};
+    push @fields, 'src' unless $options{'disable_src'};
     $hash{'freesidestatus'} = $options{'status'}
       if exists($options{'status'});
   }