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 #false laziness w/process/cancel_pkg.html
28 my $reasonnum = $cgi->param('reasonnum');
29 $reasonnum =~ /^(-?\d+)$/ || die "Illegal reasonnum";
32 if ($reasonnum == -1) {
34 'typenum' => scalar( $cgi->param('newreasonnumT') ),
35 'reason' => scalar( $cgi->param('newreasonnum' ) ),
41 my $cust_main = qsearchs( {
42 'table' => 'cust_main',
43 'hashref' => { 'custnum' => $custnum },
44 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
48 if($cgi->param('now_or_later')) {
49 $adjourn = parse_datetime($adjourn);
51 #warn "setting adjourn dates on custnum#$custnum\n";
52 my @pkgs = $cust_main->unsuspended_pkgs;
53 @errors = grep {$_} map { $_->suspend(
54 'reason' => $reasonnum,
59 @errors = ("error parsing adjourn date: ".$cgi->param('adjourn'));
63 warn "suspending $cust_main";
64 @errors = $cust_main->suspend(
65 'reason' => $reasonnum,
68 my $error = join(' / ', @errors) if scalar(@errors);
71 $cgi->param('error', $error);
72 print $cgi->redirect(popurl(1). "suspend_cust.html?". $cgi->query_string );