summaryrefslogtreecommitdiff
path: root/httemplate/misc/link.cgi
blob: f4b70f76aa1bf39852df0e294c0450ac16030991 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<%
#<!-- $Id: link.cgi,v 1.2 2001-08-21 02:31:56 ivan Exp $ -->

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 $cgi->header( '-expires' => 'now' ), header("Link to existing $svc"),
      qq!<FORM ACTION="!, popurl(1), qq!process/link.cgi" METHOD=POST>!;

if ( $link_field ) { 
  print <<END;
  <INPUT TYPE="hidden" NAME="svcnum" VALUE="">
  <INPUT TYPE="hidden" NAME="link_field" VALUE="$link_field">
  $link_field of existing service: <INPUT TYPE="text" NAME="link_value">
END
} else {
  print qq!Service # of existing service: <INPUT TYPE="text" NAME="svcnum" VALUE="">!;
}

print <<END;
<INPUT TYPE="hidden" NAME="pkgnum" VALUE="$pkgnum">
<INPUT TYPE="hidden" NAME="svcpart" VALUE="$svcpart">
<P><CENTER><INPUT TYPE="submit" VALUE="Link"></CENTER>
    </FORM>
  </BODY>
</HTML>
END

%>