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 foreach ( qw( start_date setup bill last_bill contract_end ) ) {
23 if ( $cgi->param($_) =~ /^(\d+)$/ ) {
28 # adjourn, expire, resume not editable this way
33 $new = new FS::cust_pkg \%hash;
34 $error = $new->replace($old);
37 my @supp_pkgs = $old->supplemental_pkgs;
38 foreach $new (@supp_pkgs) {
39 foreach ( qw( start_date setup contract_end ) ) {
40 # propagate these to supplementals
41 $new->set($_, $hash{$_});
43 if ( $hash{'bill'} ne $old->get('bill') ) {
44 if ( $hash{'bill'} and $old->get('bill') ) {
45 # adjust by the same interval
46 my $diff = $hash{'bill'} - $old->get('bill');
47 $new->set('bill', $new->get('bill') + $diff);
50 $new->set('bill', $hash{'bill'});
53 $error = $new->replace;
54 $error .= ' (supplemental package '.$new->pkgnum.')' if $error;