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";
41 unless $curuser->access_right('Change customer package');
43 if ( $cgi->param('new_pkgpart') =~ /^(\d+)$/ ) {
46 $error = 'Select a new package';
49 } elsif ( $cgi->param('action') eq 'bulk' ) { #came from edit/cust_pkg.cgi
52 $error_redirect = "edit/cust_pkg.cgi";
55 unless $curuser->access_right('Bulk change customer packages');
57 foreach my $pkgpart ( map /^pkg(\d+)$/ ? $1 : (), $cgi->param ) {
58 if ( $cgi->param("pkg$pkgpart") =~ /^(\d+)$/ ) {
60 while ( $num_pkgs-- ) {
61 push @pkgparts,$pkgpart;
64 $error = "Illegal quantity";
70 die "guru exception #5: action is neither change nor bulk!";
73 $error ||= FS::cust_pkg::order($custnum,\@pkgparts,\@remove_pkgnums);