This commit was manufactured by cvs2svn to create branch 'freeside_import'.
[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 use strict;
13 use CGI::Base;
14 use CGI::Carp qw(fatalsToBrowser);
15 use FS::UID qw(cgisuidsetup);
16 use FS::Record qw(qsearch qsearchs);
17 use FS::svc_acct_pop;
18 use FS::CGI qw(header menubar);
19
20 my($cgi) = new CGI::Base;
21 $cgi->get;
22
23 &cgisuidsetup($cgi);
24
25 SendHeaders(); # one guess.
26
27 my($svc_acct_pop,$action);
28 if ( $cgi->var('QUERY_STRING') =~ /^(\d+)$/ ) { #editing
29   $svc_acct_pop=qsearchs('svc_acct_pop',{'popnum'=>$1});
30   $action='Edit';
31 } else { #adding
32   $svc_acct_pop=create FS::svc_acct_pop {};
33   $action='Add';
34 }
35 my($hashref)=$svc_acct_pop->hashref;
36
37 print header("$action POP", menubar(
38   'Main Menu' => '../',
39   'View all POPs' => "../browse/svc_acct_pop.cgi",
40 )), <<END;
41     <FORM ACTION="process/svc_acct_pop.cgi" METHOD=POST>
42 END
43
44 #display
45
46 print qq!<INPUT TYPE="hidden" NAME="popnum" VALUE="$hashref->{popnum}">!,
47       "POP #", $hashref->{popnum} ? $hashref->{popnum} : "(NEW)";
48
49 print <<END;
50 <PRE>
51 City      <INPUT TYPE="text" NAME="city" SIZE=32 VALUE="$hashref->{city}">
52 State     <INPUT TYPE="text" NAME="state" SIZE=3 MAXLENGTH=2 VALUE="$hashref->{state}">
53 Area Code <INPUT TYPE="text" NAME="ac" SIZE=4 MAXLENGTH=3 VALUE="$hashref->{ac}">
54 Exchange  <INPUT TYPE="text" NAME="exch" SIZE=4 MAXLENGTH=3 VALUE="$hashref->{exch}">
55 </PRE>
56 END
57
58 print qq!<BR><INPUT TYPE="submit" VALUE="!,
59       $hashref->{popnum} ? "Apply changes" : "Add POP",
60       qq!">!;
61
62 print <<END;
63     </FORM>
64   </BODY>
65 </HTML>
66 END
67