X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fmisc%2Flink.cgi;h=ef72b4a5c808eef417d4a5e2c08a343b5ea96a4a;hb=52dbc041b5ba187cc2a503e5ad2d800b1a2e5a1f;hp=801b92006bd5c0ec00104412e7a3384ab6612b96;hpb=c14a267229fc0d6f2d2afdebab3bd34d825df2ef;p=freeside.git diff --git a/httemplate/misc/link.cgi b/httemplate/misc/link.cgi index 801b92006..ef72b4a5c 100755 --- a/httemplate/misc/link.cgi +++ b/httemplate/misc/link.cgi @@ -1,57 +1,77 @@ -<% -# - -use strict; -use vars qw ( %link_field $cgi $pkgnum $svcpart $query $part_svc $svc $svcdb - $link_field ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(popurl header); -use FS::Record qw(qsearchs); - -%link_field = ( - 'svc_acct' => 'username', - 'svc_domain' => 'domain', - 'svc_acct_sm' => '', - 'svc_charge' => '', - 'svc_wo' => '', -); - -$cgi = new CGI; -cgisuidsetup($cgi); - -($query) = $cgi->keywords; -foreach $_ (split(/-/,$query)) { #get & untaint pkgnum & svcpart - $pkgnum=$1 if /^pkgnum(\d+)$/; - $svcpart=$1 if /^svcpart(\d+)$/; -} - -$part_svc = qsearchs('part_svc',{'svcpart'=>$svcpart}); -$svc = $part_svc->getfield('svc'); -$svcdb = $part_svc->getfield('svcdb'); -$link_field = $link_field{$svcdb}; - -print header("Link to existing $svc"), - qq!
!; - -if ( $link_field ) { - print < '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' +% }, +%); +% +%$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}; +% + +<% include("/elements/header.html","Link to existing $svc") %> + +% if ( $link_field ) { + - - $link_field of existing service: -END -} else { - print qq!Service # of existing service: !; -} - -print < - -

+ + <% $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: +% } + + + + +
-END - -%>