X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fsearch%2Fphone_inventory_provisioned.html;h=52657e70a30ebee9d63192676cfeee091911dd3f;hp=5d4b4217ea80423cf9e16d3b03dfb313b590bd2c;hb=376b1dfc27736a2d7060ad0ca140565c9d3de55d;hpb=fc820438443e859d37b7d8fe6a7b22f46c613cb7 diff --git a/httemplate/search/phone_inventory_provisioned.html b/httemplate/search/phone_inventory_provisioned.html index 5d4b4217e..52657e70a 100644 --- a/httemplate/search/phone_inventory_provisioned.html +++ b/httemplate/search/phone_inventory_provisioned.html @@ -1,65 +1,73 @@ <% 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 #', + 'LATA Description', 'Available', 'Provisioned', 'Have Usage', ], 'fields' => [ 'latanum', - sub { + sub { # LATA Description + my $phone_avail = shift; + return '' unless $phone_avail->lata; + $phone_avail->lata->description; + }, + sub { # Available my $latanum = shift->latanum; - my @dids = qsearch('phone_avail', - { 'svcnum' => '', - 'latanum' => $latanum, - } - ); - return scalar(@dids); + my $cnt = qsearchs({ 'table' => 'phone_avail', + 'hashref' => + { 'svcnum' => '', + 'latanum' => $latanum, + }, + 'select' => 'count(1) as cnt', + }); + ($cnt) ? $cnt->cnt : ''; }, - sub { + sub { # Provisioned my $latanum = shift->latanum; - my @dids = provisioned_dids($latanum); - return scalar(@dids); + my $cnt = qsearchs({ 'table' => 'phone_avail', + 'hashref' => { 'latanum' => $latanum, + 'svcnum' => { op => '>', + value => '0' + }, + }, + 'select' => 'count(1) as cnt' + }); + ($cnt) ? $cnt->cnt : ''; }, - sub { - my $latanum = shift->latanum; - my @dids = provisioned_dids($latanum); - my $count = 0; - foreach my $did ( @dids ) { - next unless $did->cust_svc; - my $svc_phone = $did->cust_svc->svc_x; - next unless $svc_phone; - my @cdrs = $svc_phone->get_cdrs; - $count++ if scalar(@cdrs); - } - $count; + sub { # Have Usage + my $phone_avail = shift; + return '' unless $phone_avail->lata; + $phone_avail->lata->have_usage; }, ], 'align' => 'lccc', 'links' => [ '', - '', - '', - '', + '', + '', + '', ], 'color' => [ '', - '', - '', - '', + '', + '', + '', ], 'style' => [ '', - '', - '', - '', + '', + '', + '', ], ) %> @@ -72,14 +80,4 @@ die "access denied" # XXX: agent virtualize -sub provisioned_dids { - my $latanum = shift; - qsearch({ 'table' => 'phone_avail', - 'hashref' => { - 'latanum' => $latanum, - }, - 'extra_sql' => ' and svcnum is not null ', - }); -} -