<% my %link_field = ( 'svc_acct' => 'username', 'svc_domain' => 'domain', ); my %link_field2 = ( 'svc_acct' => { label => 'Domain', field => 'domsvc', type => 'select', select_table => 'svc_domain', select_key => 'svcnum', select_label => 'domain' }, ); my($query) = $cgi->keywords; my($pkgnum, $svcpart) = ('', ''); foreach $_ (split(/-/,$query)) { #get & untaint pkgnum & svcpart $pkgnum=$1 if /^pkgnum(\d+)$/; $svcpart=$1 if /^svcpart(\d+)$/; } my $part_svc = qsearchs('part_svc',{'svcpart'=>$svcpart}); my $svc = $part_svc->getfield('svc'); my $svcdb = $part_svc->getfield('svcdb'); my $link_field = $link_field{$svcdb}; my $link_field2 = $link_field2{$svcdb}; %> <%= header("Link to existing $svc") %>
<% if ( $link_field ) { %> <%= $link_field %> of existing service:
<% if ( $link_field2 ) { %> <%= $link_field2->{'label'} %> of existing service: <% if ( $link_field2->{'type'} eq 'select' ) { %> <% if ( $link_field2->{'select_table'} ) { %> <% } else { %> Don't know how to process secondary link field for <%= $svcdb %> (type=>select but no select_table) <% } %> <% } else { %> Don't know how to process secondary link field for <%= $svcdb %> (unknown type <%= $link_field2->{'type'} %>) <% } %>
<% } %> <% } else { %> Service # of existing service: <% } %>