1 <& /elements/header.html, 'Edit package report classes' &>
2 %# change that title if we add any other editing controls
4 %# this should be centralized somewhere
5 <STYLE TYPE="text/css">
6 .row0 { background-color: #eeeeee; }
7 .row1 { background-color: #ffffff; }
9 <& /elements/error.html &>
11 <FORM ACTION="process/bulk-part_pkg.html" METHOD="POST">
13 The following packages will be changed:<BR>
14 % foreach my $pkgpart (sort keys(%part_pkg)) {
15 <INPUT TYPE="hidden" NAME="pkgpart" VALUE="<% $pkgpart %>">
16 <% $part_pkg{$pkgpart}->pkg_comment |h %><BR>
20 <& /elements/table-grid.html &>\
21 <& /elements/tr-justtitle.html, value => mt('Report classes') &>
23 % foreach my $num (sort keys %report_class) {
24 <TR CLASS="row<%$row % 2%>">
26 % if ( $initial_state{$num} == -1 ) {
27 % # needs to be a tristate so that you can say "don't change it"
28 <& /elements/checkbox-tristate.html, field => 'report_option_'.$num &>
30 %# for visual consistency
31 <INPUT TYPE="checkbox" CLASS="partial" NAME="report_option_<%$num%>" VALUE="1" <% $initial_state{$num} ? 'CHECKED':'' %>><LABEL />
34 <TD><% $report_class{$num}->name %></TD>
42 <& /elements/footer.html &>
44 die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Bulk edit package definitions');
45 my @pkgparts = $cgi->param('pkgpart')
46 or die "no package definitions selected";
48 my %part_pkg = map { $_ => FS::part_pkg->by_key($_) } @pkgparts;
49 my %part_pkg_option = map { $_ => { $part_pkg{$_}->options } } @pkgparts;
50 my %report_class = map { $_->num => $_ }
51 qsearch('part_pkg_report_option', { disabled => '' });
54 foreach my $num (keys %report_class) {
57 foreach my $option (values %part_pkg_option) {
58 if ( $option->{"report_option_$num"} ) {
65 $initial_state{$num} = -1;
67 $initial_state{$num} = 1;
69 $initial_state{$num} = '';
70 } # else, uh, you didn't provide any pkgparts