initial checkin of module files for proper perl installation
[freeside.git] / htdocs / edit / process / svc_domain.cgi
1 #!/usr/bin/perl -Tw
2 #
3 # $Id: svc_domain.cgi,v 1.6 1999-02-28 00:03:47 ivan Exp $
4 #
5 # Usage: post form to:
6 #        http://server.name/path/svc_domain.cgi
7 #
8 # lots of yucky stuff in this one... bleachlkjhui!
9 #
10 # ivan@voicenet.com 97-jan-6
11 #
12 # kludged for new domain template 3.5
13 # ivan@voicenet.com 97-jul-24
14 #
15 # moved internic bits to svc_domain.pm ivan@sisd.com 98-mar-14
16 #
17 # Changes to allow page to work at a relative position in server
18 #       bmccane@maxbaud.net     98-apr-3
19 #
20 # $Log: svc_domain.cgi,v $
21 # Revision 1.6  1999-02-28 00:03:47  ivan
22 # removed misleading comments
23 #
24 # Revision 1.5  1999/02/07 09:59:33  ivan
25 # more mod_perl fixes, and bugfixes Peter Wemm sent via email
26 #
27 # Revision 1.4  1999/01/19 05:14:01  ivan
28 # for mod_perl: no more top-level my() variables; use vars instead
29 # also the last s/create/new/;
30 #
31 # Revision 1.3  1999/01/18 22:48:02  ivan
32 # s/create/new/g; and use fields('table_name')
33 #
34 # Revision 1.2  1998/12/17 08:40:30  ivan
35 # s/CGI::Request/CGI.pm/; etc
36 #
37
38 use strict;
39 use vars qw( $cgi $svcnum $new $error );
40 use CGI;
41 use CGI::Carp qw(fatalsToBrowser);
42 use FS::UID qw(cgisuidsetup);
43 use FS::Record qw(qsearchs fields);
44 use FS::svc_domain;
45 use FS::CGI qw(popurl);
46
47 #remove this to actually test the domains!
48 $FS::svc_domain::whois_hack = 1;
49
50 $cgi = new CGI;
51 &cgisuidsetup($cgi);
52
53 $cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!";
54 $svcnum = $1;
55
56 $new = new FS::svc_domain ( {
57   map {
58     $_, scalar($cgi->param($_));
59   #} qw(svcnum pkgnum svcpart domain action purpose)
60   } ( fields('svc_domain'), qw( pkgnum svcpart action purpose ) )
61 } );
62
63 if ($cgi->param('legal') ne "Yes") {
64   $error = "Customer did not agree to be bound by NSI's ".
65     qq!<A HREF="http://rs.internic.net/help/agreement.txt">!.
66     "Domain Name Resgistration Agreement</A>";
67 } elsif ($cgi->param('svcnum')) {
68   $error="Can't modify a domain!";
69 } else {
70   $error=$new->insert;
71   $svcnum=$new->svcnum;
72 }
73
74 if ($error) {
75   $cgi->param('error', $error);
76   print $cgi->redirect(popurl(2). "svc_domain.cgi?". $cgi->query_string );
77 } else {
78   print $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum");
79 }
80