@Bugzilla::Bug::EXPORT = qw(
bug_alias_to_id
LogActivityEntry
- editable_bug_fields
);
my %CLEANUP;
# Subroutines
#####################################################################
-# Returns a list of currently active and editable bug fields,
-# including multi-select fields.
-sub editable_bug_fields {
- my @fields = Bugzilla->dbh->bz_table_columns('bugs');
-
- # Add multi-select fields
- push(@fields,
- map { $_->name }
- @{Bugzilla->fields({obsolete => 0, type => FIELD_TYPE_MULTI_SELECT})});
-
- # Obsolete custom fields are not editable.
- 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)
- {
- my $location = firstidx { $_ eq $remove } @fields;
-
- # Ensure field exists before attempting to remove it.
- splice(@fields, $location, 1) if ($location > -1);
- }
-
- Bugzilla::Hook::process('bug_editable_bug_fields', {fields => \@fields});
-
- # Sorted because the old @::log_columns variable, which this replaces,
- # was sorted.
- return sort(@fields);
-}
-
# Emit a list of dependencies or regressions. Join with bug_status and bugs
# tables to show bugs with open statuses first, and then the others
sub list_relationship {
}
}
-sub bug_editable_bug_fields {
- my ($self, $args) = @_;
- my $fields = $args->{'fields'};
- my @tracking_flags = Bugzilla::Extension::TrackingFlags::Flag->get_all;
- foreach my $flag (@tracking_flags) {
- push(@$fields, $flag->name);
- }
-}
-
sub search_operator_field_override {
my ($self, $args) = @_;
my $operators = $args->{'operators'};
}
my @chfields;
+my $search_fields = Bugzilla::Search::search_fields({obsolete => 0});
+my $uneditable_fields_re = join('|', qw(
+ attachments\.submitter
+ bug_id
+ commenter
+ creation_ts
+ delta_ts
+ lastdiffed
+ reporter
+));
push @chfields, "[Bug creation]";
# This is what happens when you have variables whose definition depends
# on the DB schema, and then the underlying schema changes...
-foreach my $val (editable_bug_fields()) {
+foreach my $val (keys %$search_fields) {
if ($val eq 'classification_id') {
$val = 'classification';
}
elsif ($val eq 'component_id') {
$val = 'component';
}
+ elsif ($val =~ /^(?:$uneditable_fields_re)$/) {
+ next;
+ }
push @chfields, $val;
}
# Boolean charts
my @fields = sort { lc($a->description) cmp lc($b->description) }
- values %{Bugzilla::Search::search_fields({obsolete => 0})};
+ values %$search_fields;
unshift(@fields, {name => "noop", description => "---"});
$vars->{'fields'} = \@fields;