1 <& /elements/header-popup.html, mt("Customer suspended") &>
2 <SCRIPT TYPE="text/javascript">
3 window.top.location.reload();
9 #false laziness w/cust_main-cancel.cgi
12 unless $FS::CurrentUser::CurrentUser->access_right('Suspend customer');
16 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
18 $adjourn = $cgi->param('adjourn');
20 my($query) = $cgi->keywords;
21 $query =~ /^(\d+)$/ || die "Illegal custnum";
25 #untaint reasonnum / create new reason
26 my ($reasonnum, $error) = $m->comp('process/elements/reason');
28 $error ||= 'Reason required';
31 my $cust_main = qsearchs( {
32 'table' => 'cust_main',
33 'hashref' => { 'custnum' => $custnum },
34 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
39 } elsif ( $cgi->param('now_or_later') ) {
40 $adjourn = parse_datetime($adjourn);
42 #warn "setting adjourn dates on custnum#$custnum\n";
43 my @pkgs = $cust_main->unsuspended_pkgs;
44 my @errors = grep {$_} map { $_->suspend(
45 'reason' => $reasonnum,
48 $error = join(' / ', @errors);
50 $error = ("error parsing adjourn date: ".$cgi->param('adjourn'));
53 warn "suspending $cust_main";
54 $error = $cust_main->suspend(
55 'reason' => $reasonnum,
60 $cgi->param('error', $error);
61 print $cgi->redirect(popurl(1). "suspend_cust.html?". $cgi->query_string );