summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-07-01 23:01:50 +0200
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-07-01 23:01:50 +0200
commit3e4ca16191bcf1d07dbdc6c370491446fbf0f028 (patch)
treecf55830324b81465d0afd4000c8ffba0db41aea5 /Bugzilla
parent71f44e682fe7b0f68d3a6a609aa5321c081c3fcc (diff)
downloadbugzilla-3e4ca16191bcf1d07dbdc6c370491446fbf0f028.tar.gz
bugzilla-3e4ca16191bcf1d07dbdc6c370491446fbf0f028.tar.xz
Bug 545766: Figure out what columns can be reported on from the database,
instead of from a static list r=glob, a=mkanat
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Search.pm28
-rw-r--r--Bugzilla/Template.pm3
2 files changed, 31 insertions, 0 deletions
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm
index e164e6332..90d22c38c 100644
--- a/Bugzilla/Search.pm
+++ b/Bugzilla/Search.pm
@@ -55,6 +55,8 @@ use Bugzilla::Keyword;
use Date::Format;
use Date::Parse;
+use Storable qw(dclone);
+
# If you specify a search type in the boolean charts, this describes
# which operator maps to which internal function here.
use constant OPERATORS => {
@@ -365,6 +367,32 @@ sub COLUMNS {
return $cache->{search_columns};
}
+sub REPORT_COLUMNS {
+ my $columns = dclone(COLUMNS);
+ # There's no reason to support reporting on unique fields.
+ # Also, some other fields don't make very good reporting axises,
+ # or simply don't work with the current reporting system.
+ my @no_report_columns =
+ qw(bug_id alias short_short_desc opendate changeddate
+ flagtypes.name keywords relevance);
+
+ # Multi-select fields are not currently supported.
+ my @multi_selects = Bugzilla->get_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
+ # columns.
+ if (!Bugzilla->user->is_timetracker) {
+ push(@no_report_columns, TIMETRACKING_FIELDS);
+ }
+
+ foreach my $name (@no_report_columns) {
+ delete $columns->{$name};
+ }
+ return $columns;
+}
+
# Create a new Search
# Note that the param argument may be modified by Bugzilla::Search
sub new {
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm
index 00d7b6d28..a317bb7c7 100644
--- a/Bugzilla/Template.pm
+++ b/Bugzilla/Template.pm
@@ -44,6 +44,7 @@ use Bugzilla::Keyword;
use Bugzilla::Util;
use Bugzilla::User;
use Bugzilla::Error;
+use Bugzilla::Search;
use Bugzilla::Status;
use Bugzilla::Token;
@@ -773,6 +774,8 @@ sub create {
'install_string' => \&Bugzilla::Install::Util::install_string,
+ 'report_columns' => \&Bugzilla::Search::REPORT_COLUMNS,
+
# These don't work as normal constants.
DB_MODULE => \&Bugzilla::Constants::DB_MODULE,
REQUIRED_MODULES =>