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