1 %my $pkgnum = $cgi->param('pkgnum') or die;
2 %my $old = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum});
3 %my %hash = $old->hash;
4 %$hash{'setup'} = $cgi->param('setup') ? str2time($cgi->param('setup')) : '';
5 %$hash{'bill'} = $cgi->param('bill') ? str2time($cgi->param('bill')) : '';
7 % $cgi->param('last_bill') ? str2time($cgi->param('last_bill')) : '';
8 %$hash{'adjourn'} = $cgi->param('adjourn') ? str2time($cgi->param('adjourn')) : '';
9 %$hash{'expire'} = $cgi->param('expire') ? str2time($cgi->param('expire')) : '';
13 %if ( $hash{'bill'} != $old->bill # if the next bill date was changed
14 % && $hash{'bill'} < time # to a date in the past
15 % && ! $cgi->param('bill_areyousure') # and it wasn't confirmed
18 % $error = '_bill_areyousure';
20 % $new = new FS::cust_pkg \%hash;
21 % $error = $new->replace($old);
25 % $cgi->param('error', $error);
26 % print $cgi->redirect(popurl(2). "REAL_cust_pkg.cgi?". $cgi->query_string );
28 % my $custnum = $new->custnum;
29 % print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum".
30 % "#cust_pkg$pkgnum" );