summaryrefslogtreecommitdiff
path: root/htdocs/search/cust_bill.cgi
blob: 5be84b79e2329788bb7737922702ddf7042c29f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/perl -Tw
#
# cust_bill.cgi: Search for invoices (process form)
#
# Usage: post form to:
#        http://server.name/path/cust_bill.cgi
#
# Note: Should be run setuid freeside as user nobody.
#
# ivan@voicenet.com 97-apr-4
#
# Changes to allow page to work at a relative position in server
#       bmccane@maxbaud.net     98-apr-3

use strict;
use CGI::Request;
use FS::UID qw(cgisuidsetup);
use FS::Record qw(qsearchs);

my($req)=new CGI::Request;
cgisuidsetup($req->cgi);

$req->param('invnum') =~ /^\s*(FS-)?(\d+)\s*$/;
my($invnum)=$2;

if ( qsearchs('cust_bill',{'invnum'=>$invnum}) ) {
  $req->cgi->redirect("../view/cust_bill.cgi?$invnum");  #redirect
} else { #error
  CGI::Base::SendHeaders(); # one guess
  print <<END;
<HTML>
  <HEAD>
    <TITLE>Invoice Search Error</TITLE>
  </HEAD>
  <BODY>
    <CENTER>
    <H3>Invoice Search Error</H3>
    <HR>
    Invoice not found.
    </CENTER>
  </BODY>
</HTML>
END

}