[freeside-commits] freeside/httemplate/search phone_inventory_provisioned.html, 1.1.2.4, 1.1.2.5

Erik Levinson levinse at wavetail.420.am
Tue Jun 21 15:00:35 PDT 2011


Update of /home/cvs/cvsroot/freeside/httemplate/search
In directory wavetail.420.am:/tmp/cvs-serv30030/httemplate/search

Modified Files:
      Tag: FREESIDE_2_1_BRANCH
	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.1.2.4
retrieving revision 1.1.2.5
diff -u -w -d -r1.1.2.4 -r1.1.2.5
--- phone_inventory_provisioned.html	21 Jun 2011 03:15:01 -0000	1.1.2.4
+++ phone_inventory_provisioned.html	21 Jun 2011 22:00:33 -0000	1.1.2.5
@@ -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