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