summaryrefslogtreecommitdiffstats
path: root/extensions
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
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')
-rw-r--r--extensions/BMO/lib/Reports/ReleaseTracking.pm40
-rw-r--r--extensions/BMO/web/js/release_tracking_report.js54
2 files changed, 45 insertions, 49 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};
diff --git a/extensions/BMO/web/js/release_tracking_report.js b/extensions/BMO/web/js/release_tracking_report.js
index 840b57df1..adad6feb5 100644
--- a/extensions/BMO/web/js/release_tracking_report.js
+++ b/extensions/BMO/web/js/release_tracking_report.js
@@ -5,7 +5,6 @@
* This Source Code Form is "Incompatible With Secondary Licenses", as
* defined by the Mozilla Public License, v. 2.0. */
-var Dom = YAHOO.util.Dom;
var flagEl;
var productEl;
var trackingEl;
@@ -15,13 +14,13 @@ var selectedFields;
function onFieldToggle(cbEl, id) {
if (cbEl.checked) {
- Dom.removeClass('field_' + id + '_td', 'disabled');
+ $('#field_' + id + '_td').removeClass('disabled');
selectedFields['field_' + id] = id;
} else {
- Dom.addClass('field_' + id + '_td', 'disabled');
+ $('#field_' + id + '_td').addClass('disabled');
selectedFields['field_' + id] = false;
}
- Dom.get('field_' + id + '_select').disabled = !cbEl.checked;
+ $('#field_' + id + '_select').attr('disabled', !cbEl.checked);
serialiseForm();
}
@@ -29,7 +28,7 @@ function onProductChange() {
var product = productEl.value;
var productData = product == '0' ? getFlagByName(flagEl.value) : getProductById(product);
var html = '';
- selectedFields = new Array();
+ selectedFields = [];
if (productData) {
// update status fields
@@ -44,10 +43,11 @@ function onProductChange() {
'</td>' +
'<td class="disabled" id="field_' + field.id + '_td">' +
'<label for="field_' + field.id + '_cb">' +
- YAHOO.lang.escapeHTML(field.name) + ':</label>' +
+ field.desc.htmlEncode() + ':</label>' +
'</td>' +
'<td>' +
- '<select disabled id="field_' + field.id + '_select">' +
+ '<select disabled id="field_' + field.id + '_select" ' +
+ 'onChange="onFieldToggle($(\'#field_' + field.id + '_cb\')[0],' + field.id + ')">' +
'<option value="+">fixed</option>' +
'<option value="-">not fixed</option>' +
'</select>' +
@@ -83,7 +83,8 @@ function onFlagChange() {
function selectAllFields() {
for(var i = 0, l = fields_data.length; i < l; i++) {
- var cb = Dom.get('field_' + fields_data[i].id + '_cb');
+ var cb = $('#field_' + fields_data[i].id + '_cb')[0];
+ if (!cb) continue;
cb.checked = true;
onFieldToggle(cb, fields_data[i].id);
}
@@ -92,7 +93,8 @@ function selectAllFields() {
function selectNoFields() {
for(var i = 0, l = fields_data.length; i < l; i++) {
- var cb = Dom.get('field_' + fields_data[i].id + '_cb');
+ var cb = $('#field_' + fields_data[i].id + '_cb')[0];
+ if (!cb) continue;
cb.checked = false;
onFieldToggle(cb, fields_data[i].id);
}
@@ -101,7 +103,8 @@ function selectNoFields() {
function invertFields() {
for(var i = 0, l = fields_data.length; i < l; i++) {
- var el = Dom.get('field_' + fields_data[i].id + '_select');
+ var el = $('#field_' + fields_data[i].id + '_select')[0];
+ if (!el) continue;
if (el.value == '+') {
el.options[1].selected = true;
} else {
@@ -122,40 +125,39 @@ function onFormReset() {
function serialiseForm() {
var q = flagEl.value + ':' +
- Dom.get('flag_value').value + ':' +
- Dom.get('range').value + ':' +
+ $('#flag_value').val() + ':' +
+ $('#range').val() + ':' +
productEl.value + ':' +
- Dom.get('op').value + ':';
+ $('#op').val() + ':';
for(var id in selectedFields) {
if (selectedFields[id]) {
- q += selectedFields[id] + Dom.get(id + '_select').value + ':';
+ q += selectedFields[id] + $('#' + id + '_select').val() + ':';
}
}
- Dom.get('q').value = q;
- Dom.get('bookmark').href = 'page.cgi?id=release_tracking_report.html&q=' +
- encodeURIComponent(q);
+ $('#q').val(q);
+ $('#bookmark').attr('href', 'page.cgi?id=release_tracking_report.html&q=' + encodeURIComponent(q));
}
function deserialiseForm(q) {
var parts = q.split(/:/);
selectValue(flagEl, parts[0]);
onFlagChange();
- selectValue(Dom.get('flag_value'), parts[1]);
- selectValue(Dom.get('range'), parts[2]);
+ selectValue($('#flag_value')[0], parts[1]);
+ selectValue($('#range')[0], parts[2]);
selectValue(productEl, parts[3]);
onProductChange();
- selectValue(Dom.get('op'), parts[4]);
+ selectValue($('#op')[0], parts[4]);
for(var i = 5, l = parts.length; i < l; i++) {
var part = parts[i];
if (part.length) {
var value = part.substr(part.length - 1, 1);
var id = part.substr(0, part.length - 1);
- var cb = Dom.get('field_' + id + '_cb');
+ var cb = $('#field_' + id + '_cb')[0];
cb.checked = true;
onFieldToggle(cb, id);
- selectValue(Dom.get('field_' + id + '_select'), value);
+ selectValue($('#field_' + id + '_select')[0], value);
}
}
serialiseForm();
@@ -163,10 +165,10 @@ function deserialiseForm(q) {
// utils
-YAHOO.util.Event.onDOMReady(function() {
- flagEl = Dom.get('flag');
- productEl = Dom.get('product');
- trackingEl = Dom.get('tracking_span');
+$().ready(function() {
+ flagEl = $('#flag')[0];
+ productEl = $('#product')[0];
+ trackingEl = $('#tracking_span')[0];
onFlagChange();
deserialiseForm(default_query);
});