1 <& elements/svc_Common.html,
2 'title' => 'Dish Network Search Results',
5 'count_query' => $count_query,
11 FS::UI::Web::cust_header(),
13 'fields' => [ 'svcnum',
17 $cust_pkg_cache{$_[0]->svcnum} ||= $_[0]->cust_svc->cust_pkg;
18 return '' unless $cust_pkg_cache{$_[0]->svcnum};
19 $cust_pkg_cache{$_[0]->svcnum}->ucfirst_status
21 \&FS::UI::Web::cust_fields,
27 ( map { $_ ne 'Cust. Status' ? $link_cust : '' }
28 FS::UI::Web::cust_header()
31 'align' => 'rllr'. FS::UI::Web::cust_aligns(),
37 $cust_pkg_cache{$_[0]->svcnum} ||= $_[0]->cust_svc->cust_pkg;
38 return '' unless $cust_pkg_cache{$_[0]->svcnum};
39 my $c = FS::cust_pkg::statuscolors;
40 $c->{$cust_pkg_cache{$_[0]->svcnum}->status };
42 FS::UI::Web::cust_colors(),
49 FS::UI::Web::cust_styles(),
56 unless $FS::CurrentUser::CurrentUser->access_right('List services');
60 #my $conf = new FS::Conf;
62 my $orderby = 'ORDER BY svcnum';
64 if ( $cgi->param('magic') =~ /^(all|unlinked)$/ ) {
66 push @extra_sql, 'pkgnum IS NULL'
67 if $cgi->param('magic') eq 'unlinked';
69 if ( $cgi->param('sortby') =~ /^(\w+)$/ ) {
71 $orderby = "ORDER BY $sortby";
73 } elsif ( $cgi->param('svcpart') =~ /^(\d+)$/ ) {
74 push @extra_sql, "svcpart = $1";
75 if (defined($cgi->param('cancelled'))) {
76 if ($cgi->param('cancelled')) {
77 push @extra_sql, "cust_pkg.cancel IS NOT NULL";
79 push @extra_sql, "cust_pkg.cancel IS NULL";
84 my $addl_from = ' LEFT JOIN cust_svc USING ( svcnum ) '.
85 ' LEFT JOIN part_svc USING ( svcpart ) '.
86 ' LEFT JOIN cust_pkg USING ( pkgnum ) '.
87 FS::UI::Web::join_cust_main('cust_pkg', 'cust_pkg');
89 #here is the agent virtualization
90 push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql(
91 'null_right' => 'View/link unlinked services'
96 ? ' WHERE '. join(' AND ', @extra_sql )
100 my $count_query = "SELECT COUNT(*) FROM svc_dish $addl_from $extra_sql";
102 'table' => 'svc_dish',
104 'select' => join(', ',
108 FS::UI::Web::cust_sql_fields(),
110 'extra_sql' => $extra_sql,
111 'order_by' => $orderby,
112 'addl_from' => $addl_from,
115 my $link = [ "${p}view/svc_dish.cgi?", 'svcnum', ];
117 my $link_cust = sub {
119 $svc_x->custnum ? [ "${p}view/cust_main.cgi?", 'custnum' ] : '';