[freeside-commits] freeside/httemplate/search phone_inventory_provisioned.html, 1.3, 1.4
Erik Levinson
levinse at wavetail.420.am
Tue Jun 21 15:00:34 PDT 2011
Update of /home/cvs/cvsroot/freeside/httemplate/search
In directory wavetail.420.am:/tmp/cvs-serv30019/httemplate/search
Modified Files:
phone_inventory_provisioned.html
Log Message:
improve performance of DID provisioning status report, RT10988
Index: phone_inventory_provisioned.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/phone_inventory_provisioned.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -d -r1.3 -r1.4
--- phone_inventory_provisioned.html 21 Jun 2011 03:16:59 -0000 1.3
+++ phone_inventory_provisioned.html 21 Jun 2011 22:00:32 -0000 1.4
@@ -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;
},
More information about the freeside-commits
mailing list