2 % $cgi->param('error', $error);
3 <% $cgi->redirect(popurl(2). "REAL_cust_pkg.cgi?". $cgi->query_string ) %>
5 % my $custnum = $new->custnum;
6 % my $show = $curuser->default_customer_view =~ /^(jumbo|packages)$/
9 % my $frag = "cust_pkg$pkgnum"; #hack for IE ignoring real #fragment
10 <% $cgi->redirect(popurl(3). "view/cust_main.cgi?custnum=$custnum$show;fragment=$frag#$frag" ) %>
14 my $curuser = $FS::CurrentUser::CurrentUser;
17 unless $curuser->access_right('Edit customer package dates');
19 my $pkgnum = $cgi->param('pkgnum') or die;
20 my $old = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum});
21 my %hash = $old->hash;
22 $hash{'start_date'} = $cgi->param('start_date') ? str2time($cgi->param('start_date')) : '';
23 $hash{'setup'} = $cgi->param('setup') ? str2time($cgi->param('setup')) : '';
24 $hash{'bill'} = $cgi->param('bill') ? str2time($cgi->param('bill')) : '';
26 $cgi->param('last_bill') ? str2time($cgi->param('last_bill')) : '';
27 $hash{'adjourn'} = $cgi->param('adjourn') ? str2time($cgi->param('adjourn')) : '';
28 $hash{'expire'} = $cgi->param('expire') ? str2time($cgi->param('expire')) : '';
32 push @errors, '_bill_areyousure'
33 if $hash{'bill'} != $old->bill # if the next bill date was changed
34 && $hash{'bill'} < time # to a date in the past
35 && ! $cgi->param('bill_areyousure'); # and it wasn't confirmed
37 push @errors, '_setup_areyousure'
38 if ! $hash{'setup'} && $old->setup # if the setup date was removed
39 && ! $cgi->param('setup_areyousure'); # and it wasn't confirmed
41 push @errors, '_start'
42 if $hash{'start_date'} && $old->start_date # if a start date was added
43 && $hash{'setup'}; # but there's a setup date
48 $error = join(',', @errors);
50 $new = new FS::cust_pkg \%hash;
51 $error = $new->replace($old);