2 <% $cgi->redirect(popurl(2)."/bulk_change_pkg.cgi?".$cgi->query_string ) %>
4 <% include('/elements/header-popup.html', "Packages Changed") %>
8 unless $FS::CurrentUser::CurrentUser->access_right('Bulk change customer packages');
12 $search_hash{'query'} = $cgi->param('query');
14 for my $param (qw(agentnum magic status classnum pkgpart)) {
15 $search_hash{$param} = $cgi->param($param)
16 if $cgi->param($param);
23 #false laziness w/report_cust_pkg.html
26 'one-time charge' => { 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, },
27 'active' => { 'susp'=>1, 'cancel'=>1 },
28 'suspended' => { 'cancel' => 1 },
33 foreach my $field (qw( setup last_bill bill adjourn susp expire cancel )) {
35 my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi, $field);
37 next if $beginning == 0 && $ending == 4294967295
38 or $disable{$cgi->param('status')}->{$field};
40 $search_hash{$field} = [ $beginning, $ending ];
44 my $sql_query = FS::cust_pkg->search(\%search_hash);
45 $sql_query->{'select'} = 'cust_pkg.pkgnum';
47 my $error = FS::cust_pkg::bulk_change( [ $cgi->param('new_pkgpart') ],
48 [ map { $_->pkgnum } qsearch($sql_query) ],
51 $cgi->param("error", substr($error, 0, 512)); # arbitrary length believed
52 # suited for all supported