X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fmisc%2Flink.cgi;h=f37f769bc3f48d9d1471ec09df88402f1e26817b;hp=79adce88c685c264c195997097f40c83a4f810a1;hb=7d80f005462758e0271215240cdf99a9336f03dd;hpb=0ebeec96313dd7edfca340f01f8fbbbac1f4aa1d diff --git a/httemplate/misc/link.cgi b/httemplate/misc/link.cgi index 79adce88c..f37f769bc 100755 --- a/httemplate/misc/link.cgi +++ b/httemplate/misc/link.cgi @@ -1,45 +1,85 @@ - -<% +<% include("/elements/header.html","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: +% } + + + + +
+
+ +<% include('/elements/footer.html') %> + +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('View/link unlinked services'); my %link_field = ( 'svc_acct' => 'username', 'svc_domain' => 'domain', - 'svc_charge' => '', - 'svc_wo' => '', + 'svc_phone' => 'phonenum', +); + +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+)$/; -} +$cgi->param('pkgnum') =~ /^(\d+)$/ or die 'unparsable pkgnum'; +my $pkgnum = $1; +$cgi->param('svcpart') =~ /^(\d+)$/ or die 'unparsable svcpart'; +my $svcpart = $1; 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}; -print header("Link to existing $svc"), - qq!
!; - -if ( $link_field ) { - print < - - $link_field of existing service: -END -} else { - print qq!Service # of existing service: !; -} - -print < - -

- - - -END - -%> +