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