summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorivan <ivan>2011-08-18 23:39:43 +0000
committerivan <ivan>2011-08-18 23:39:43 +0000
commit6aa5ef852018ddd7136beb8c750d4d895b1f7584 (patch)
treec842a9ed5fadc9b0247e04d228f54c35d4db06e5 /FS
parent5a492bf6c76aebbbee96544e2a1ed5929b505da5 (diff)
attempt fixing "multiple states" links, RT#13922
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/cust_pkg.pm36
1 files changed, 20 insertions, 16 deletions
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index e0a2eeb44..4a66ddcc6 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -3012,25 +3012,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
- ). ' ) ';
}
###