projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
57adda6
)
invoice DID summary performance enhancement, RT10886
author
levinse
<levinse>
Tue, 21 Jun 2011 22:41:43 +0000
(22:41 +0000)
committer
levinse
<levinse>
Tue, 21 Jun 2011 22:41:43 +0000
(22:41 +0000)
FS/FS/cust_bill.pm
patch
|
blob
|
history
FS/FS/svc_phone.pm
patch
|
blob
|
history
diff --git
a/FS/FS/cust_bill.pm
b/FS/FS/cust_bill.pm
index
3a543de
..
15543a9
100644
(file)
--- 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 ) {
# 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;
}
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
3d02ca4
..
19bef94
100644
(file)
--- 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,
'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;
} );
@cdrs;