add svc_forward, depriciate svc_acct_sm
[freeside.git] / htdocs / misc / cancel_pkg.cgi
1 #!/usr/bin/perl -Tw
2 #
3 # $Id: cancel_pkg.cgi,v 1.6 1999-04-08 10:35:02 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.6  1999-04-08 10:35:02  ivan
31 # import necessary subroutines from FS::CGI
32 #
33 # Revision 1.5  1999/02/28 00:03:49  ivan
34 # removed misleading comments
35 #
36 # Revision 1.4  1999/01/19 05:14:04  ivan
37 # for mod_perl: no more top-level my() variables; use vars instead
38 # also the last s/create/new/;
39 #
40 # Revision 1.3  1998/12/23 03:02:54  ivan
41 # $cgi->keywords instead of $cgi->query_string
42 #
43 # Revision 1.2  1998/12/17 09:12:43  ivan
44 # s/CGI::(Request|Base)/CGI.pm/;
45 #
46
47 use strict;
48 use vars qw ( $cgi $query $pkgnum $cust_pkg $error );
49 use CGI;
50 use CGI::Carp qw(fatalsToBrowser);
51 use FS::UID qw(cgisuidsetup);
52 use FS::CGI qw(eidiot popurl);
53 use FS::Record qw(qsearchs);
54 use FS::CGI qw(popurl eidiot);
55 use FS::cust_pkg;
56
57 $cgi = new CGI;
58 &cgisuidsetup($cgi);
59  
60 #untaint pkgnum
61 ($query) = $cgi->keywords;
62 $query =~ /^(\d+)$/ || die "Illegal pkgnum";
63 $pkgnum = $1;
64
65 $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum});
66
67 $error = $cust_pkg->cancel;
68 eidiot($error) if $error;
69
70 print $cgi->redirect(popurl(2). "view/cust_main.cgi?".$cust_pkg->getfield('custnum'));
71