summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorTiago Mello <timello@gmail.com>2010-08-24 22:25:49 +0200
committerTiago Mello <timello@gmail.com>2010-08-24 22:25:49 +0200
commit85e75aba6a7131da9d63b1f628a27e986bb428c5 (patch)
tree62ea9dab6305ba21a67b1904523435365b53aae5 /Bugzilla
parente09c48b2f7668071264c975f9191cf41b493ef1c (diff)
downloadbugzilla-85e75aba6a7131da9d63b1f628a27e986bb428c5.tar.gz
bugzilla-85e75aba6a7131da9d63b1f628a27e986bb428c5.tar.xz
Bug 586871: Convert all Bugzilla->get_fields calls to Bugzilla->fields
r/a=mkanat
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Bug.pm23
-rw-r--r--Bugzilla/BugMail.pm2
-rw-r--r--Bugzilla/Field.pm8
-rw-r--r--Bugzilla/Install/DB.pm4
-rw-r--r--Bugzilla/Migrate.pm2
-rw-r--r--Bugzilla/Search.pm7
-rw-r--r--Bugzilla/Search/Quicksearch.pm2
-rw-r--r--Bugzilla/WebService/Bug.pm6
8 files changed, 28 insertions, 26 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index 915ce5307..4c8922352 100644
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -195,11 +195,11 @@ sub VALIDATOR_DEPENDENCIES {
version => ['product'],
);
- my @custom_deps = Bugzilla->get_fields(
- { visibility_field_id => NOT_NULL });
- foreach my $field (@custom_deps) {
- $deps{$field->name} = [$field->visibility_field->name];
+ foreach my $field (@{ Bugzilla->fields }) {
+ $deps{$field->name} = [ $field->visibility_field->name ]
+ if $field->{visibility_field_id};
}
+
$cache->{bug_validator_dependencies} = \%deps;
return \%deps;
};
@@ -242,7 +242,7 @@ use constant NUMERIC_COLUMNS => qw(
);
sub DATE_COLUMNS {
- my @fields = Bugzilla->get_fields({ type => FIELD_TYPE_DATETIME });
+ my @fields = @{ Bugzilla->fields({ type => FIELD_TYPE_DATETIME }) };
return map { $_->name } @fields;
}
@@ -739,9 +739,9 @@ sub run_create_validators {
Bugzilla::Hook::process('bug_end_of_create_validators',
{ params => $params });
- my @mandatory_fields = Bugzilla->get_fields({ is_mandatory => 1,
- enter_bug => 1,
- obsolete => 0 });
+ my @mandatory_fields = @{ Bugzilla->fields({ is_mandatory => 1,
+ enter_bug => 1,
+ obsolete => 0 }) };
foreach my $field (@mandatory_fields) {
$class->_check_field_is_mandatory($params->{$field->name}, $field,
$params);
@@ -3501,7 +3501,7 @@ sub bug_alias_to_id {
sub editable_bug_fields {
my @fields = Bugzilla->dbh->bz_table_columns('bugs');
# Obsolete custom fields are not editable.
- my @obsolete_fields = Bugzilla->get_fields({obsolete => 1, custom => 1});
+ my @obsolete_fields = @{ Bugzilla->fields({obsolete => 1, custom => 1}) };
@obsolete_fields = map { $_->name } @obsolete_fields;
foreach my $remove ("bug_id", "reporter", "creation_ts", "delta_ts",
"lastdiffed", @obsolete_fields)
@@ -4061,8 +4061,9 @@ sub AUTOLOAD {
return $self->{$attr} if defined $self->{$attr};
- $self->{_multi_selects} ||= [Bugzilla->get_fields(
- {custom => 1, type => FIELD_TYPE_MULTI_SELECT })];
+ $self->{_multi_selects} ||= Bugzilla->fields(
+ { custom => 1, type => FIELD_TYPE_MULTI_SELECT });
+
if ( grep($_->name eq $attr, @{$self->{_multi_selects}}) ) {
# There is a bug in Perl 5.10.0, which is fixed in 5.10.1,
# which taints $attr at this point. trick_taint() can go
diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm
index c76b7dbbd..2ac575293 100644
--- a/Bugzilla/BugMail.pm
+++ b/Bugzilla/BugMail.pm
@@ -408,7 +408,7 @@ sub _get_diffs {
sub _get_new_bugmail_fields {
my $bug = shift;
- my @fields = Bugzilla->get_fields({obsolete => 0, mailhead => 1});
+ my @fields = @{ Bugzilla->fields({obsolete => 0, in_new_bugmail => 1}) };
my @diffs;
foreach my $field (@fields) {
diff --git a/Bugzilla/Field.pm b/Bugzilla/Field.pm
index ee1168936..daf708179 100644
--- a/Bugzilla/Field.pm
+++ b/Bugzilla/Field.pm
@@ -28,7 +28,7 @@ Bugzilla::Field - a particular piece of information about bugs
use Data::Dumper;
# Display information about all fields.
- print Dumper(Bugzilla->get_fields());
+ print Dumper(Bugzilla->fields());
# Display information about non-obsolete custom fields.
print Dumper(Bugzilla->active_custom_fields);
@@ -36,9 +36,9 @@ Bugzilla::Field - a particular piece of information about bugs
use Bugzilla::Field;
# Display information about non-obsolete custom fields.
- # Bugzilla->get_fields() is a wrapper around Bugzilla::Field->match(),
- # so both methods take the same arguments.
- print Dumper(Bugzilla::Field->match({ obsolete => 0, custom => 1 }));
+ # Bugzilla->fields() is a wrapper around Bugzilla::Field->get_all(),
+ # with arguments which filter the fields before returning them.
+ print Dumper(Bugzilla->fields({ obsolete => 0, custom => 1 }));
# Create or update a custom field or field definition.
my $field = Bugzilla::Field->create(
diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm
index 01270aab6..bfce7779f 100644
--- a/Bugzilla/Install/DB.pm
+++ b/Bugzilla/Install/DB.pm
@@ -3257,9 +3257,9 @@ sub _fix_logincookies_ipaddr {
}
sub _fix_invalid_custom_field_names {
- my @fields = Bugzilla->get_fields({ custom => 1 });
+ my $fields = Bugzilla->fields({ custom => 1 });
- foreach my $field (@fields) {
+ foreach my $field (@$fields) {
next if $field->name =~ /^[a-zA-Z0-9_]+$/;
# The field name is illegal and can break the DB. Kill the field!
$field->set_obsolete(1);
diff --git a/Bugzilla/Migrate.pm b/Bugzilla/Migrate.pm
index e72c5c52e..8c3840800 100644
--- a/Bugzilla/Migrate.pm
+++ b/Bugzilla/Migrate.pm
@@ -254,7 +254,7 @@ sub debug {
sub bug_fields {
my $self = shift;
- $self->{bug_fields} ||= { map { $_->{name} => $_ } Bugzilla->get_fields };
+ $self->{bug_fields} ||= Bugzilla->fields({ by_name => 1 });
return $self->{bug_fields};
}
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm
index abd3fd53e..cde1f8e35 100644
--- a/Bugzilla/Search.pm
+++ b/Bugzilla/Search.pm
@@ -557,7 +557,8 @@ sub COLUMNS {
}
# Do the actual column-getting from fielddefs, now.
- foreach my $field (Bugzilla->get_fields({ obsolete => 0, buglist => 1 })) {
+ my @fields = @{ Bugzilla->fields({ obsolete => 0, buglist => 1 }) };
+ foreach my $field (@fields) {
my $id = $field->name;
$id = $old_names{$id} if exists $old_names{$id};
my $sql;
@@ -593,8 +594,8 @@ sub REPORT_COLUMNS {
flagtypes.name keywords relevance);
# Multi-select fields are not currently supported.
- my @multi_selects = Bugzilla->get_fields(
- { obsolete => 0, type => FIELD_TYPE_MULTI_SELECT });
+ my @multi_selects = @{Bugzilla->fields(
+ { obsolete => 0, type => FIELD_TYPE_MULTI_SELECT })};
push(@no_report_columns, map { $_->name } @multi_selects);
# If you're not a time-tracker, you can't use time-tracking
diff --git a/Bugzilla/Search/Quicksearch.pm b/Bugzilla/Search/Quicksearch.pm
index b96dd3d4d..602b78af0 100644
--- a/Bugzilla/Search/Quicksearch.pm
+++ b/Bugzilla/Search/Quicksearch.pm
@@ -80,7 +80,7 @@ sub FIELD_MAP {
# Get all the fields whose names don't contain periods. (Fields that
# contain periods are always handled in MAPPINGS.)
my @db_fields = grep { $_->name !~ /\./ }
- Bugzilla->get_fields({ obsolete => 0 });
+ @{ Bugzilla->fields({ obsolete => 0 }) };
my %full_map = (%{ MAPPINGS() }, map { $_->name => $_->name } @db_fields);
# Eliminate the fields that start with bug_ or rep_, because those are
diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm
index 8558e04f7..953355385 100644
--- a/Bugzilla/WebService/Bug.pm
+++ b/Bugzilla/WebService/Bug.pm
@@ -104,7 +104,7 @@ sub fields {
}
if (!defined $params->{ids} and !defined $params->{names}) {
- @fields = Bugzilla->get_fields({ obsolete => 0 });
+ @fields = @{ Bugzilla->fields({ obsolete => 0 }) };
}
my @fields_out;
@@ -558,8 +558,8 @@ sub legal_values {
my $field = Bugzilla::Bug::FIELD_MAP->{$params->{field}}
|| $params->{field};
- my @global_selects = grep { !$_->is_abnormal }
- Bugzilla->get_fields({ is_select => 1 });
+ my @global_selects =
+ @{ Bugzilla->fields({ is_select => 1, is_abnormal => 0 }) };
my $values;
if (grep($_->name eq $field, @global_selects)) {