summaryrefslogtreecommitdiffstats
path: root/extensions/BMO/lib/Reports
diff options
context:
space:
mode:
authorByron Jones <glob@mozilla.com>2015-10-09 06:54:23 +0200
committerByron Jones <glob@mozilla.com>2015-10-09 06:54:23 +0200
commitc0de3b68fb334d059fd8b717204aa52028b36532 (patch)
tree9258120f200ee49a9f1111e8e0b55e63f0f33dfc /extensions/BMO/lib/Reports
parentd055408248158b16a8e2d707d958939696fb3fd6 (diff)
downloadbugzilla-c0de3b68fb334d059fd8b717204aa52028b36532.tar.gz
bugzilla-c0de3b68fb334d059fd8b717204aa52028b36532.tar.xz
Bug 1029800 - Release Tracking Report doesn't return bugs with tracking flags set to --- when searching for "not fixed" values
Diffstat (limited to 'extensions/BMO/lib/Reports')
-rw-r--r--extensions/BMO/lib/Reports/ReleaseTracking.pm40
1 files changed, 17 insertions, 23 deletions
diff --git a/extensions/BMO/lib/Reports/ReleaseTracking.pm b/extensions/BMO/lib/Reports/ReleaseTracking.pm
index 5a07ae196..2535340cb 100644
--- a/extensions/BMO/lib/Reports/ReleaseTracking.pm
+++ b/extensions/BMO/lib/Reports/ReleaseTracking.pm
@@ -122,6 +122,7 @@ sub report {
my @unlink_products;
foreach my $product (@usable_products) {
my @fields =
+ sort { $a->sortkey <=> $b->sortkey }
grep { is_active_status_field($_) }
Bugzilla->active_custom_fields({ product => $product });
my @field_ids = map { $_->id } @fields;
@@ -156,6 +157,7 @@ sub report {
if (!$existing) {
push @fields_json, {
name => $field->name,
+ desc => $field->description,
id => $field->id,
};
}
@@ -239,15 +241,10 @@ sub report {
my $query = "
SELECT DISTINCT b.bug_id
FROM bugs b
- INNER JOIN flags f ON f.bug_id = b.bug_id ";
+ INNER JOIN flags f ON f.bug_id = b.bug_id\n";
if ($q->{start_date}) {
- $query .= "INNER JOIN bugs_activity a ON a.bug_id = b.bug_id ";
- }
-
- if (grep($_ == FIELD_TYPE_EXTENSION, map { $_->{type} } @{ $q->{fields} })) {
- $query .= "LEFT JOIN tracking_flags_bugs AS tfb ON tfb.bug_id = b.bug_id " .
- "LEFT JOIN tracking_flags AS tf ON tfb.tracking_flag_id = tf.id ";
+ $query .= "INNER JOIN bugs_activity a ON a.bug_id = b.bug_id\n";
}
$query .= "WHERE ";
@@ -286,7 +283,15 @@ sub report {
foreach my $field (@{$q->{fields}}) {
my $field_sql = "(";
if ($field->{type} == FIELD_TYPE_EXTENSION) {
- $field_sql .= "tf.name = " . $dbh->quote($field->{name}) . " AND COALESCE(tfb.value, '')";
+ $field_sql .= "
+ COALESCE(
+ (SELECT tracking_flags_bugs.value
+ FROM tracking_flags_bugs
+ LEFT JOIN tracking_flags
+ ON tracking_flags.id = tracking_flags_bugs.tracking_flag_id
+ WHERE tracking_flags_bugs.bug_id = b.bug_id
+ AND tracking_flags.name = " . $dbh->quote($field->{name}) . ")
+ , '') ";
}
else {
$field_sql .= "b." . $field->{name};
@@ -325,21 +330,10 @@ sub report {
# set template vars
#
- my $json = JSON->new();
- if (0) {
- # debugging
- $json->shrink(0);
- $json->canonical(1);
- $vars->{flags_json} = $json->pretty->encode(\@flags_json);
- $vars->{products_json} = $json->pretty->encode(\@products_json);
- $vars->{fields_json} = $json->pretty->encode(\@fields_json);
- } else {
- $json->shrink(1);
- $vars->{flags_json} = $json->encode(\@flags_json);
- $vars->{products_json} = $json->encode(\@products_json);
- $vars->{fields_json} = $json->encode(\@fields_json);
- }
-
+ my $json = JSON->new()->shrink(1);
+ $vars->{flags_json} = $json->encode(\@flags_json);
+ $vars->{products_json} = $json->encode(\@products_json);
+ $vars->{fields_json} = $json->encode(\@fields_json);
$vars->{flag_names} = \@flag_names;
$vars->{ranges} = \@ranges;
$vars->{default_query} = $input->{q};