3 # expire_pkg.cgi: Expire a package
6 # http://server.name/path/expire_pkg.cgi
8 # Note: Should be run setuid freeside as user nobody
11 # ivan@voicenet.com 97-jul-29
13 # ivan@sisd.com 98-mar-17 FS::Search->FS::Record
15 # Changes to allow page to work at a relative position in server
16 # bmccane@maxbaud.net 98-apr-3
21 use CGI::Carp qw(fatalsToBrowser);
22 use FS::UID qw(cgisuidsetup);
23 use FS::Record qw(qsearchs);
26 my($req) = new CGI::Request;
27 &cgisuidsetup($req->cgi);
29 #untaint date & pkgnum
32 if ( $req->param('date') ) {
33 str2time($req->param('date')) =~ /^(\d+)$/ or die "Illegal date";
39 $req->param('pkgnum') =~ /^(\d+)$/ or die "Illegal pkgnum";
42 my($cust_pkg) = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum});
43 my(%hash)=$cust_pkg->hash;
45 my($new)=create FS::cust_pkg ( \%hash );
46 my($error) = $new->replace($cust_pkg);
47 &idiot($error) if $error;
49 $req->cgi->redirect("../view/cust_main.cgi?".$cust_pkg->getfield('custnum'));
57 <TITLE>Error expiring package</TITLE>
61 <H1>Error expiring package</H1>
64 There has been an error expiring this package: $error