2 % $cgi->param('error', $error);
3 <% $cgi->redirect(popurl(2). 'bulk_pkg_increment_bill.cgi?'. $cgi->query_string ) %>
5 <& /elements/header-popup.html, 'Packages Adjusted' &>
6 <SCRIPT TYPE="text/javascript">
13 local $FS::UID::AutoCommit = 0;
18 unless $FS::CurrentUser::CurrentUser->access_right('Bulk change customer packages')
19 and $FS::CurrentUser::CurrentUser->access_right('Edit customer package dates');
21 my $days = $cgi->param('days') or die "missing parameter: days";
22 $days > 0 or $error = "Number of days must be > 0";
26 $search_hash{'query'} = $cgi->param('query');
28 for my $param (qw(agentnum magic status classnum pkgpart)) {
29 $search_hash{$param} = $cgi->param($param)
30 if $cgi->param($param);
37 #false laziness w/report_cust_pkg.html
38 # and, now, w/bulk_change_pkg.cgi
41 'one-time charge' => { 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, },
42 'active' => { 'susp'=>1, 'cancel'=>1 },
43 'suspended' => { 'cancel' => 1 },
48 foreach my $field (qw( setup last_bill bill adjourn susp expire cancel )) {
50 my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi, $field);
52 next if $beginning == 0 && $ending == 4294967295
53 or $disable{$cgi->param('status')}->{$field};
55 $search_hash{$field} = [ $beginning, $ending ];
60 foreach my $cust_pkg (qsearch(FS::cust_pkg->search(\%search_hash))) {
61 next if ! $cust_pkg->bill;
62 my $new_cust_pkg = FS::cust_pkg->new({ $cust_pkg->hash });
63 $new_cust_pkg->bill($new_cust_pkg->bill + $days*86400);
64 $error = $new_cust_pkg->replace($cust_pkg);
67 $cgi->param("error",substr($error, 0, 512));