- if ( $cgi->param('mode') eq 'report' ) {
- # In theory, a package can belong to any subset of the report classes,
- # so the report groups should be all the _subsets_, but for now we're
- # handling the simple case where each package belongs to one report
- # class. Packages with multiple classes will go into one bin at the
- # end.
- push @classnames, '(multiple classes)';
- push @classnums, 'multiple';
+ if ( $cgi->param('class_mode') eq 'report' ) {
+ # The new way:
+ # Actually break down all subsets of the (selected) report classes.
+ my @subsets = FS::part_pkg_report_option->subsets(@classnums);
+ my @classnum_space = @classnums;
+ @classnums = @classnames = ();
+ while(@subsets) {
+ my $these = shift @subsets;
+ # applied topology!
+ my $not_these = [ @classnum_space ];
+ my $i = 0;
+ foreach (@$these) {
+ $i++ until $not_these->[$i] == $_;
+ splice(@$not_these, $i, 1);
+ }
+ push @classnums, $these;
+ push @not_classnums, $not_these;
+ push @classnames, shift @subsets;
+ } #while subsets