summaryrefslogtreecommitdiffstats
path: root/Bugzilla/WebService/Util.pm
diff options
context:
space:
mode:
authorSimon Green <sgreen@redhat.com>2013-02-15 15:16:48 +0100
committerFrédéric Buclin <LpSolit@gmail.com>2013-02-15 15:16:48 +0100
commitaa73e4b5cf57c21c06c604375a7fcc6b5a981f3e (patch)
tree01b8ae84de246192d8ccc743a2cad72106d80b40 /Bugzilla/WebService/Util.pm
parent82bab122d14431f4bf3f1c31988434aec2386515 (diff)
downloadbugzilla-aa73e4b5cf57c21c06c604375a7fcc6b5a981f3e.tar.gz
bugzilla-aa73e4b5cf57c21c06c604375a7fcc6b5a981f3e.tar.xz
Bug 838846: In Product.get, include_fields => ['components'] no longer returns data about components
r/a=LpSolit
Diffstat (limited to 'Bugzilla/WebService/Util.pm')
-rw-r--r--Bugzilla/WebService/Util.pm17
1 files changed, 13 insertions, 4 deletions
diff --git a/Bugzilla/WebService/Util.pm b/Bugzilla/WebService/Util.pm
index 9e20a1e06..d2a8de85c 100644
--- a/Bugzilla/WebService/Util.pm
+++ b/Bugzilla/WebService/Util.pm
@@ -43,11 +43,20 @@ sub filter_wants ($$;$) {
$field = "${prefix}.${field}" if $prefix;
- if (defined $params->{include_fields}) {
- return 0 if !$include{$field};
+ if (defined $params->{exclude_fields} && $exclude{$field}) {
+ return 0;
}
- if (defined $params->{exclude_fields}) {
- return 0 if $exclude{$field};
+ if (defined $params->{include_fields} && !$include{$field}) {
+ if ($prefix) {
+ # Include the field if the parent is include (and this one is not excluded)
+ return 0 if !$include{$prefix};
+ }
+ else {
+ # We want to include this if one of the sub keys is included
+ my $key = $field . '.';
+ my $len = length($key);
+ return 0 if ! grep { substr($_, 0, $len) eq $key } keys %include;
+ }
}
return 1;