diff options
author | Simon Green <sgreen@redhat.com> | 2013-03-25 15:47:56 +0100 |
---|---|---|
committer | Dave Lawrence <dlawrence@mozilla.com> | 2013-03-25 15:47:56 +0100 |
commit | 64a789e7629fa8b20f68267245d7fe79dd14d41a (patch) | |
tree | 4fef3b5a6c615f9f78b300df2a7f01954b229607 /Bugzilla/WebService/Util.pm | |
parent | ba88aea7c2824dc612add370e836a1fedd5740d4 (diff) | |
download | bugzilla-64a789e7629fa8b20f68267245d7fe79dd14d41a.tar.gz bugzilla-64a789e7629fa8b20f68267245d7fe79dd14d41a.tar.xz |
Bug 838846 - In Product.get, include_fields => ['components'] no longer returns data about components
Diffstat (limited to 'Bugzilla/WebService/Util.pm')
-rw-r--r-- | Bugzilla/WebService/Util.pm | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/Bugzilla/WebService/Util.pm b/Bugzilla/WebService/Util.pm index dbf670bf7..193dab92d 100644 --- a/Bugzilla/WebService/Util.pm +++ b/Bugzilla/WebService/Util.pm @@ -52,11 +52,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; |