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; }
10 <FORM ACTION="process/bulk-part_pkg.html" METHOD="POST">
12 The following packages will be changed:<BR>
13 % foreach my $pkgpart (sort keys(%part_pkg)) {
14 <INPUT TYPE="hidden" NAME="pkgpart" VALUE="<% $pkgpart %>">
15 <% $part_pkg{$pkgpart}->pkg_comment |h %><BR>
19 <& /elements/table-grid.html &>\
20 <& /elements/tr-justtitle.html, value => mt('Report classes') &>
22 % foreach my $num (sort keys %report_class) {
23 <TR CLASS="row<%$row % 2%>">
25 % if ( $initial_state{$num} == -1 ) {
26 % # needs to be a tristate so that you can say "don't change it"
27 <& /elements/checkbox-tristate.html, field => 'report_option_'.$num &>
29 %# for visual consistency
30 <INPUT TYPE="checkbox" CLASS="partial" NAME="report_option_<%$num%>" VALUE="1" <% $initial_state{$num} ? 'CHECKED':'' %>><LABEL />
33 <TD><% $report_class{$num}->name %></TD>
41 <& /elements/footer.html &>
43 die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Bulk edit package definitions');
44 my @pkgparts = $cgi->param('pkgpart')
45 or die "no package definitions selected";
47 my %part_pkg = map { $_ => FS::part_pkg->by_key($_) } @pkgparts;
48 my %part_pkg_option = map { $_ => { $part_pkg{$_}->options } } @pkgparts;
49 my %report_class = map { $_->num => $_ }
50 qsearch('part_pkg_report_option', { disabled => '' });
53 foreach my $num (keys %report_class) {
56 foreach my $option (values %part_pkg_option) {
57 if ( $option->{"report_option_$num"} ) {
64 $initial_state{$num} = -1;
66 $initial_state{$num} = 1;
68 $initial_state{$num} = '';
69 } # else, uh, you didn't provide any pkgparts
71 warn Dumper \%initial_state;