diff options
| author | ivan <ivan> | 2011-08-18 23:39:13 +0000 |
|---|---|---|
| committer | ivan <ivan> | 2011-08-18 23:39:13 +0000 |
| commit | 6f5b68a5dc6a6b145c88aa1b2bad3848cc6f8788 (patch) | |
| tree | e7fcc993b3d6d2842a0e67252706e49861911763 /FS | |
| parent | b55fb5df35587a35be4c347073364c132970a533 (diff) | |
attempt fixing "multiple states" links, RT#13922
Diffstat (limited to 'FS')
| -rw-r--r-- | FS/FS/cust_pkg.pm | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index 20e3d449d..347c04bb1 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -3018,25 +3018,29 @@ sub search { } @report_option; } - my @report_option_any = (); - if ( exists($params->{'report_option_any'}) ) { - if ( ref($params->{'report_option_any'}) eq 'ARRAY' ) { - @report_option_any = @{ $params->{'report_option_any'} }; - } elsif ( $params->{'report_option_any'} =~ /^([,\d]*)$/ ) { - @report_option_any = split(',', $1); + foreach my $any ( grep /^report_option_any/ keys %$params ) { + + my @report_option_any = (); + if ( exists($params->{$any}) ) { + if ( ref($params->{$any}) eq 'ARRAY' ) { + @report_option_any = @{ $params->{$any} }; + } elsif ( $params->{$any} =~ /^([,\d]*)$/ ) { + @report_option_any = split(',', $1); + } + } - } + if (@report_option_any) { + # this will result in the empty set for the dangling comma case as it should + push @where, ' ( '. join(' OR ', + map{ "0 < ( SELECT count(*) FROM part_pkg_option + WHERE part_pkg_option.pkgpart = part_pkg.pkgpart + AND optionname = 'report_option_$_' + AND optionvalue = '1' )" + } @report_option_any + ). ' ) '; + } - if (@report_option_any) { - # this will result in the empty set for the dangling comma case as it should - push @where, ' ( '. join(' OR ', - map{ "0 < ( SELECT count(*) FROM part_pkg_option - WHERE part_pkg_option.pkgpart = part_pkg.pkgpart - AND optionname = 'report_option_$_' - AND optionvalue = '1' )" - } @report_option_any - ). ' ) '; } ### |
