1 <& /elements/header-popup.html, mt("Customer unsuspended") &>
2 <SCRIPT TYPE="text/javascript">
9 #false laziness w/cust_main-cancel.cgi
12 unless $FS::CurrentUser::CurrentUser->access_right('Unsuspend customer');
16 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
18 $resume = $cgi->param('resume');
20 my($query) = $cgi->keywords;
21 $query =~ /^(\d+)$/ || die "Illegal custnum";
25 my $cust_main = qsearchs( {
26 'table' => 'cust_main',
27 'hashref' => { 'custnum' => $custnum },
28 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
32 if($cgi->param('now_or_later')) {
33 $resume = parse_datetime($resume);
35 #warn "setting resume dates on custnum#$custnum\n";
36 my @pkgs = $cust_main->suspended_pkgs;
37 if (!$cgi->param('release_hold')) {
38 # then avoid packages that are on hold
39 @pkgs = grep { $_->get('setup') } @pkgs;
41 @errors = grep {$_} map { $_->unsuspend(
46 @errors = ("error parsing adjourn date: ".$cgi->param('adjourn'));
49 else { # unsuspending now
50 warn "unsuspending $cust_main";
51 @errors = $cust_main->unsuspend;
53 if ( $cgi->param('release_hold') ) {
54 push @errors, $cust_main->release_hold;
57 my $error = join(' / ', @errors) if scalar(@errors);
60 $cgi->param('error', $error);
61 print $cgi->redirect(popurl(1). "unsuspend_cust.html?". $cgi->query_string );