From 97e6cec67c0c99ce1b6f0667a09f1e009100189d Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 13 Jan 2008 21:14:32 +0000 Subject: ACLs --- httemplate/misc/delete-customer.cgi | 93 +++++++++++++++++++------------------ 1 file changed, 48 insertions(+), 45 deletions(-) (limited to 'httemplate/misc/delete-customer.cgi') diff --git a/httemplate/misc/delete-customer.cgi b/httemplate/misc/delete-customer.cgi index 378f69e61..17b7bda5e 100755 --- a/httemplate/misc/delete-customer.cgi +++ b/httemplate/misc/delete-customer.cgi @@ -1,48 +1,26 @@ - -% -% -%my $conf = new FS::Conf; -%die "Customer deletions not enabled" unless $conf->exists('deletecustomers'); -% -%my($custnum, $new_custnum); -%if ( $cgi->param('error') ) { -% $custnum = $cgi->param('custnum'); -% $new_custnum = $cgi->param('new_custnum'); -%} else { -% my($query) = $cgi->keywords; -% $query =~ /^(\d+)$/ or die "Illegal query: $query"; -% $custnum = $1; -% $new_custnum = ''; -%} -%my $cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } ) -% or die "Customer not found: $custnum"; -% -%print header('Delete customer'); -% -%print qq!Error: !, $cgi->param('error'), -% "" -% if $cgi->param('error'); -% -%print -% qq!
!, -% qq!!; -% +<% include('/elements/header.html', 'Delete customer') %> + +<% include('/elements/error.html') %> + + + + %if ( qsearch('cust_pkg', { 'custnum' => $custnum, 'cancel' => '' } ) ) { -% print "Move uncancelled packages to customer number ", -% qq!

!; + Move uncancelled packages to customer number +

%} -% -%print <completely remove all traces of this customer record. This -%is not what you want if this is a real customer who has simply -%canceled service with you. For that, cancel all of the customer's packages. -%(you can optionally hide cancelled customers with the hidecancelledcustomers configuration option) -%
-%
Are you absolutely sure you want to delete this customer? -%
-% -%END -% + +This will completely remove all traces of this customer record. This +is not what you want if this is a real customer who has simply +canceled service with you. For that, cancel all of the customer's packages. +(you can optionally hide cancelled customers with the hidecancelledcustomers configuration option) +
+
Are you absolutely sure you want to delete this customer? +
+ + +<% include('/elements/footer.html') %> + %#Deleting a customer you have financial records on (i.e. credits) is %#typically considered fraudulant bookkeeping. Remember, deleting %#customers should ONLY be used for completely bogus records. You should @@ -56,6 +34,31 @@ %#Also see the "hidecancelledcustomers" and "hidecancelledpackages" %#configuration options, which will allow you to surpress the display of %#cancelled customers and packages, respectively. -% -% +<%init> + +my $conf = new FS::Conf; +die "Customer deletions not enabled in configuration" + unless $conf->exists('deletecustomers'); + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Delete customer'); + +my($custnum, $new_custnum); +if ( $cgi->param('error') ) { + $custnum = $cgi->param('custnum'); + $new_custnum = $cgi->param('new_custnum'); +} else { + my($query) = $cgi->keywords; + $query =~ /^(\d+)$/ or die "Illegal query: $query"; + $custnum = $1; + $new_custnum = ''; +} +my $cust_main = qsearchs( { + 'table' => 'cust_main', + 'hashref' => { 'custnum' => $custnum }, + 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, +} ) + or die 'Unknown custnum'; + +<%/init> -- cgit v1.2.1