1 <% include( 'elements/search.html',
2 'title' => 'Phone Number (DID) Search Results',
3 'name_singular' => 'phone number',
5 'table' => 'phone_avail',
10 FS::UI::Web::cust_sql_fields(),
12 'extra_sql' => $search,
13 'addl_from' => $addl_from,
15 'count_query' => $count_query,
21 FS::UI::Web::cust_header(),
27 '+'. $pn->countrycode. ' '.
28 $pn->npa. ' '. $pn->nxx. '-'. $pn->station;
33 \&FS::UI::Web::cust_fields,
35 'align' => 'rllll'.FS::UI::Web::cust_aligns(),
40 '', #XXX #$export_link
42 ( map { $_ ne 'Cust. Status' ? $link_cust : '' }
43 FS::UI::Web::cust_header()
52 FS::UI::Web::cust_colors(),
60 FS::UI::Web::cust_styles(),
67 unless $FS::CurrentUser::CurrentUser->access_right('Import');
71 if ( $cgi->param('availbatch') =~ /^([\w\/\:\-\.]+)$/ ) {
72 push @search, "availbatch = '$1'";
75 # #here is the agent virtualization
76 # push @search, $FS::CurrentUser::CurrentUser->agentnums_sql;
78 my $search = scalar(@search)
79 ? ' WHERE '. join(' AND ', @search)
83 my $addl_from = ' LEFT JOIN cust_svc USING ( svcnum ) '.
84 #' LEFT JOIN part_svc USING ( svcpart ) '.
85 ' LEFT JOIN cust_pkg USING ( pkgnum ) '.
86 ' LEFT JOIN cust_main USING ( custnum ) ';
88 my $count_query = "SELECT COUNT(*) FROM phone_avail $search"; #$addl_from?
91 my $phone_avail = shift;
92 if ( $phone_avail->svcnum ) {
93 my $cust_svc = $phone_avail->svc_phone->cust_svc;
94 if ( $cust_svc->pkgnum ) {
95 #my $cust_main = $cust_svc->cust_pkg->cust_main;
96 return [ "${p}view/cust_main.cgi?", 'custnum' ];