s/CGI::Request/CGI.pm/
[freeside.git] / htdocs / edit / svc_acct_pop.cgi
1 #!/usr/bin/perl -Tw
2 #
3 # svc_acct_pop.cgi: Add/Edit pop (output form)
4 #
5 # ivan@sisd.com 98-mar-8 
6 #
7 # Changes to allow page to work at a relative position in server
8 #       bmccane@maxbaud.net     98-apr-3
9 #
10 # lose background, FS::CGI ivan@sisd.com 98-sep-2
11 #
12 # $Log: svc_acct_pop.cgi,v $
13 # Revision 1.2  1998-11-13 09:56:47  ivan
14 # change configuration file layout to support multiple distinct databases (with
15 # own set of config files, export, etc.)
16 #
17
18 use strict;
19 use CGI;
20 use CGI::Carp qw(fatalsToBrowser);
21 use FS::UID qw(cgisuidsetup);
22 use FS::Record qw(qsearch qsearchs);
23 use FS::svc_acct_pop;
24 use FS::CGI qw(header menubar);
25
26 my($cgi) = new CGI;
27
28 &cgisuidsetup($cgi);
29
30 my($svc_acct_pop,$action);
31 if ( $cgi->query_string =~ /^(\d+)$/ ) { #editing
32   $svc_acct_pop=qsearchs('svc_acct_pop',{'popnum'=>$1});
33   $action='Edit';
34 } else { #adding
35   $svc_acct_pop=create FS::svc_acct_pop {};
36   $action='Add';
37 }
38 my($hashref)=$svc_acct_pop->hashref;
39
40 print $cgi->header, header("$action POP", menubar(
41   'Main Menu' => '../',
42   'View all POPs' => "../browse/svc_acct_pop.cgi",
43 )), <<END;
44     <FORM ACTION="process/svc_acct_pop.cgi" METHOD=POST>
45 END
46
47 #display
48
49 print qq!<INPUT TYPE="hidden" NAME="popnum" VALUE="$hashref->{popnum}">!,
50       "POP #", $hashref->{popnum} ? $hashref->{popnum} : "(NEW)";
51
52 print <<END;
53 <PRE>
54 City      <INPUT TYPE="text" NAME="city" SIZE=32 VALUE="$hashref->{city}">
55 State     <INPUT TYPE="text" NAME="state" SIZE=3 MAXLENGTH=2 VALUE="$hashref->{state}">
56 Area Code <INPUT TYPE="text" NAME="ac" SIZE=4 MAXLENGTH=3 VALUE="$hashref->{ac}">
57 Exchange  <INPUT TYPE="text" NAME="exch" SIZE=4 MAXLENGTH=3 VALUE="$hashref->{exch}">
58 </PRE>
59 END
60
61 print qq!<BR><INPUT TYPE="submit" VALUE="!,
62       $hashref->{popnum} ? "Apply changes" : "Add POP",
63       qq!">!;
64
65 print <<END;
66     </FORM>
67   </BODY>
68 </HTML>
69 END
70