1 <% header("Customer cancelled") %>
2 <SCRIPT TYPE="text/javascript">
3 window.top.location.reload();
10 unless $FS::CurrentUser::CurrentUser->access_right('Cancel customer');
14 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
16 $ban = $cgi->param('ban');
18 my($query) = $cgi->keywords;
19 $query =~ /^(\d+)$/ || die "Illegal custnum";
23 #false laziness w/process/cancel_pkg.html
26 my $reasonnum = $cgi->param('reasonnum');
27 $reasonnum =~ /^(-?\d+)$/ || die "Illegal reasonnum";
30 if ($reasonnum == -1) {
32 'typenum' => scalar( $cgi->param('newreasonnumT') ),
33 'reason' => scalar( $cgi->param('newreasonnum' ) ),
39 my $cust_main = qsearchs( {
40 'table' => 'cust_main',
41 'hashref' => { 'custnum' => $custnum },
42 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
45 warn "cancelling $cust_main";
46 my @errors = $cust_main->cancel(
48 'reason' => $reasonnum,
50 my $error = join(' / ', @errors) if scalar(@errors);
53 $cgi->param('error', $error);
54 print $cgi->redirect(popurl(1). "cancel_cust.html?". $cgi->query_string );