2 % $cgi->param('error', $error);
3 % $cgi->redirect(popurl(3). $error_redirect. '?'. $cgi->query_string );
4 % } elsif ( $action eq 'change' ) {
6 <% header("Package changed") %>
7 <SCRIPT TYPE="text/javascript">
8 window.top.location.reload();
13 % } elsif ( $action eq 'bulk' ) {
14 <% $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum") %>
16 % die "guru exception #5: action is neither change nor bulk!";
23 $cgi->param('custnum') =~ /^(\d+)$/;
26 my @remove_pkgnums = map {
27 /^(\d+)$/ or die "Illegal remove_pkg value!";
29 } $cgi->param('remove_pkg');
31 my $curuser = $FS::CurrentUser::CurrentUser;
33 my( $action, $error_redirect ) = ( '', '' );
35 if ( $cgi->param('action') eq 'change' ) { #came from misc/change_pkg.cgi
38 $error_redirect = "misc/change_pkg.cgi";
42 unless $curuser->access_right('Change customer package');
44 } elsif ( $cgi->param('action') eq 'bulk' ) { #came from edit/cust_pkg.cgi
47 $error_redirect = "edit/cust_pkg.cgi";
50 unless $curuser->access_right('Bulk change customer packages');
52 foreach my $pkgpart ( map /^pkg(\d+)$/ ? $1 : (), $cgi->param ) {
53 if ( $cgi->param("pkg$pkgpart") =~ /^(\d+)$/ ) {
55 while ( $num_pkgs-- ) {
56 push @pkgparts,$pkgpart;
59 $error = "Illegal quantity";
65 die "guru exception #5: action is neither change nor bulk!";
68 $error ||= FS::cust_pkg::order($custnum,\@pkgparts,\@remove_pkgnums);