X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=htdocs%2Fmisc%2Fcancel_pkg.cgi;fp=htdocs%2Fmisc%2Fcancel_pkg.cgi;h=6702a03510fb2f764b108597d4a087049dd9edd5;hb=70446cf4e4403a5984d86ef03f08881074aea101;hp=0000000000000000000000000000000000000000;hpb=f0a04c17c324219c6edb893821b4bd7f3dcbfd77;p=freeside.git diff --git a/htdocs/misc/cancel_pkg.cgi b/htdocs/misc/cancel_pkg.cgi new file mode 100755 index 000000000..6702a0351 --- /dev/null +++ b/htdocs/misc/cancel_pkg.cgi @@ -0,0 +1,54 @@ +#!/usr/bin/perl -Tw +# +# cancel_pkg.cgi: Cancel a package +# +# Usage: cancel_pkg.cgi pkgnum +# http://server.name/path/cancel_pkg.cgi pkgnum +# +# Note: Should be run setuid freeside as user nobody +# +# IT DOESN'T RUN THE APPROPRIATE PROGRAMS YET!!!! +# +# probably should generalize this to do cancels, suspensions, unsuspensions, etc. +# +# ivan@voicenet.com 97-jan-2 +# +# still kludgy, but now runs /dbin/cancel $pkgnum +# ivan@voicenet.com 97-feb-27 +# +# doesn't run if pkgnum doesn't match regex +# ivan@voicenet.com 97-mar-6 +# +# now redirects to enter comments +# ivan@voicenet.com 97-may-8 +# +# rewrote for new API +# ivan@voicenet.com 97-jul-21 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 + +use strict; +use CGI::Base qw(:DEFAULT :CGI); # CGI module +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearchs); +use FS::cust_pkg; +use FS::CGI qw(idiot); + +my($cgi) = new CGI::Base; +$cgi->get; +&cgisuidsetup($cgi); + +#untaint pkgnum +$QUERY_STRING =~ /^(\d+)$/ || die "Illegal pkgnum"; +my($pkgnum)=$1; + +my($cust_pkg) = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); + +bless($cust_pkg,'FS::cust_pkg'); +my($error)=$cust_pkg->cancel; +idiot($error) if $error; + +$cgi->redirect("../view/cust_main.cgi?".$cust_pkg->getfield('custnum')); +