% my $conf = new FS::Conf; my($query)=$cgi->keywords; $query ||= ''; #to avoid use of unitialized value errors my(@svc_external,$sortby); if ( $query eq 'svcnum' ) { $sortby=\*svcnum_sort; @svc_external=qsearch('svc_external',{}); } elsif ( $query eq 'id' ) { $sortby=\*id_sort; @svc_external=qsearch('svc_external',{}); } elsif ( $query eq 'UN_svcnum' ) { $sortby=\*svcnum_sort; @svc_external = grep qsearchs('cust_svc',{ 'svcnum' => $_->svcnum, 'pkgnum' => '', }), qsearch('svc_external',{}); } elsif ( $query eq 'UN_id' ) { $sortby=\*id_sort; @svc_external = grep qsearchs('cust_svc',{ 'svcnum' => $_->svcnum, 'pkgnum' => '', }), qsearch('svc_external',{}); } elsif ( $cgi->param('svcpart') =~ /^(\d+)$/ ) { @svc_external = qsearch( 'svc_external', {}, '', " WHERE $1 = ( SELECT svcpart FROM cust_svc ". " WHERE cust_svc.svcnum = svc_external.svcnum ) " ); $sortby=\*svcnum_sort; } else { $cgi->param('id') =~ /^([\w\-\.]+)$/; my($id)=$1; #push @svc_domain, qsearchs('svc_domain',{'domain'=>$domain}); @svc_external = qsearchs('svc_external',{'id'=>$id}); } if ( scalar(@svc_external) == 1 ) { print $cgi->redirect(popurl(2). "view/svc_external.cgi?". $svc_external[0]->svcnum); #exit; } elsif ( scalar(@svc_external) == 0 ) { %> <% eidiot "No matching external services found!\n"; } else { %> <%= header("External Search Results",'') %> <%= scalar(@svc_external) %> matching external services found
Service # | <%= FS::Msgcat::_gettext('svc_external-id') || 'External ID' %> | <%= FS::Msgcat::_gettext('svc_external-title') || 'Title' %> | $svcnum | $id | $title | END #print @rows; print ""; } print <
---|