1 <% include( 'elements/search.html',
2 'title' => 'Virtual Host Search Results',
3 'name' => 'virtual hosts',
5 'count_query' => $count_query,
11 FS::UI::Web::cust_header(),
13 'fields' => [ 'svcnum',
15 sub { $_[0]->domain_record->zone },
18 my $svc_acct = $svc_www->svc_acct;
23 \&FS::UI::Web::cust_fields,
29 ( map { $_ ne 'Cust. Status' ? $link_cust : '' }
30 FS::UI::Web::cust_header()
33 'align' => 'rlll'. FS::UI::Web::cust_aligns(),
39 FS::UI::Web::cust_colors(),
46 FS::UI::Web::cust_styles(),
53 unless $FS::CurrentUser::CurrentUser->access_right('List services');
55 #my $conf = new FS::Conf;
57 my $orderby = 'ORDER BY svcnum';
59 if ( $cgi->param('magic') =~ /^(all|unlinked)$/ ) {
61 push @extra_sql, 'pkgnum IS NULL'
62 if $cgi->param('magic') eq 'unlinked';
64 if ( $cgi->param('sortby') =~ /^(\w+)$/ ) {
66 $orderby = "ORDER BY $sortby";
69 } elsif ( $cgi->param('svcpart') =~ /^(\d+)$/ ) {
70 push @extra_sql, "svcpart = $1";
73 my $addl_from = ' LEFT JOIN cust_svc USING ( svcnum ) '.
74 ' LEFT JOIN part_svc USING ( svcpart ) '.
75 ' LEFT JOIN cust_pkg USING ( pkgnum ) '.
76 ' LEFT JOIN cust_main USING ( custnum ) ';
78 #here is the agent virtualization
79 push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql(
80 'null_right' => 'View/link unlinked services'
85 ? ' WHERE '. join(' AND ', @extra_sql )
89 my $count_query = "SELECT COUNT(*) FROM svc_www $addl_from $extra_sql";
93 'select' => join(', ',
97 FS::UI::Web::cust_sql_fields(),
99 'extra_sql' => $extra_sql,
100 'order_by' => $orderby,
101 'addl_from' => $addl_from,
104 my $link = [ "${p}view/svc_www.cgi?", 'svcnum', ];
105 #my $dlink = [ "${p}view/svc_www.cgi?", 'svcnum', ];
106 my $ulink = [ "${p}view/svc_acct.cgi?", 'usersvc', ];
108 #smaller false laziness w/svc_*.cgi here
109 my $link_cust = sub {
111 $svc_x->custnum ? [ "${p}view/cust_main.cgi?", 'custnum' ] : '';