X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fsvc_acct.cgi;h=e28e00e6127fab71e3598ca10748d5afb6ce8e4f;hb=f363d77173f26ec00eb72ecd9a54374831e04dd0;hp=8d532961832b775e81ec18117b076821cbe5e102;hpb=1fd6d8cf5d7854860ef4fd10ed89828e0c04ec39;p=freeside.git diff --git a/httemplate/search/svc_acct.cgi b/httemplate/search/svc_acct.cgi index 8d5329618..e28e00e61 100755 --- a/httemplate/search/svc_acct.cgi +++ b/httemplate/search/svc_acct.cgi @@ -1,4 +1,3 @@ - <% my $mydomain = ''; @@ -22,13 +21,14 @@ $query ||= ''; #to avoid use of unitialized value errors my $unlinked = ''; if ( $query =~ /^UN_(.*)$/ ) { $query = $1; - $unlinked = ' + my $empty = driver_name =~ /^Pg$/i ? qq('') : qq(""); + $unlinked = " WHERE 0 < ( SELECT count(*) FROM cust_svc WHERE cust_svc.svcnum = svc_acct.svcnum - AND pkgnum IS NULL + AND ( pkgnum IS NULL OR pkgnum = 0 OR pkgnum = $empty ) ) - '; + "; } my(@svc_acct, $sortby); @@ -64,8 +64,14 @@ if ( scalar(@svc_acct) == 1 ) { print $cgi->redirect(popurl(2). "view/svc_acct.cgi?$svcnum"); #redirect #exit; } elsif ( scalar(@svc_acct) == 0 ) { #error +%> + +<% idiot("Account not found"); } else { +%> + +<% $total ||= scalar(@svc_acct); #begin pager @@ -95,7 +101,7 @@ if ( scalar(@svc_acct) == 1 ) { } #end pager - print header("Account Search Results",''), + print header("Account Search Results",menubar('Main Menu'=>popurl(2))), "$total matching accounts found

$pager", &table(), < @@ -136,7 +142,7 @@ END my $conf = new FS::Conf; unless ( $mydomain = $conf->config('domain') ) { die "No legacy domain config file and no svc_domain.svcnum record ". - "for svc_acct.domsvc: ". $cust_svc->domsvc; + "for svc_acct.domsvc: ". $svc_acct->domsvc; } } $domain = "$mydomain*"; @@ -229,7 +235,7 @@ sub uid_sort { sub usernamesearch { - $cgi->param('username') =~ /^([\w\d\-]+)$/; #untaint username_text + $cgi->param('username') =~ /^([\w\-\.\&]+)$/; #untaint username_text my($username)=$1; [ qsearch('svc_acct',{'username'=>$username}) ];