Bug 70605 - Allow more columns in reports, remove duplicate code

git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@1482 6955db30-a419-402b-8a0d-67ecbb4d7f56
master
vfilippov 2011-12-23 14:45:21 +00:00
parent 9c3b9ca6f6
commit 154fe7f38b
6 changed files with 47 additions and 78 deletions

View File

@ -951,6 +951,7 @@ or deleted.
=cut
# FIXME move this notification out of here!
sub notify {
my ($class, $flag, $old_flag, $obj) = @_;
@ -996,6 +997,7 @@ sub notify {
# Is there someone to notify?
return unless ($addressee || $cc_list);
# УБРАТЬ
# If the target bug is restricted to one or more groups, then we need
# to make sure we don't send email about it to unauthorized users
# on the request type's CC: list, so we have to trawl the list for users
@ -1017,6 +1019,8 @@ sub notify {
if ($addressee && $addressee->email_enabled) {
$recipients{$addressee->email} = $addressee;
}
# /УБРАТЬ
# Process and send notification for each recipient.
# If there are users in the CC list who don't have an account,
# use the default language for email notifications.

View File

@ -612,6 +612,7 @@ sub STATIC_COLUMNS
# FIXME move truncation away from templates
$columns->{short_short_desc} = { %{ $columns->{short_desc} } };
$columns->{short_short_desc}->{nocharts} = 1;
$columns->{short_short_desc}->{noreports} = 1;
Bugzilla::Hook::process('buglist_static_columns', { columns => $columns });
@ -636,32 +637,32 @@ sub COLUMNS
return $cache->{columns} = \%columns;
}
## FIXME Should REPORT_COLUMNS() be here? In Bugzilla 4.0 trunk it is.
#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;
#}
sub REPORT_COLUMNS
{
my $cache = Bugzilla->request_cache;
return $cache->{report_columns} if defined $cache->{report_columns};
my $columns = COLUMNS();
# There's no reason to support reporting on unique fields.
my @no_report_columns = qw(
bug_id alias short_short_desc opendate changeddate delta_ts relevance
);
# Do not report on obsolete columns.
push @no_report_columns, map { $_->name } Bugzilla->get_fields({ obsolete => 1 });
# Subselect fields are also not supported.
push @no_report_columns, grep { /\./ || $columns->{$_}->{nobuglist} || $columns->{$_}->{subid} } keys %$columns;
# FIXME Multi-select fields are now incorrectly supported in reports.
# They report like: "a,b: 80 bugs; a: 20 bugs; b: 10 bugs". I.e. the grouping
# is by value sets, not by individual values.
# Unset non-reportable columns
foreach my $name (@no_report_columns)
{
delete $columns->{$name};
}
return $cache->{report_columns} = $columns;
}
# Fields that can be searched on for changes
# This is now used only by query.cgi

View File

@ -16,6 +16,7 @@ sub buglist_static_columns
# CustIS Bug 71955 - first comment to the bug
$columns->{comment0} = {
title => "First Comment",
noreports => 1,
};
$columns->{lastcommenter} = {
title => "Last Commenter",

View File

@ -179,8 +179,13 @@ $vars->{chfield} = [
@{ Bugzilla::Search->CHANGEDFROMTO_FIELDS }
];
# Boolean charts
# Fields for reports
$vars->{report_columns} = [
sort { $a->{title} cmp $b->{title} }
values %{Bugzilla::Search::REPORT_COLUMNS()}
];
# Boolean charts
my $opdescs = Bugzilla->messages->{operator_descs};
$vars->{chart_types} = Bugzilla::Search->CHART_OPERATORS_ORDER;
$vars->{text_types} = Bugzilla::Search->TEXT_OPERATORS_ORDER;
@ -275,13 +280,6 @@ if (Bugzilla->params->{usestatuswhiteboard})
push @{$vars->{freetext_fields}},
Bugzilla->active_custom_fields({ type => [ FIELD_TYPE_TEXTAREA, FIELD_TYPE_FREETEXT, FIELD_TYPE_EXTURL ] });
if ($params->{format} && $params->{format} =~ /^report-(table|graph)$/)
{
# Get legal custom fields for tabular and graphical reports.
my @custom_fields_for_reports = Bugzilla->active_custom_fields({ type => FIELD_TYPE_SINGLE_SELECT });
$vars->{custom_fields} = \@custom_fields_for_reports;
}
($vars->{known_name}) = list $params->{known_name};
$vars->{columnlist} = $params->{columnlist};

View File

@ -40,7 +40,7 @@ my $buffer = $cgi->query_string();
if (grep(/^cmd-/, $cgi->param())) {
my $params = $cgi->canonicalise_query("format", "ctype");
my $location = "query.cgi?format=" . $cgi->param('query_format') .
($params ? "&$params" : "");
($params ? "&$params" : "");
print $cgi->redirect($location);
exit;
@ -59,25 +59,7 @@ if ($action eq "menu") {
exit;
}
# FIXME Список полей должен быть в одном месте (а он сейчас ещё в search/search-report-select)
# Valid bug fields that can be reported on.
my @columns = qw(
assigned_to
reporter
qa_contact
component
classification
version
votes
keywords
target_milestone
status_whiteboard
);
# Single-select fields (custom or not) are also accepted as valid.
my @single_selects = Bugzilla->get_fields({ type => FIELD_TYPE_SINGLE_SELECT,
obsolete => 0 });
push(@columns, map { $_->name } @single_selects);
my %valid_columns = map { $_ => 1 } @columns;
my $valid_columns = Bugzilla::Search::REPORT_COLUMNS();
my $field = {};
for (qw(x y z))
@ -86,7 +68,7 @@ for (qw(x y z))
trick_taint($f);
if ($f)
{
if ($valid_columns{$f})
if ($valid_columns->{$f})
{
$field->{$_} = $f;
}

View File

@ -16,6 +16,7 @@
# Rights Reserved.
#
# Contributor(s): Gervase Markham <gerv@gerv.net>
# Vitaliy Filippov <vitalif@mail.ru>
#%]
[%# INTERFACE:
@ -24,31 +25,13 @@
#%]
[% BLOCK select %]
[% rep_fields = ["classification", "product", "component", "version"] %]
[% rep_fields.push("rep_platform") IF Param('useplatform') %]
[% rep_fields.push("op_sys") IF Param('useopsys') %]
[% rep_fields.push("bug_status", "resolution", "bug_severity",
"priority", "target_milestone", "assigned_to",
"reporter", "qa_contact", "votes", "status_whiteboard") %]
<select name="[% name FILTER html %]">
<option value="">&lt;none&gt;</option>
[% FOREACH field = rep_fields %]
[% NEXT IF field == "classification" AND !Param('useclassification') %]
[% NEXT IF field == "target_milestone" AND !Param('usetargetmilestone') %]
[% NEXT IF field == "qa_contact" AND !Param('useqacontact') %]
[% NEXT IF field == "votes" AND !Param('usevotes') %]
<option value="[% field FILTER html %]"
[% " selected" IF default.$name.0 == field %]>
[% field_descs.$field || field FILTER html %]</option>
[% END %]
[%# Single-select fields are also valid column names. %]
[% FOREACH field = custom_fields %]
<option value="[% field.name FILTER html %]"
[% " selected" IF default.$name.0 == field.name %]>
[% field.description FILTER html %]</option>
[% FOREACH field = report_columns %]
<option value="[% field.id FILTER html %]"
[% " selected" IF default.$name.0 == field.id %]>
[%# FIXME Take field descriptions from Bugzilla->messages->field_descs to field.description %]
[% field_descs.$field || field.title || field.id FILTER html %]</option>
[% END %]
</select>
[% END %]