templates!!!
[freeside.git] / httemplate / edit / process / svc_domain.cgi
1 <%
2 #
3 # $Id: svc_domain.cgi,v 1.1 2001-07-30 07:36:04 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.1  2001-07-30 07:36:04  ivan
22 # templates!!!
23 #
24 # Revision 1.7  2001/04/23 07:12:44  ivan
25 # better error message (if kludgy) for no referral
26 # remove outdated NSI foo from domain ordering.  also, fuck NSI.
27 #
28 # Revision 1.6  1999/02/28 00:03:47  ivan
29 # removed misleading comments
30 #
31 # Revision 1.5  1999/02/07 09:59:33  ivan
32 # more mod_perl fixes, and bugfixes Peter Wemm sent via email
33 #
34 # Revision 1.4  1999/01/19 05:14:01  ivan
35 # for mod_perl: no more top-level my() variables; use vars instead
36 # also the last s/create/new/;
37 #
38 # Revision 1.3  1999/01/18 22:48:02  ivan
39 # s/create/new/g; and use fields('table_name')
40 #
41 # Revision 1.2  1998/12/17 08:40:30  ivan
42 # s/CGI::Request/CGI.pm/; etc
43 #
44
45 use strict;
46 use vars qw( $cgi $svcnum $new $error );
47 use CGI;
48 use CGI::Carp qw(fatalsToBrowser);
49 use FS::UID qw(cgisuidsetup);
50 use FS::Record qw(qsearchs fields);
51 use FS::svc_domain;
52 use FS::CGI qw(popurl);
53
54 #remove this to actually test the domains!
55 $FS::svc_domain::whois_hack = 1;
56
57 $cgi = new CGI;
58 &cgisuidsetup($cgi);
59
60 $cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!";
61 $svcnum = $1;
62
63 $new = new FS::svc_domain ( {
64   map {
65     $_, scalar($cgi->param($_));
66   #} qw(svcnum pkgnum svcpart domain action purpose)
67   } ( fields('svc_domain'), qw( pkgnum svcpart action purpose ) )
68 } );
69
70 if ($cgi->param('svcnum')) {
71   $error="Can't modify a domain!";
72 } else {
73   $error=$new->insert;
74   $svcnum=$new->svcnum;
75 }
76
77 if ($error) {
78   $cgi->param('error', $error);
79   print $cgi->redirect(popurl(2). "svc_domain.cgi?". $cgi->query_string );
80 } else {
81   print $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum");
82 }
83
84 %>