1 <& /elements/popup-topreload.html, mt("Customer suspended") &>
4 #false laziness w/cust_main-cancel.cgi
7 unless $FS::CurrentUser::CurrentUser->access_right('Suspend customer');
11 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
13 $adjourn = $cgi->param('adjourn');
15 my($query) = $cgi->keywords;
16 $query =~ /^(\d+)$/ || die "Illegal custnum";
20 #untaint reasonnum / create new reason
21 my ($reasonnum, $error) = $m->comp('process/elements/reason');
23 $error ||= 'Reason required';
26 my $cust_main = qsearchs( {
27 'table' => 'cust_main',
28 'hashref' => { 'custnum' => $custnum },
29 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
34 } elsif ( $cgi->param('now_or_later') ) {
35 $adjourn = parse_datetime($adjourn);
37 #warn "setting adjourn dates on custnum#$custnum\n";
38 my @pkgs = $cust_main->unsuspended_pkgs;
39 my @errors = grep {$_} map { $_->suspend(
40 'reason' => $reasonnum,
43 $error = join(' / ', @errors);
45 $error = ("error parsing adjourn date: ".$cgi->param('adjourn'));
48 warn "suspending $cust_main";
49 $error = $cust_main->suspend(
50 'reason' => $reasonnum,
55 $cgi->param('error', $error);
56 print $cgi->redirect(popurl(1). "suspend_cust.html?". $cgi->query_string );