1 <& /elements/header-popup.html &>
2 <SCRIPT TYPE="text/javascript">
9 my $curuser = $FS::CurrentUser::CurrentUser;
11 unless $curuser->access_right('Unsuspend customer package');
13 $cgi->param('pkgnum') =~ /^(\d+)$/
14 or die "illegal pkgnum";
17 my $cust_pkg = qsearchs({
19 addl_from => ' JOIN cust_main USING (custnum) ',
20 hashref => { 'pkgnum' => $pkgnum },
21 extra_sql => ' AND '. $curuser->agentnums_sql,
22 }) or die "Unknown pkgnum: $pkgnum";
24 my $cust_main = $cust_pkg->cust_main;
28 if ( $cgi->param('when') eq 'now' ) {
29 # start it the next time billing runs
31 } elsif ( $cgi->param('when') eq 'next_bill_date' ) {
32 $start_date = $cust_main->next_bill_date;
33 } elsif ( $cgi->param('when') eq 'date' ) {
34 $start_date = parse_datetime($cgi->param('start_date'));
37 # In this process, always unsuspend the package _now_ but with a future start
38 # date, rather than set a resume date. (There is some semantic overlap between
41 if ( $cust_pkg->setup or !$cust_pkg->susp ) {
42 $error = 'This package is '. $cust_pkg->status . ', not on hold.';
44 $cust_pkg->set('start_date', $start_date);
45 $error = $cust_pkg->unsuspend;
49 $cgi->param('error', $error);
50 print $cgi->redirect($fsurl.'misc/unhold_pkg.html?', $cgi->query_string);