1 <% include( 'elements/search.html',
2 'title' => 'LATA Search Results',
3 'name_singular' => 'LATA',
5 'table' => 'phone_avail',
7 'select' => 'distinct latanum',
9 'count_query' => 'SELECT COUNT(distinct latanum) FROM phone_avail',
17 my $phone_avail = shift;
18 my $lata = $phone_avail->lata;
19 $lata = $lata ? $lata->description : '';
20 $phone_avail->latanum . " - " . $lata;
23 my $latanum = shift->latanum;
24 my $cnt = qsearchs({ 'table' => 'phone_avail',
27 'latanum' => $latanum,
29 'select' => 'count(1) as cnt',
31 ($cnt) ? $cnt->cnt : '';
34 my $latanum = shift->latanum;
35 my $cnt = qsearchs({ 'table' => 'phone_avail',
36 'hashref' => { 'latanum' => $latanum,
37 'svcnum' => { op => '>',
41 'select' => 'count(1) as cnt'
43 ($cnt) ? $cnt->cnt : '';
46 my $phone_avail = shift;
47 return '' unless $phone_avail->latanum;
48 my $latanum = $phone_avail->latanum;
50 my $sql = "select count(1) from cdr where src in
51 (select phonenum from svc_phone where svcnum in (
52 select svcnum from phone_avail where latanum = $latanum
53 and svcnum is not null) )
54 or charged_party in (select phonenum from svc_phone where
55 svcnum in (select svcnum from phone_avail where
56 latanum = $latanum and svcnum is not null) )";
57 my $c = $phone_avail->scalar_sql($sql);
86 unless ( $FS::CurrentUser::CurrentUser->access_right('List inventory')
87 && $FS::CurrentUser::CurrentUser->access_right('List services')
90 # XXX: agent virtualize