3 # $Id: cancel_pkg.cgi,v 1.6 1999-04-08 10:35:02 ivan Exp $
5 # Usage: cancel_pkg.cgi pkgnum
6 # http://server.name/path/cancel_pkg.cgi pkgnum
8 # IT DOESN'T RUN THE APPROPRIATE PROGRAMS YET!!!!
10 # probably should generalize this to do cancels, suspensions, unsuspensions, etc.
12 # ivan@voicenet.com 97-jan-2
14 # still kludgy, but now runs /dbin/cancel $pkgnum
15 # ivan@voicenet.com 97-feb-27
17 # doesn't run if pkgnum doesn't match regex
18 # ivan@voicenet.com 97-mar-6
20 # now redirects to enter comments
21 # ivan@voicenet.com 97-may-8
24 # ivan@voicenet.com 97-jul-21
26 # Changes to allow page to work at a relative position in server
27 # bmccane@maxbaud.net 98-apr-3
29 # $Log: cancel_pkg.cgi,v $
30 # Revision 1.6 1999-04-08 10:35:02 ivan
31 # import necessary subroutines from FS::CGI
33 # Revision 1.5 1999/02/28 00:03:49 ivan
34 # removed misleading comments
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/;
40 # Revision 1.3 1998/12/23 03:02:54 ivan
41 # $cgi->keywords instead of $cgi->query_string
43 # Revision 1.2 1998/12/17 09:12:43 ivan
44 # s/CGI::(Request|Base)/CGI.pm/;
48 use vars qw ( $cgi $query $pkgnum $cust_pkg $error );
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);
61 ($query) = $cgi->keywords;
62 $query =~ /^(\d+)$/ || die "Illegal pkgnum";
65 $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum});
67 $error = $cust_pkg->cancel;
68 eidiot($error) if $error;
70 print $cgi->redirect(popurl(2). "view/cust_main.cgi?".$cust_pkg->getfield('custnum'));