2 % $cgi->param('error', $error);
3 % $cgi->redirect(popurl(3). 'edit/cust_pkg.cgi?'. $cgi->query_string );
5 <% $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum") %>
10 my $curuser = $FS::CurrentUser::CurrentUser;
13 unless $curuser->access_right('Bulk change customer packages');
16 my %param = $cgi->Vars;
18 my $custnum = $param{custnum};
19 $error = "Invalid custnum ($custnum)" if $custnum =~ /\D/;
21 my $locationnum = $param{locationnum};
22 $error = "Invalid locationnum ($locationnum)" if $locationnum =~ /\D/;
25 map { $_ =~ /remove_cust_pkg\[(\d+)\]/ ? $1 : () }
29 for my $k ( keys %param ) {
30 next unless $k =~ /qty_part_pkg\[(\d+)\]/;
33 $qty =~ s/(^\s+|\s+$)//g;
35 warn "k($k) param{k}($param{$k}) pkgpart($pkgpart) qty($qty)\n"
39 $error = "Invalid quantity $qty for pkgpart $pkgpart - please use a number";
45 push ( @pkgparts, $pkgpart ) for ( 1..$qty );
51 locationnum => $locationnum,
52 remove_pkgnum => \@remove_pkgnum,
53 pkgparts => \@pkgparts,
58 $error ||= FS::cust_pkg::order({
60 pkgparts => \@pkgparts,
61 remove_pkgnum => \@remove_pkgnum,
62 locationnum => $locationnum,