2 <% $cgi->redirect(popurl(2)."bulk_unsuspend_pkg.cgi?".$cgi->query_string ) %>
4 <% include('/elements/popup-topreload.html', "Packages Unsuspended") %>
8 unless $FS::CurrentUser::CurrentUser->access_right('Bulk change customer packages');
11 $error = 'Unsuspend packages not confirmed' if !$cgi->param('confirm');
17 $search_hash{'query'} = $cgi->param('query');
20 for (qw( agentnum cust_status cust_main_salesnum salesnum custnum magic status
21 custom cust_fields pkgbatch zip reasonnum
22 477part 477rownum date
25 $search_hash{$_} = $cgi->param($_) if length($cgi->param($_));
29 for my $param (qw( pkgpart classnum refnum towernum )) {
30 $search_hash{$param} = [ $cgi->param($param) ]
31 if grep { $_ eq $param } $cgi->param;
34 #scalars that need to be passed if empty
35 for my $param (qw( censustract censustract2 )) {
36 $search_hash{$param} = $cgi->param($param) || ''
37 if grep { $_ eq $param } $cgi->param;
40 #location flags (checkboxes)
41 my @loc = grep /^\w+$/, $cgi->param('loc');
42 $search_hash{"location_$_"} = 1 foreach @loc;
44 my $report_option = $cgi->param('report_option');
45 $search_hash{report_option} = $report_option if $report_option;
47 for my $param (grep /^report_option_any/, $cgi->param) {
48 $search_hash{$param} = $cgi->param($param);
55 #false laziness w/report_cust_pkg.html and bulk_pkg_increment_bill.cgi
58 'one-time charge' => { 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, },
59 'active' => { 'susp'=>1, 'cancel'=>1 },
60 'suspended' => { 'cancel' => 1 },
65 foreach my $field (qw( setup last_bill bill adjourn susp expire contract_end change_date cancel active )) {
67 $search_hash{$field.'_null'} = scalar( $cgi->param($field.'_null') );
69 my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi, $field);
71 next if $beginning == 0 && $ending == 4294967295
72 or $disable{$cgi->param('status')}->{$field};
74 $search_hash{$field} = [ $beginning, $ending ];
78 my $sql_query = FS::cust_pkg->search(\%search_hash);
79 $sql_query->{'select'} = 'cust_pkg.pkgnum';
81 foreach my $pkgnum (map { $_->pkgnum } qsearch($sql_query)) {
82 my $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum});
83 $error = $cust_pkg->unsuspend;
88 $cgi->param("error", substr($error, 0, 512)); # arbitrary length believed
89 # suited for all supported