1 <& elements/svc_Common.html,
2 'title' => 'Virtual Host Search Results',
3 'name' => 'virtual hosts',
5 'count_query' => $count_query,
12 FS::UI::Web::cust_header(),
14 'fields' => [ 'svcnum',
16 sub { $_[0]->domain_record->zone },
19 my $svc_acct = $svc_www->svc_acct;
25 $cust_pkg_cache{$_[0]->svcnum} ||= $_[0]->cust_svc->cust_pkg;
26 return '' unless $cust_pkg_cache{$_[0]->svcnum};
27 $cust_pkg_cache{$_[0]->svcnum}->ucfirst_status
29 \&FS::UI::Web::cust_fields,
36 ( map { $_ ne 'Cust. Status' ? $link_cust : '' }
37 FS::UI::Web::cust_header()
40 'align' => 'rlllr'. FS::UI::Web::cust_aligns(),
47 $cust_pkg_cache{$_[0]->svcnum} ||= $_[0]->cust_svc->cust_pkg;
48 return '' unless $cust_pkg_cache{$_[0]->svcnum};
49 my $c = FS::cust_pkg::statuscolors;
50 $c->{$cust_pkg_cache{$_[0]->svcnum}->status };
52 FS::UI::Web::cust_colors(),
60 FS::UI::Web::cust_styles(),
67 unless $FS::CurrentUser::CurrentUser->access_right('List services');
71 #my $conf = new FS::Conf;
73 my $orderby = 'ORDER BY svcnum';
75 if ( $cgi->param('magic') =~ /^(all|unlinked)$/ ) {
77 push @extra_sql, 'pkgnum IS NULL'
78 if $cgi->param('magic') eq 'unlinked';
80 if ( $cgi->param('sortby') =~ /^(\w+)$/ ) {
82 $orderby = "ORDER BY $sortby";
85 } elsif ( $cgi->param('svcpart') =~ /^(\d+)$/ ) {
86 push @extra_sql, "svcpart = $1";
87 if (defined($cgi->param('cancelled'))) {
88 if ($cgi->param('cancelled')) {
89 push @extra_sql, "cust_pkg.cancel IS NOT NULL";
91 push @extra_sql, "cust_pkg.cancel IS NULL";
96 my $addl_from = ' LEFT JOIN cust_svc USING ( svcnum ) '.
97 ' LEFT JOIN part_svc USING ( svcpart ) '.
98 ' LEFT JOIN cust_pkg USING ( pkgnum ) '.
99 FS::UI::Web::join_cust_main('cust_pkg', 'cust_pkg');
101 #here is the agent virtualization
102 push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql(
103 'null_right' => 'View/link unlinked services'
108 ? ' WHERE '. join(' AND ', @extra_sql )
112 my $count_query = "SELECT COUNT(*) FROM svc_www $addl_from $extra_sql";
114 'table' => 'svc_www',
116 'select' => join(', ',
120 FS::UI::Web::cust_sql_fields(),
122 'extra_sql' => $extra_sql,
123 'order_by' => $orderby,
124 'addl_from' => $addl_from,
127 my $link = [ "${p}view/svc_www.cgi?", 'svcnum', ];
128 #my $dlink = [ "${p}view/svc_www.cgi?", 'svcnum', ];
129 my $ulink = [ "${p}view/svc_acct.cgi?", 'usersvc', ];
131 #smaller false laziness w/svc_*.cgi here
132 my $link_cust = sub {
134 $svc_x->custnum ? [ "${p}view/cust_main.cgi?", 'custnum' ] : '';