X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fsvc_domain.cgi;h=9827b8d3808b36ecff5365e63af397908b9a7dc3;hb=8dba5cb96454bf8ec81333ebac381180731396f1;hp=ecb77792ff49f6f5d009d149e92252ec8a84e28d;hpb=580330233cbf32c58d9f29dc391bd2ebd83e16d5;p=freeside.git diff --git a/httemplate/search/svc_domain.cgi b/httemplate/search/svc_domain.cgi index ecb77792f..9827b8d38 100755 --- a/httemplate/search/svc_domain.cgi +++ b/httemplate/search/svc_domain.cgi @@ -1,27 +1,62 @@ -<% +<% include( 'elements/search.html', + 'title' => "Domain Search Results", + 'name' => 'domains', + 'query' => $sql_query, + 'count_query' => $count_query, + 'redirect' => $link, + 'header' => [ '#', + 'Service', + 'Domain', + FS::UI::Web::cust_header(), + ], + 'fields' => [ 'svcnum', + 'svc', + 'domain', + \&FS::UI::Web::cust_fields, + ], + 'links' => [ $link, + $link, + $link, + ( map { $_ ne 'Cust. Status' ? $link_cust : '' } + FS::UI::Web::cust_header() + ), + ], + 'align' => 'rll'. FS::UI::Web::cust_aligns(), + 'color' => [ + '', + '', + '', + FS::UI::Web::cust_colors(), + ], + 'style' => [ + '', + '', + '', + FS::UI::Web::cust_styles(), + ], + ) +%> +<%init> -my $conf = new FS::Conf; +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('List services'); -my($query)=$cgi->keywords; -$query ||= ''; #to avoid use of unitialized value errors +my $conf = new FS::Conf; my $orderby = 'ORDER BY svcnum'; my %svc_domain = (); my @extra_sql = (); -if ( $query eq 'svcnum' ) { - #$orderby = 'ORDER BY svcnum'; -} elsif ( $query eq 'domain' ) { - $orderby = 'ORDER BY domain'; -} elsif ( $query eq 'UN_svcnum' ) { #UN searches need to be acl'ed (and need to - #fix $agentnums_sql - #$orderby = 'ORDER BY svcnum'; - push @extra_sql, 'pkgnum IS NULL'; -} elsif ( $query eq 'UN_domain' ) { #UN searches need to be acl'ed (and need to - #fix $agentnums_sql - $orderby = 'ORDER BY domain'; - push @extra_sql, 'pkgnum IS NULL'; +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+)$/ ) { - #$orderby = 'ORDER BY svcnum'; push @extra_sql, "svcpart = $1"; } else { $cgi->param('domain') =~ /^([\w\-\.]+)$/; @@ -34,7 +69,9 @@ my $addl_from = ' LEFT JOIN cust_svc USING ( svcnum ) '. ' LEFT JOIN cust_main USING ( custnum ) '; #here is the agent virtualization -push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql; +push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql( + 'null_right' => 'View/link unlinked services' + ); my $extra_sql = ''; if ( @extra_sql ) { @@ -60,7 +97,8 @@ my $sql_query = { 'cust_main.custnum', FS::UI::Web::cust_sql_fields(), ), - 'extra_sql' => "$extra_sql $orderby", + 'extra_sql' => $extra_sql, + 'order_by' => $orderby, 'addl_from' => $addl_from, }; @@ -72,28 +110,4 @@ my $link_cust = sub { $svc_x->custnum ? [ "${p}view/cust_main.cgi?", 'custnum' ] : ''; }; -%><%= include( 'elements/search.html', - 'title' => "Domain Search Results", - 'name' => 'domains', - 'query' => $sql_query, - 'count_query' => $count_query, - 'redirect' => $link, - 'header' => [ '#', - 'Service', - 'Domain', - FS::UI::Web::cust_header(), - ], - 'fields' => [ 'svcnum', - 'svc', - 'domain', - \&FS::UI::Web::cust_fields, - ], - 'links' => [ $link, - $link, - $link, - ( map { $link_cust } - FS::UI::Web::cust_header() - ), - ], - ) -%> +