diff options
author | ivan <ivan> | 1998-04-17 05:37:07 +0000 |
---|---|---|
committer | ivan <ivan> | 1998-04-17 05:37:07 +0000 |
commit | dd013679940cb0a4425eeff4df263e390d9c42e4 (patch) | |
tree | 41c8454948d5a9db8c6ce03f39c13a9694b81001 /htdocs/misc | |
parent | 9307a5317a1dcf9fafd8b6bac8ffc70c505f9e2b (diff) |
Initial revision
Diffstat (limited to 'htdocs/misc')
-rwxr-xr-x | htdocs/misc/bill.cgi | 66 | ||||
-rwxr-xr-x | htdocs/misc/cancel-unaudited.cgi | 85 | ||||
-rwxr-xr-x | htdocs/misc/expire_pkg.cgi | 71 | ||||
-rwxr-xr-x | htdocs/misc/susp_pkg.cgi | 68 | ||||
-rwxr-xr-x | htdocs/misc/unsusp_pkg.cgi | 68 |
5 files changed, 358 insertions, 0 deletions
diff --git a/htdocs/misc/bill.cgi b/htdocs/misc/bill.cgi new file mode 100755 index 000000000..d41f6d1c9 --- /dev/null +++ b/htdocs/misc/bill.cgi @@ -0,0 +1,66 @@ +#!/usr/bin/perl -Tw +# +# s/FS:Search/FS::Record/ and cgisuidsetup($cgi) ivan@sisd.com 98-mar-13 +# +# 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); +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearchs); +use FS::Bill; + +my($cgi) = new CGI::Base; +$cgi->get; +&cgisuidsetup($cgi); + +#untaint custnum +$QUERY_STRING =~ /^(\d*)$/; +my($custnum)=$1; +my($cust_main)=qsearchs('cust_main',{'custnum'=>$custnum}); +die "Can't find customer!\n" unless $cust_main; + +# ? +bless($cust_main,"FS::Bill"); + +my($error); + +$error = $cust_main->bill( +# 'time'=>$time + ); +&idiot($error) if $error; + +$error = $cust_main->collect( +# 'invoice-time'=>$time, +# 'batch_card'=> 'yes', + 'batch_card'=> 'no', + 'report_badcard'=> 'yes', + ); +&idiot($error) if $error; + +$cgi->redirect("../view/cust_main.cgi?$custnum#history"); + +sub idiot { + my($error)=@_; + CGI::Base::SendHeaders(); # one guess + print <<END; +<HTML> + <HEAD> + <TITLE>Error billing customer</TITLE> + </HEAD> + <BODY> + <CENTER> + <H4>Error billing customer</H4> + </CENTER> + Your update did not occur because of the following error: + <P><B>$error</B> + </BODY> +</HTML> +END + + exit; + +} + diff --git a/htdocs/misc/cancel-unaudited.cgi b/htdocs/misc/cancel-unaudited.cgi new file mode 100755 index 000000000..929274f38 --- /dev/null +++ b/htdocs/misc/cancel-unaudited.cgi @@ -0,0 +1,85 @@ +#!/usr/bin/perl -Tw +# +# cancel-unaudited.cgi: Cancel an unaudited account +# +# Usage: cancel-unaudited.cgi svcnum +# http://server.name/path/cancel-unaudited.cgi pkgnum +# +# Note: Should be run setuid freeside as user nobody +# +# ivan@voicenet.com 97-apr-23 +# +# rewrote for new API +# ivan@voicenet.com 97-jul-21 +# +# Search->Record, cgisuidsetup($cgi) ivan@sids.com 98-mar-19 +# +# 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_svc; +use FS::svc_acct; + +my($cgi) = new CGI::Base; +$cgi->get; +&cgisuidsetup($cgi); + +#untaint svcnum +$QUERY_STRING =~ /^(\d+)$/; +my($svcnum)=$1; + +my($svc_acct) = qsearchs('svc_acct',{'svcnum'=>$svcnum}); +&idiot("Unknown svcnum!") unless $svc_acct; + +my($cust_svc) = qsearchs('cust_svc',{'svcnum'=>$svcnum}); +&idiot(qq!This account has already been audited. Cancel the + <A HREF="../view/cust_pkg.cgi?! . $cust_svc->getfield('pkgnum') . + qq!pkgnum"> package</A> instead.!) + if $cust_svc->getfield('pkgnum') ne ''; + +local $SIG{HUP} = 'IGNORE'; +local $SIG{INT} = 'IGNORE'; +local $SIG{QUIT} = 'IGNORE'; +local $SIG{TERM} = 'IGNORE'; +local $SIG{TSTP} = 'IGNORE'; + +my($error); + +bless($svc_acct,"FS::svc_acct"); +$error = $svc_acct->cancel; +&idiot($error) if $error; +$error = $svc_acct->delete; +&idiot($error) if $error; + +bless($cust_svc,"FS::cust_svc"); +$error = $cust_svc->delete; +&idiot($error) if $error; + +$cgi->redirect("../"); + +sub idiot { + my($error)=@_; + SendHeaders(); + print <<END; +<HTML> + <HEAD> + <TITLE>Error cancelling account</TITLE> + </HEAD> + <BODY> + <CENTER> + <H1>Error cancelling account</H1> + </CENTER> + <HR> + There has been an error cancelling this acocunt: $error + </BODY> + </HEAD> +</HTML> +END + exit; +} + diff --git a/htdocs/misc/expire_pkg.cgi b/htdocs/misc/expire_pkg.cgi new file mode 100755 index 000000000..163516627 --- /dev/null +++ b/htdocs/misc/expire_pkg.cgi @@ -0,0 +1,71 @@ +#!/usr/bin/perl -Tw +# +# expire_pkg.cgi: Expire a package +# +# Usage: post form to: +# http://server.name/path/expire_pkg.cgi +# +# Note: Should be run setuid freeside as user nobody +# +# based on susp_pkg +# ivan@voicenet.com 97-jul-29 +# +# ivan@sisd.com 98-mar-17 FS::Search->FS::Record +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 + +use strict; +use Date::Parse; +use CGI::Request; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearchs); +use FS::cust_pkg; + +my($req) = new CGI::Request; +&cgisuidsetup($req->cgi); + +#untaint date & pkgnum + +my($date); +if ( $req->param('date') ) { + str2time($req->param('date')) =~ /^(\d+)$/ or die "Illegal date"; + $date=$1; +} else { + $date=''; +} + +$req->param('pkgnum') =~ /^(\d+)$/ or die "Illegal pkgnum"; +my($pkgnum)=$1; + +my($cust_pkg) = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); +my(%hash)=$cust_pkg->hash; +$hash{expire}=$date; +my($new)=create FS::cust_pkg ( \%hash ); +my($error) = $new->replace($cust_pkg); +&idiot($error) if $error; + +$req->cgi->redirect("../view/cust_main.cgi?".$cust_pkg->getfield('custnum')); + +sub idiot { + my($error)=@_; + SendHeaders(); + print <<END; +<HTML> + <HEAD> + <TITLE>Error expiring package</TITLE> + </HEAD> + <BODY> + <CENTER> + <H1>Error expiring package</H1> + </CENTER> + <HR> + There has been an error expiring this package: $error + </BODY> + </HEAD> +</HTML> +END + exit; +} + diff --git a/htdocs/misc/susp_pkg.cgi b/htdocs/misc/susp_pkg.cgi new file mode 100755 index 000000000..7b23caeb2 --- /dev/null +++ b/htdocs/misc/susp_pkg.cgi @@ -0,0 +1,68 @@ +#!/usr/bin/perl -Tw +# +# susp_pkg.cgi: Suspend a package +# +# Usage: susp_pkg.cgi pkgnum +# http://server.name/path/susp_pkg.cgi pkgnum +# +# Note: Should be run setuid freeside as user nobody +# +# probably should generalize this to do cancels, suspensions, unsuspensions, etc. +# +# ivan@voicenet.com 97-feb-27 +# +# now redirects to enter comments +# ivan@voicenet.com 97-may-8 +# +# rewrote for new API +# ivan@voicenet.com 97-jul-21 +# +# FS::Search -> FS::Record ivan@sisd.com 98-mar-17 +# +# 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; + +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->suspend; +&idiot($error) if $error; + +$cgi->redirect("../view/cust_main.cgi?".$cust_pkg->getfield('custnum')); + +sub idiot { + my($error)=@_; + SendHeaders(); + print <<END; +<HTML> + <HEAD> + <TITLE>Error suspending package</TITLE> + </HEAD> + <BODY> + <CENTER> + <H1>Error suspending package</H1> + </CENTER> + <HR> + There has been an error suspending this package: $error + </BODY> + </HEAD> +</HTML> +END + exit; +} + diff --git a/htdocs/misc/unsusp_pkg.cgi b/htdocs/misc/unsusp_pkg.cgi new file mode 100755 index 000000000..2f340c6fa --- /dev/null +++ b/htdocs/misc/unsusp_pkg.cgi @@ -0,0 +1,68 @@ +#!/usr/bin/perl -Tw +# +# susp_pkg.cgi: Unsuspend a package +# +# Usage: susp_pkg.cgi pkgnum +# http://server.name/path/susp_pkg.cgi pkgnum +# +# Note: Should be run setuid freeside as user nobody +# +# probably should generalize this to do cancels, suspensions, unsuspensions, etc. +# +# ivan@voicenet.com 97-feb-27 +# +# now redirects to enter comments +# ivan@voicenet.com 97-may-8 +# +# rewrote for new API +# ivan@voicenet.com 97-jul-21 +# +# FS::Search -> FS::Record ivan@sisd.com 98-mar-17 +# +# 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; + +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->unsuspend; +&idiot($error) if $error; + +$cgi->redirect("../view/cust_main.cgi?".$cust_pkg->getfield('custnum')); + +sub idiot { + my($error)=@_; + SendHeaders(); + print <<END; +<HTML> + <HEAD> + <TITLE>Error unsuspending package</TITLE> + </HEAD> + <BODY> + <CENTER> + <H1>Error unsuspending package</H1> + </CENTER> + <HR> + There has been an error unsuspending this package: $error + </BODY> + </HEAD> +</HTML> +END + exit; +} + |