yet more mod_perl stuff
[freeside.git] / htdocs / edit / cust_pay.cgi
1 #!/usr/bin/perl -Tw
2 #
3 # $Id: cust_pay.cgi,v 1.5 1999-01-25 12:09:56 ivan Exp $
4 #
5 # Usage: cust_pay.cgi invnum
6 #        http://server.name/path/cust_pay.cgi?invnum
7 #
8 # Note: Should be run setuid as user nobody.
9 #
10 # some hooks for modifications as well as additions, but needs work.
11 #
12 # ivan@voicenet.com 96-dec-11
13 #
14 # rewrite ivan@sisd.com 98-mar-16
15 #
16 # $Log: cust_pay.cgi,v $
17 # Revision 1.5  1999-01-25 12:09:56  ivan
18 # yet more mod_perl stuff
19 #
20 # Revision 1.4  1999/01/19 05:13:37  ivan
21 # for mod_perl: no more top-level my() variables; use vars instead
22 # also the last s/create/new/;
23 #
24 # Revision 1.3  1999/01/18 09:41:27  ivan
25 # all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl
26 # (good idea anyway)
27 #
28 # Revision 1.2  1998/12/17 06:17:03  ivan
29 # fix double // in relative URLs, s/CGI::Base/CGI/;
30 #
31
32 use strict;
33 use vars qw( $cgi $invnum $p1 $_date $payby $payinfo $paid );
34 use Date::Format;
35 use CGI;
36 use CGI::Carp qw(fatalsToBrowser);
37 use FS::UID qw(cgisuidsetup);
38 use FS::CGI qw(header popurl);
39
40 $cgi = new CGI;
41 cgisuidsetup($cgi);
42
43 if ( $cgi->param('error') ) {
44   $invnum = $cgi->param('invnum');
45   $paid = $cgi->param('paid');
46   $payby = $cgi->param('payby');
47   $payinfo = $cgi->param('payinfo');
48 } else {
49   my ($query) = $cgi->keywords;
50   $query =~ /^(\d+)$/;
51   $invnum = $1;
52   $paid = '';
53   $payby = "BILL";
54   $payinfo = "";
55 }
56 $_date = time;
57
58 $p1 = popurl(1);
59 print $cgi->header( '-expires' => 'now' ), header("Enter payment", '');
60
61 print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'),
62       "</FONT>"
63   if $cgi->param('error');
64
65 print <<END;
66     <FORM ACTION="${p1}process/cust_pay.cgi" METHOD=POST>
67     <HR><PRE>
68 END
69
70 print qq!Invoice #<B>$invnum</B><INPUT TYPE="hidden" NAME="invnum" VALUE="$invnum">!;
71
72 print qq!<BR>Date: <B>!, time2str("%D",$_date), qq!</B><INPUT TYPE="hidden" NAME="_date" VALUE="$_date">!;
73
74 print qq!<BR>Amount \$<INPUT TYPE="text" NAME="paid" VALUE="$paid" SIZE=8 MAXLENGTH=8>!;
75
76 print qq!<BR>Payby: <B>$payby</B><INPUT TYPE="hidden" NAME="payby" VALUE="$payby">!;
77
78 #payinfo (check # now as payby="BILL" hardcoded.. what to do later?)
79 print qq!<BR>Check #<INPUT TYPE="text" NAME="payinfo" VALUE="$payinfo">!;
80
81 #paybatch
82 print qq!<INPUT TYPE="hidden" NAME="paybatch" VALUE="">!;
83
84 print <<END;
85 </PRE>
86 <BR>
87 <INPUT TYPE="submit" VALUE="Post payment">
88 END
89
90 print <<END;
91
92     </FORM>
93   </BODY>
94 </HTML>
95 END
96