3 # $Id: cancel_pkg.cgi,v 1.2 1998-12-17 09:12:43 ivan Exp $
5 # Usage: cancel_pkg.cgi pkgnum
6 # http://server.name/path/cancel_pkg.cgi pkgnum
8 # Note: Should be run setuid freeside as user nobody
10 # IT DOESN'T RUN THE APPROPRIATE PROGRAMS YET!!!!
12 # probably should generalize this to do cancels, suspensions, unsuspensions, etc.
14 # ivan@voicenet.com 97-jan-2
16 # still kludgy, but now runs /dbin/cancel $pkgnum
17 # ivan@voicenet.com 97-feb-27
19 # doesn't run if pkgnum doesn't match regex
20 # ivan@voicenet.com 97-mar-6
22 # now redirects to enter comments
23 # ivan@voicenet.com 97-may-8
26 # ivan@voicenet.com 97-jul-21
28 # Changes to allow page to work at a relative position in server
29 # bmccane@maxbaud.net 98-apr-3
31 # $Log: cancel_pkg.cgi,v $
32 # Revision 1.2 1998-12-17 09:12:43 ivan
33 # s/CGI::(Request|Base)/CGI.pm/;
38 use CGI::Carp qw(fatalsToBrowser);
39 use FS::UID qw(cgisuidsetup);
40 use FS::CGI qw(eidiot popurl);
41 use FS::Record qw(qsearchs);
48 $cgi->query_string =~ /^(\d+)$/ || die "Illegal pkgnum";
51 my($cust_pkg) = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum});
53 my($error)=$cust_pkg->cancel;
54 eidiot($error) if $error;
56 print $cgi->redirect(popurl(2). "view/cust_main.cgi?".$cust_pkg->getfield('custnum'));