diff options
author | levinse <levinse> | 2011-06-21 22:41:43 +0000 |
---|---|---|
committer | levinse <levinse> | 2011-06-21 22:41:43 +0000 |
commit | a9579d4fc556a54ad76b863cdd19abba79f3fc5f (patch) | |
tree | 6f3e6802bd5691fe438e704a18c0cae6c4c4eff2 | |
parent | 57adda68a7d445553c43eec5cdcb34490d68b522 (diff) |
invoice DID summary performance enhancement, RT10886
-rw-r--r-- | FS/FS/cust_bill.pm | 6 | ||||
-rw-r--r-- | FS/FS/svc_phone.pm | 3 |
2 files changed, 4 insertions, 5 deletions
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 3a543de57..15543a9ea 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -4134,10 +4134,8 @@ sub _did_summary { # increment usage minutes if ( $phone_inserted ) { - my @cdrs = $phone_inserted->get_cdrs('begin'=>$start,'end'=>$end); - foreach my $cdr ( @cdrs ) { - $minutes += $cdr->billsec/60; - } + my @cdrs = $phone_inserted->get_cdrs('begin'=>$start,'end'=>$end,'billsec_sum'=>1); + $minutes = $cdrs[0]->billsec_sum if scalar(@cdrs) == 1; } else { warn "WARNING: no matching h_svc_phone insert record for insert time $inserted, svcnum " . $h_cust_svc->svcnum; diff --git a/FS/FS/svc_phone.pm b/FS/FS/svc_phone.pm index 3d02ca4a3..19bef94fc 100644 --- a/FS/FS/svc_phone.pm +++ b/FS/FS/svc_phone.pm @@ -727,7 +727,8 @@ sub get_cdrs { 'table' => 'cdr', 'hashref' => \%hash, 'extra_sql' => $extra_sql, - 'order_by' => "ORDER BY startdate $for_update", + 'order_by' => $options{'billsec_sum'} ? '' : "ORDER BY startdate $for_update", + 'select' => $options{'billsec_sum'} ? 'sum(billsec) as billsec_sum' : '*', } ); @cdrs; |