summaryrefslogtreecommitdiff
path: root/httemplate/search/svc_www.cgi
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/search/svc_www.cgi')
-rwxr-xr-xhttemplate/search/svc_www.cgi39
1 files changed, 28 insertions, 11 deletions
diff --git a/httemplate/search/svc_www.cgi b/httemplate/search/svc_www.cgi
index b0f1d5c80..ae1482b9f 100755
--- a/httemplate/search/svc_www.cgi
+++ b/httemplate/search/svc_www.cgi
@@ -1,16 +1,35 @@
+%#my $conf = new FS::Conf;
%
+%my $orderby = 'ORDER BY svcnum';
+%my @extra_sql = ();
+%if ( $cgi->param('magic') =~ /^(all|unlinked)$/ ) {
%
-%#my $conf = new FS::Conf;
+% push @extra_sql, 'pkgnum IS NULL'
+% if $cgi->param('magic') eq 'unlinked';
%
-%my($query)=$cgi->keywords;
-%$query ||= ''; #to avoid use of unitialized value errors
-%my $orderby;
-%if ( $query eq 'svcnum' ) {
-% $orderby = 'ORDER BY svcnum';
-%} else {
-% eidiot('unimplemented');
+% 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',
@@ -22,9 +41,7 @@
% FS::UI::Web::cust_sql_fields(),
% ),
% 'extra_sql' => $orderby,
-% 'addl_from' => 'LEFT JOIN cust_svc USING ( svcnum )'.
-% 'LEFT JOIN cust_pkg USING ( pkgnum )'.
-% 'LEFT JOIN cust_main USING ( custnum )',
+% 'addl_from' => $addl_from,
%};
%
%my $link = [ "${p}view/svc_www.cgi?", 'svcnum', ];