This commit was manufactured by cvs2svn to create branch 'freeside_import'.
[freeside.git] / htdocs / search / cust_bill.cgi
1 #!/usr/bin/perl -Tw
2 #
3 # cust_bill.cgi: Search for invoices (process form)
4 #
5 # Usage: post form to:
6 #        http://server.name/path/cust_bill.cgi
7 #
8 # Note: Should be run setuid freeside as user nobody.
9 #
10 # ivan@voicenet.com 97-apr-4
11 #
12 # Changes to allow page to work at a relative position in server
13 #       bmccane@maxbaud.net     98-apr-3
14
15 use strict;
16 use CGI::Request;
17 use FS::UID qw(cgisuidsetup);
18 use FS::Record qw(qsearchs);
19
20 my($req)=new CGI::Request;
21 cgisuidsetup($req->cgi);
22
23 $req->param('invnum') =~ /^\s*(FS-)?(\d+)\s*$/;
24 my($invnum)=$2;
25
26 if ( qsearchs('cust_bill',{'invnum'=>$invnum}) ) {
27   $req->cgi->redirect("../view/cust_bill.cgi?$invnum");  #redirect
28 } else { #error
29   CGI::Base::SendHeaders(); # one guess
30   print <<END;
31 <HTML>
32   <HEAD>
33     <TITLE>Invoice Search Error</TITLE>
34   </HEAD>
35   <BODY>
36     <CENTER>
37     <H3>Invoice Search Error</H3>
38     <HR>
39     Invoice not found.
40     </CENTER>
41   </BODY>
42 </HTML>
43 END
44
45 }
46