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

Erik Levinson levinse at wavetail.420.am
Mon Jun 20 20:15:03 PDT 2011


Update of /home/cvs/cvsroot/freeside/httemplate/search
In directory wavetail.420.am:/tmp/cvs-serv8341/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.3
retrieving revision 1.1.2.4
diff -u -w -d -r1.1.2.3 -r1.1.2.4
--- phone_inventory_provisioned.html	8 Apr 2011 16:38:25 -0000	1.1.2.3
+++ phone_inventory_provisioned.html	21 Jun 2011 03:15:01 -0000	1.1.2.4
@@ -1,20 +1,25 @@
 <% include( 'elements/search.html',
-              'title'         => 'Phone Number (DID) Search Results',
-              'name_singular' => 'phone number',
+              'title'         => 'LATA Search Results',
+              'name_singular' => 'LATA',
               'query'         => {
                                    'table'   => 'phone_avail',
                                    'hashref' => {},
                                    'select'  => 'distinct latanum',
                                  },
               'count_query'   => 'SELECT COUNT(distinct latanum) FROM phone_avail',
-              'header'        => [ 'LATA #',
+              'header'        => [ 'LATA',
 				   'Available',
 				   'Provisioned',
 				   'Have Usage',
                                  ],
               'fields'        => [
-                'latanum',
-		sub {
+        sub { # LATA
+            my $did_order = shift;
+            my $lata = $did_order->lata;
+            $lata = $lata ? $lata->description : '';
+            $did_order->latanum . " - " . $lata;
+        },
+		sub { # Available
 		    my $latanum = shift->latanum;
 		    my @dids = qsearch('phone_avail',
 					{ 'svcnum' => '',
@@ -23,18 +28,23 @@
 				      );
 		    return scalar(@dids);
 		},
-		sub {
+		sub { # Provisioned
 		    my $latanum = shift->latanum;
 		    my @dids = provisioned_dids($latanum);
 		    return scalar(@dids);
 		},
-		sub {
+		sub { # Have Usage
 		    my $latanum = shift->latanum;
 		    my @dids = provisioned_dids($latanum);
+
+            warn "have usage ".time;
+            return ''; # XXX disabled temporarily
+
 		    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);
@@ -65,6 +75,8 @@
 %>
 <%init>
 
+warn "started @ ".time;
+
 die "access denied"
   unless ( $FS::CurrentUser::CurrentUser->access_right('List inventory')
 	 && $FS::CurrentUser::CurrentUser->access_right('List services')
@@ -75,9 +87,7 @@
 sub provisioned_dids {
     my $latanum = shift;
     qsearch({ 'table' => 'phone_avail',
-	      'hashref' => { 
-		'latanum' => $latanum,
-	      },
+	            'hashref' => { 'latanum' => $latanum, },
 	      'extra_sql' => ' and svcnum is not null ',
 	  });
 }



More information about the freeside-commits mailing list