for mod_perl: no more top-level my() variables; use vars instead
[freeside.git] / htdocs / misc / unsusp_pkg.cgi
1 #!/usr/bin/perl -Tw
2 #
3 # $Id: unsusp_pkg.cgi,v 1.4 1999-01-19 05:14:09 ivan Exp $
4 #
5 # Usage: susp_pkg.cgi pkgnum
6 #        http://server.name/path/susp_pkg.cgi pkgnum
7 #
8 # Note: Should be run setuid freeside as user nobody
9 #
10 # probably should generalize this to do cancels, suspensions, unsuspensions, etc.
11 #
12 # ivan@voicenet.com 97-feb-27
13 #
14 # now redirects to enter comments
15 # ivan@voicenet.com 97-may-8
16 #
17 # rewrote for new API
18 # ivan@voicenet.com 97-jul-21
19 #
20 # FS::Search -> FS::Record ivan@sisd.com 98-mar-17
21 #
22 # Changes to allow page to work at a relative position in server
23 #       bmccane@maxbaud.net     98-apr-3
24 #
25 # $Log: unsusp_pkg.cgi,v $
26 # Revision 1.4  1999-01-19 05:14:09  ivan
27 # for mod_perl: no more top-level my() variables; use vars instead
28 # also the last s/create/new/;
29 #
30 # Revision 1.3  1998/12/23 03:05:25  ivan
31 # $cgi->keywords instead of $cgi->query_string
32 #
33 # Revision 1.2  1998/12/17 09:12:49  ivan
34 # s/CGI::(Request|Base)/CGI.pm/;
35 #
36
37 use strict;
38 use vars qw( $cgi $query $pkgnum $cust_pkg $error );
39 use CGI;
40 use CGI::Carp qw(fatalsToBrowser);
41 use FS::UID qw(cgisuidsetup);
42 use FS::CGI qw(popurl eidiot);
43 use FS::Record qw(qsearchs);
44 use FS::cust_pkg;
45
46 $cgi = new CGI;
47 &cgisuidsetup($cgi);
48  
49 #untaint pkgnum
50 ($query) = $cgi->keywords;
51 $query =~ /^(\d+)$/ || die "Illegal pkgnum";
52 $pkgnum = $1;
53
54 $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum});
55
56 $error = $cust_pkg->unsuspend;
57 &eidiot($error) if $error;
58
59 print $cgi->redirect(popurl(2). "view/cust_main.cgi?".$cust_pkg->getfield('custnum'));
60