aboutsummaryrefslogtreecommitdiffstats
path: root/Bugzilla.pm
diff options
context:
space:
mode:
authorTiago Mello <timello@gmail.com>2010-08-24 17:25:49 -0300
committerTiago Mello <timello@gmail.com>2010-08-24 17:25:49 -0300
commit85e75aba6a7131da9d63b1f628a27e986bb428c5 (patch)
tree62ea9dab6305ba21a67b1904523435365b53aae5 /Bugzilla.pm
parente09c48b2f7668071264c975f9191cf41b493ef1c (diff)
downloadbugs-85e75aba6a7131da9d63b1f628a27e986bb428c5.tar
bugs-85e75aba6a7131da9d63b1f628a27e986bb428c5.tar.gz
bugs-85e75aba6a7131da9d63b1f628a27e986bb428c5.tar.bz2
bugs-85e75aba6a7131da9d63b1f628a27e986bb428c5.tar.xz
bugs-85e75aba6a7131da9d63b1f628a27e986bb428c5.zip
Bug 586871: Convert all Bugzilla->get_fields calls to Bugzilla->fields
r/a=mkanat
Diffstat (limited to 'Bugzilla.pm')
-rw-r--r--Bugzilla.pm27
1 files changed, 13 insertions, 14 deletions
diff --git a/Bugzilla.pm b/Bugzilla.pm
index d97049678..c911de733 100644
--- a/Bugzilla.pm
+++ b/Bugzilla.pm
@@ -563,28 +563,27 @@ sub fields {
my $fields = $cache->{fields};
my %requested;
- if (my $types = $criteria->{type}) {
+ if (my $types = delete $criteria->{type}) {
$types = ref($types) ? $types : [$types];
%requested = map { %{ $fields->{by_type}->{$_} || {} } } @$types;
}
else {
%requested = %{ $fields->{by_name} };
}
-
- my $do_by_name = $criteria->{by_name};
- return $do_by_name ? \%requested : [values %requested];
-}
+ my $do_by_name = delete $criteria->{by_name};
-# DEPRECATED. Use fields() instead.
-sub get_fields {
- my $class = shift;
- my $criteria = shift;
- # This function may be called during installation, and Field::match
- # may fail at that time. so we want to return an empty list in that
- # case.
- my $fields = eval { Bugzilla::Field->match($criteria) } || [];
- return @$fields;
+ # Filtering before returning the fields based on
+ # the criterias.
+ foreach my $filter (keys %$criteria) {
+ foreach my $field (keys %requested) {
+ if ($requested{$field}->$filter != $criteria->{$filter}) {
+ delete $requested{$field};
+ }
+ }
+ }
+
+ return $do_by_name ? \%requested : [values %requested];
}
sub active_custom_fields {