diff options
author | ivan <ivan> | 2001-07-30 07:36:04 +0000 |
---|---|---|
committer | ivan <ivan> | 2001-07-30 07:36:04 +0000 |
commit | 51984ac3d3da3006809c6866fdecd4ad83610731 (patch) | |
tree | ac16f533c25a1947eee7bee226fed5638c42bd94 /httemplate/misc/process | |
parent | 9c2016b3a564d439960420114ce6f4cab3bf723b (diff) |
templates!!!
Diffstat (limited to 'httemplate/misc/process')
-rwxr-xr-x | httemplate/misc/process/delete-customer.cgi | 50 | ||||
-rwxr-xr-x | httemplate/misc/process/link.cgi | 80 |
2 files changed, 130 insertions, 0 deletions
diff --git a/httemplate/misc/process/delete-customer.cgi b/httemplate/misc/process/delete-customer.cgi new file mode 100755 index 000000000..b15ffef17 --- /dev/null +++ b/httemplate/misc/process/delete-customer.cgi @@ -0,0 +1,50 @@ +<% +# +# $Id: delete-customer.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# $Log: delete-customer.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.1 1999/04/15 16:44:36 ivan +# delete customers +# + +use strict; +use vars qw ( $cgi $conf $custnum $new_custnum $cust_main $error ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearchs); +use FS::CGI qw(popurl); +use FS::cust_main; + +$cgi = new CGI; +cgisuidsetup($cgi); + +$conf = new FS::Conf; +die "Customer deletions not enabled" unless $conf->exists('deletecustomers'); + +$cgi->param('custnum') =~ /^(\d+)$/; +$custnum = $1; +if ( $cgi->param('new_custnum') ) { + $cgi->param('new_custnum') =~ /^(\d+)$/ + or die "Illegal new customer number: ". $cgi->param('new_custnum'); + $new_custnum = $1; +} else { + $new_custnum = ''; +} +$cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } ) + or die "Customer not found: $custnum"; + +$error = $cust_main->delete($new_custnum); + +if ( $error ) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). "delete-customer.cgi?". $cgi->query_string ); +} elsif ( $new_custnum ) { + print $cgi->redirect(popurl(3). "view/cust_main.cgi?$new_custnum"); +} else { + print $cgi->redirect(popurl(3)); +} +%> diff --git a/httemplate/misc/process/link.cgi b/httemplate/misc/process/link.cgi new file mode 100755 index 000000000..94afa289a --- /dev/null +++ b/httemplate/misc/process/link.cgi @@ -0,0 +1,80 @@ +<% +# +# $Id: link.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# ivan@voicenet.com 97-feb-5 +# +# rewrite ivan@sisd.com 98-mar-18 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# can also link on some other fields now (about time) ivan@sisd.com 98-jun-24 +# +# $Log: link.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.6 2000/07/17 17:59:33 ivan +# oops +# +# Revision 1.5 1999/04/15 14:09:17 ivan +# get rid of top-level my() variables +# +# Revision 1.4 1999/02/07 09:59:35 ivan +# more mod_perl fixes, and bugfixes Peter Wemm sent via email +# +# Revision 1.3 1999/01/19 05:14:10 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.2 1998/12/17 09:15:00 ivan +# s/CGI::Request/CGI.pm/; +# + +use strict; +use vars qw ( $cgi $old $new $error $pkgnum $svcpart $svcnum ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::CGI qw(popurl idiot eidiot); +use FS::UID qw(cgisuidsetup); +use FS::cust_svc; +use FS::Record qw(qsearchs); + +$cgi = new CGI; +cgisuidsetup($cgi); + +$cgi->param('pkgnum') =~ /^(\d+)$/; +$pkgnum = $1; +$cgi->param('svcpart') =~ /^(\d+)$/; +$svcpart = $1; +$cgi->param('svcnum') =~ /^(\d*)$/; +$svcnum = $1; + +unless ( $svcnum ) { + my($part_svc) = qsearchs('part_svc',{'svcpart'=>$svcpart}); + my($svcdb) = $part_svc->getfield('svcdb'); + $cgi->param('link_field') =~ /^(\w+)$/; my($link_field)=$1; + my($svc_acct)=qsearchs($svcdb,{$link_field => $cgi->param('link_value') }); + eidiot("$link_field not found!") unless $svc_acct; + $svcnum=$svc_acct->svcnum; +} + +$old = qsearchs('cust_svc',{'svcnum'=>$svcnum}); +die "svcnum not found!" unless $old; +$new = new FS::cust_svc ({ + 'svcnum' => $svcnum, + 'pkgnum' => $pkgnum, + 'svcpart' => $svcpart, +}); + +$error = $new->replace($old); + +unless ($error) { + #no errors, so let's view this customer. + print $cgi->redirect(popurl(3). "view/cust_pkg.cgi?$pkgnum"); +} else { + idiot($error); +} + +%> |