%my $conf = new FS::Conf;
%
%my @svc_external = ();
%my @h_svc_external = ();
%my $sortby=\*svcnum_sort;
%if ( $cgi->param('magic') =~ /^(all|unlinked)$/ ) {
%
% @svc_external=qsearch('svc_external',{});
%
% if ( $cgi->param('magic') eq 'unlinked' ) {
% @svc_external = grep { qsearchs('cust_svc', {
% 'svcnum' => $_->svcnum,
% 'pkgnum' => '',
% }
% )
% }
% @svc_external;
% }
%
% if ( $cgi->param('sortby') =~ /^(\w+)$/ ) {
% my $sortby = $1;
% if ( $sortby eq 'id' ) {
% $sortby = \*id_sort;
% }
% }
%
%} elsif ( $cgi->param('svcpart') =~ /^(\d+)$/ ) {
%
% @svc_external =
% qsearch( 'svc_external', {}, '',
% " WHERE $1 = ( SELECT svcpart FROM cust_svc ".
% " WHERE cust_svc.svcnum = svc_external.svcnum ) "
% );
%
%} elsif ( $cgi->param('title') =~ /^(.*)$/ ) {
% $sortby=\*id_sort;
% @svc_external=qsearch('svc_external',{ title => $1 });
% if( $cgi->param('history') == 1 ) {
% @h_svc_external=qsearch('h_svc_external',{ title => $1 });
% }
%} elsif ( $cgi->param('id') =~ /^([\w\-\.]+)$/ ) {
% my $id = $1;
% @svc_external = qsearchs('svc_external',{'id'=>$id});
%}
%
%if ( scalar(@svc_external) == 1 ) {
%
%
<% $cgi->redirect(popurl(2). "view/svc_external.cgi?". $svc_external[0]->svcnum) %>
%
%
%} elsif ( scalar(@svc_external) == 0 ) {
%
%
<% include('/elements/header.html', 'External Search Results' ) %>
No matching external services found
% } else {
%
%
<% include('/elements/header.html', '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' %> |
%
% foreach my $svc_external (
% sort $sortby (@svc_external)
% ) {
% my($svcnum, $id, $title)=(
% $svc_external->svcnum,
% $svc_external->id,
% $svc_external->title,
% );
%
% my $rowspan = 1;
%
% print <
% $svcnum |
% $id |
% $title |
%END
%
% #print @rows;
% print "";
%
% }
% if( scalar(@h_svc_external) > 0 ) {
% print <
%
%
% Freeside ID |
% Service # |
% Title |
% Date |
%
%HTML
%
% foreach my $h_svc ( @h_svc_external ) {
% my($svcnum, $id, $title, $user, $date)=(
% $h_svc->svcnum,
% $h_svc->id,
% $h_svc->title,
% $h_svc->history_user,
% $h_svc->history_date,
% );
% my $rowspan = 1;
% my ($h_cust_svc) = qsearchs( 'h_cust_svc', {
% svcnum => $svcnum,
% });
% my $cust_pkg = qsearchs( 'cust_pkg', {
% pkgnum => $h_cust_svc->pkgnum,
% });
% my $custnum = $cust_pkg->custnum;
%
% print <
% $custnum |
% $svcnum |
% $title |
% $date |
%
%END
% }
% }
%
% print <
%
%