1 <& /elements/header-popup.html &>
2 <SCRIPT TYPE="text/javascript">
3 window.top.location.reload();
9 warn Dumper +{$cgi->Vars}; # XXX
11 my $curuser = $FS::CurrentUser::CurrentUser;
13 unless $curuser->access_right('Unsuspend customer package');
15 $cgi->param('pkgnum') =~ /^(\d+)$/
16 or die "illegal pkgnum";
19 my $cust_pkg = qsearchs({
21 addl_from => ' JOIN cust_main USING (custnum) ',
22 hashref => { 'pkgnum' => $pkgnum },
23 extra_sql => ' AND '. $curuser->agentnums_sql,
24 }) or die "Unknown pkgnum: $pkgnum";
26 my $cust_main = $cust_pkg->cust_main;
30 if ( $cgi->param('when') eq 'now' ) {
31 # start it the next time billing runs
33 } elsif ( $cgi->param('when') eq 'next_bill_date' ) {
34 $start_date = $cust_main->next_bill_date;
35 } elsif ( $cgi->param('when') eq 'date' ) {
36 $start_date = parse_datetime($cgi->param('start_date'));
39 # In this process, always unsuspend the package _now_ but with a future start
40 # date, rather than set a resume date. (There is some semantic overlap between
43 if ( $cust_pkg->setup or !$cust_pkg->susp ) {
44 $error = 'This package is '. $cust_pkg->status . ', not on hold.';
46 $cust_pkg->set('start_date', $start_date);
47 $error = $cust_pkg->unsuspend;
51 $cgi->param('error', $error);
52 print $cgi->redirect($fsurl.'misc/unhold_pkg.html?', $cgi->query_string);