yet more mod_perl stuff
[freeside.git] / htdocs / edit / cust_main_county-expand.cgi
1 #!/usr/bin/perl -Tw
2 #
3 # $Id: cust_main_county-expand.cgi,v 1.6 1999-01-25 12:09:54 ivan Exp $
4 #
5 # ivan@sisd.com 97-dec-16
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: cust_main_county-expand.cgi,v $
13 # Revision 1.6  1999-01-25 12:09:54  ivan
14 # yet more mod_perl stuff
15 #
16 # Revision 1.5  1999/01/19 05:13:35  ivan
17 # for mod_perl: no more top-level my() variables; use vars instead
18 # also the last s/create/new/;
19 #
20 # Revision 1.4  1999/01/18 09:41:25  ivan
21 # all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl
22 # (good idea anyway)
23 #
24 # Revision 1.3  1998/12/17 06:17:01  ivan
25 # fix double // in relative URLs, s/CGI::Base/CGI/;
26 #
27 # Revision 1.2  1998/11/18 09:01:38  ivan
28 # i18n! i18n!
29 #
30
31 use strict;
32 use vars qw( $cgi $taxnum $cust_main_county $p1 $delim $expansion );
33 use CGI;
34 use CGI::Carp qw(fatalsToBrowser);
35 use FS::UID qw(cgisuidsetup);
36 use FS::Record qw(qsearch qsearchs);
37 use FS::CGI qw(header menubar popurl);
38 use FS::cust_main_county;
39
40 $cgi = new CGI;
41
42 &cgisuidsetup($cgi);
43
44 if ( $cgi->param('error') ) {
45   $taxnum = $cgi->param('taxnum');
46   $delim = $cgi->param('delim');
47   $expansion = $cgi->param('expansion');
48 } else {
49   my ($query) = $cgi->keywords;
50   $query =~ /^(\d+)$/
51     or die "Illegal taxnum!";
52   $taxnum = $1;
53   $delim = 'n';
54   $expansion = '';
55 }
56
57 $cust_main_county = qsearchs('cust_main_county',{'taxnum'=>$taxnum});
58 die "Can't expand entry!" if $cust_main_county->getfield('county');
59
60 $p1 = popurl(1);
61 print $cgi->header( '-expires' => 'now' ), header("Tax Rate (expand)", menubar(
62   'Main Menu' => popurl(2),
63 ));
64
65 print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'),
66       "</FONT>"
67   if $cgi->param('error');
68
69 print <<END;
70     <FORM ACTION="${p1}process/cust_main_county-expand.cgi" METHOD=POST>
71       <INPUT TYPE="hidden" NAME="taxnum" VALUE="$taxnum">
72       Separate by
73 END
74 print '<INPUT TYPE="radio" NAME="delim" VALUE="n"';
75 print ' CHECKED' if $delim eq 'n';
76 print '>line (rumor has it broken on some browsers) or',
77       '<INPUT TYPE="radio" NAME="delim" VALUE="s"';
78 print ' CHECKED' if $delim eq 's';
79 print '>whitespace.';
80 print <<END;
81       <BR><INPUT TYPE="submit" VALUE="Submit">
82       <BR><TEXTAREA NAME="expansion" ROWS=100>$expansion</TEXTAREA>
83     </FORM>
84     </CENTER>
85   </BODY>
86 </HTML>
87 END
88