@bug_status = _valid_values(\@bug_status, $legal_statuses);
# If the user has selected every status, change to selecting none.
- # This is functionally equivalent, but quite a lot faster.
+ # This is functionally equivalent, but quite a lot faster.
if ($all or scalar(@bug_status) == scalar(@$legal_statuses)) {
delete $params->{'bug_status'};
}
my $value_to = $params->{'chfieldvalue'};
$value_to = '' if !defined $value_to;
+ @fields = map { $_ eq '[Bug creation]' ? 'creation_ts' : $_ } @fields;
+
my @charts;
# It is always safe and useful to push delta_ts into the charts
# if there are any dates specified. It doesn't conflict with
if ($date_to ne '') {
push(@charts, ['delta_ts', 'lessthaneq', $date_to]);
}
-
- if (grep { $_ eq '[Bug creation]' } @fields) {
- if ($date_from ne '') {
- push(@charts, ['creation_ts', 'greaterthaneq', $date_from]);
- }
- if ($date_to ne '') {
- push(@charts, ['creation_ts', 'lessthaneq', $date_to]);
- }
- }
# Basically, we construct the chart like:
#
if ($value_to ne '') {
my @value_chart;
foreach my $field (@fields) {
- next if $field eq '[Bug creation]';
push(@value_chart, $field, 'changedto', $value_to);
}
push(@charts, \@value_chart) if @value_chart;
if ($date_from ne '') {
my @date_from_chart;
foreach my $field (@fields) {
- next if $field eq '[Bug creation]';
push(@date_from_chart, $field, 'changedafter', $date_from);
}
push(@charts, \@date_from_chart) if @date_from_chart;
my ($chart_id, $joins, $field, $operator, $value) =
@$args{qw(chart_id joins field operator value)};
my $dbh = Bugzilla->dbh;
-
- my $sql_operator = ($operator =~ /before/) ? '<=' : '>=';
+
my $field_object = $self->_chart_fields->{$field}
|| ThrowCodeError("invalid_field_name", { field => $field });
+
+ # Asking when creation_ts changed is just asking when the bug was created.
+ if ($field_object->name eq 'creation_ts') {
+ $args->{operator} =
+ $operator eq 'changedbefore' ? 'lessthaneq' : 'greaterthaneq';
+ return $self->_do_operator_function($args);
+ }
+
+ my $sql_operator = ($operator =~ /before/) ? '<=' : '>=';
my $field_id = $field_object->id;
# Charts on changed* fields need to be field-specific. Otherwise,
# OR chart rows make no sense if they contain multiple fields.
'changedbefore' => {
CHANGED_BROKEN,
'attach_data.thedata' => { contains => [1] },
- creation_ts => { contains => [1,2,5] },
},
'changedafter' => {
'attach_data.thedata' => { contains => [2,3,4] },
classification => { contains => [2,3,4] },
commenter => { contains => [2,3,4] },
- creation_ts => { contains => [2,3,4] },
delta_ts => { contains => [2,3,4] },
percentage_complete => { contains => [2,3,4] },
'requestees.login_name' => { contains => [2,3,4] },
"attach_data.thedata" => { contains => [2, 3, 4] },
"classification" => { contains => [2, 3, 4] },
"commenter" => { contains => [2, 3, 4] },
- "creation_ts" => { contains => [2, 3, 4] },
"delta_ts" => { contains => [2, 3, 4] },
"percentage_complete" => { contains => [2, 3, 4] },
"requestees.login_name" => { contains => [2, 3, 4] },
},
changedbefore=> {
CHANGED_BROKEN_NOT,
- creation_ts => { contains => [1, 2, 5] },
work_time => { }
},
changedby => {
{ contains => [1], value => '<1-delta>',
override => {
CHANGED_OVERRIDE,
- creation_ts => { contains => [1,2,5] },
+ creation_ts => { contains => [1,5] },
blocked => { contains => [1,2] },
dependson => { contains => [1,3] },
longdesc => { contains => [1,5] },
{ contains => [2,3,4], value => '<2-delta>',
override => {
CHANGED_OVERRIDE,
- creation_ts => { contains => [2,3,4] },
+ creation_ts => { contains => [3,4] },
# We only change this for one bug, and it doesn't match.
'longdescs.isprivate' => { contains => [] },
# Same for everconfirmed.
# search => 1 means the Bugzilla::Search creation fails, but
# field_ok contains fields that it does actually succeed for.
use constant INJECTION_BROKEN_OPERATOR => {
- changedafter => { search => 1 },
- changedbefore => { search => 1 },
+ changedafter => { search => 1, field_ok => ['creation_ts'] },
+ changedbefore => { search => 1, field_ok => ['creation_ts'] },
changedby => { search => 1 },
};