-if ( $query =~ /^UN_(.*)$/ ) {
- $query = $1;
- $cjoin = 'LEFT JOIN cust_svc USING ( svcnum )';
- push @extra_sql, 'pkgnum IS NULL';
+
+my @header = ( '#', 'Service', 'Account', 'UID' );
+my @fields = ( 'svcnum', 'svc', 'email', 'uid' );
+my @links = ( $link, $link, $link, $link );
+my $align = 'rlll';
+my @color = ( '', '', '', '' );
+my @style = ( '', '', '', '' );
+
+if ( $cgi->param('domain') ) {
+ my $svc_domain =
+ qsearchs('svc_domain', { 'domain' => $cgi->param('domain') } );
+ unless ( $svc_domain ) {
+ #it would be nice if this looked more like the other "not found"
+ #errors, but this will do for now.
+ eidiot "Domain ". $cgi->param('domain'). " not found at all";
+ } else {
+ push @extra_sql, 'domsvc = '. $svc_domain->svcnum;
+ }