diff options
author | ivan <ivan> | 2007-02-03 11:36:30 +0000 |
---|---|---|
committer | ivan <ivan> | 2007-02-03 11:36:30 +0000 |
commit | 590603ecaea3184f64530755a76626be8205da49 (patch) | |
tree | 0fdb8164cd74bd4cbbd3c2266b8f8bf4cbb7fc00 /httemplate/search/svc_www.cgi | |
parent | 14e3560b43ca8a747f4210bd784a0315daeb5e9e (diff) |
add customer status column to customer & most other reports. also put the C in ACL in the search/ and graph/ directories.
Diffstat (limited to 'httemplate/search/svc_www.cgi')
-rwxr-xr-x | httemplate/search/svc_www.cgi | 136 |
1 files changed, 78 insertions, 58 deletions
diff --git a/httemplate/search/svc_www.cgi b/httemplate/search/svc_www.cgi index ae1482b9f..d3b0549c4 100755 --- a/httemplate/search/svc_www.cgi +++ b/httemplate/search/svc_www.cgi @@ -1,60 +1,3 @@ -%#my $conf = new FS::Conf; -% -%my $orderby = 'ORDER BY svcnum'; -%my @extra_sql = (); -%if ( $cgi->param('magic') =~ /^(all|unlinked)$/ ) { -% -% push @extra_sql, 'pkgnum IS NULL' -% if $cgi->param('magic') eq 'unlinked'; -% -% if ( $cgi->param('sortby') =~ /^(\w+)$/ ) { -% my $sortby = $1; -% $orderby = "ORDER BY $sortby"; -% } -% -%} elsif ( $cgi->param('svcpart') =~ /^(\d+)$/ ) { -% push @extra_sql, "svcpart = $1"; -%} -% -%my $addl_from = ' LEFT JOIN cust_svc USING ( svcnum ) '. -% ' LEFT JOIN part_svc USING ( svcpart ) '. -% ' LEFT JOIN cust_pkg USING ( pkgnum ) '. -% ' LEFT JOIN cust_main USING ( custnum ) '; -% -%#here is the agent virtualization -%push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql; -% -%my $extra_sql = -% scalar(@extra_sql) -% ? ' WHERE '. join(' AND ', @extra_sql ) -% : ''; -% -% -%my $count_query = 'SELECT COUNT(*) FROM svc_www'; -%my $sql_query = { -% 'table' => 'svc_www', -% 'hashref' => {}, -% 'select' => join(', ', -% 'svc_www.*', -% 'part_svc.svc', -% 'cust_main.custnum', -% FS::UI::Web::cust_sql_fields(), -% ), -% 'extra_sql' => $orderby, -% 'addl_from' => $addl_from, -%}; -% -%my $link = [ "${p}view/svc_www.cgi?", 'svcnum', ]; -%#my $dlink = [ "${p}view/svc_www.cgi?", 'svcnum', ]; -%my $ulink = [ "${p}view/svc_acct.cgi?", 'usersvc', ]; -% -%#smaller false laziness w/svc_*.cgi here -%my $link_cust = sub { -% my $svc_x = shift; -% $svc_x->custnum ? [ "${p}view/cust_main.cgi?", 'custnum' ] : ''; -%}; -% -% <% include( 'elements/search.html', 'title' => 'Virtual Host Search Results', 'name' => 'virtual hosts', @@ -83,9 +26,86 @@ $link, '', $ulink, - ( map { $link_cust } + ( map { $_ ne 'Cust. Status' ? $link_cust : '' } FS::UI::Web::cust_header() ), ], + 'align' => 'rlll'. FS::UI::Web::cust_aligns(), + 'color' => [ + '', + '', + '', + '', + FS::UI::Web::cust_colors(), + ], + 'style' => [ + '', + '', + '', + '', + FS::UI::Web::cust_styles(), + ], ) %> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('List services'); + +#my $conf = new FS::Conf; + +my $orderby = 'ORDER BY svcnum'; +my @extra_sql = (); +if ( $cgi->param('magic') =~ /^(all|unlinked)$/ ) { + + push @extra_sql, 'pkgnum IS NULL' + if $cgi->param('magic') eq 'unlinked'; + + if ( $cgi->param('sortby') =~ /^(\w+)$/ ) { + my $sortby = $1; + $orderby = "ORDER BY $sortby"; + } + +} elsif ( $cgi->param('svcpart') =~ /^(\d+)$/ ) { + push @extra_sql, "svcpart = $1"; +} + +my $addl_from = ' LEFT JOIN cust_svc USING ( svcnum ) '. + ' LEFT JOIN part_svc USING ( svcpart ) '. + ' LEFT JOIN cust_pkg USING ( pkgnum ) '. + ' LEFT JOIN cust_main USING ( custnum ) '; + +#here is the agent virtualization +push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql; + +my $extra_sql = + scalar(@extra_sql) + ? ' WHERE '. join(' AND ', @extra_sql ) + : ''; + + +my $count_query = 'SELECT COUNT(*) FROM svc_www'; +my $sql_query = { + 'table' => 'svc_www', + 'hashref' => {}, + 'select' => join(', ', + 'svc_www.*', + 'part_svc.svc', + 'cust_main.custnum', + FS::UI::Web::cust_sql_fields(), + ), + 'extra_sql' => $orderby, + 'addl_from' => $addl_from, +}; + +my $link = [ "${p}view/svc_www.cgi?", 'svcnum', ]; +#my $dlink = [ "${p}view/svc_www.cgi?", 'svcnum', ]; +my $ulink = [ "${p}view/svc_acct.cgi?", 'usersvc', ]; + +#smaller false laziness w/svc_*.cgi here +my $link_cust = sub { + my $svc_x = shift; + $svc_x->custnum ? [ "${p}view/cust_main.cgi?", 'custnum' ] : ''; +}; + +</%init> |