summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlevinse <levinse>2011-06-21 22:00:32 +0000
committerlevinse <levinse>2011-06-21 22:00:32 +0000
commitfb8915cce4be9520c00cc53c659e34abfb6172e1 (patch)
tree9c6c739de79413cd45d6f950c4fa32b4705b7447
parentc15077a092c6b194923b72d9baaa50573c1ececb (diff)
improve performance of DID provisioning status report, RT10988
-rw-r--r--httemplate/search/phone_inventory_provisioned.html23
1 files changed, 12 insertions, 11 deletions
diff --git a/httemplate/search/phone_inventory_provisioned.html b/httemplate/search/phone_inventory_provisioned.html
index 6302144f8..37fef8a21 100644
--- a/httemplate/search/phone_inventory_provisioned.html
+++ b/httemplate/search/phone_inventory_provisioned.html
@@ -34,20 +34,21 @@
return scalar(@dids);
},
sub { # Have Usage
- my $latanum = shift->latanum;
- my @dids = provisioned_dids($latanum);
-
- warn "have usage ".time;
- return ''; # XXX disabled temporarily
+ my $did_order = shift;
+ my @dids = provisioned_dids($did_order->latanum);
my $count = 0;
foreach my $did ( @dids ) {
- next unless $did->cust_svc;
- my $svc_phone = $did->cust_svc->svc_x;
- warn "inside loop ".time;
- next unless $svc_phone;
- my @cdrs = $svc_phone->get_cdrs;
- $count++ if scalar(@cdrs);
+ my $cust_svc = $did->cust_svc;
+ next unless $cust_svc;
+
+ my $svcnum = $cust_svc->svcnum;
+ my $sql = "select count(1) from cdr where src =
+ (select phonenum from svc_phone where svcnum = $svcnum)
+ or charged_party = (select phonenum from svc_phone where
+ svcnum = $svcnum)";
+ my $c = $did_order->scalar_sql($sql);
+ $count++ if $c > 0;
}
$count;
},