Commit a52f0b41 authored by gerv%gerv.net's avatar gerv%gerv.net

Bug 155584 - Opening duplicates.cgi with no frequent bugs causes SQL syntax…

Bug 155584 - Opening duplicates.cgi with no frequent bugs causes SQL syntax error. Patch by gerv; r=bbaetz.
parent df194854
......@@ -135,10 +135,14 @@ if (!tie(%before, 'AnyDBM_File', "data/duplicates/dupes$whenever",
$dobefore = 1;
}
# Don't add CLOSED, and don't add VERIFIED unless they are INVALID or
# WONTFIX. We want to see VERIFIED INVALID and WONTFIX because common
# "bugs" which aren't bugs end up in this state.
my $query = "
my @bugs;
my @bug_ids;
if (scalar(%count)) {
# Don't add CLOSED, and don't add VERIFIED unless they are INVALID or
# WONTFIX. We want to see VERIFIED INVALID and WONTFIX because common
# "bugs" which aren't bugs end up in this state.
my $query = "
SELECT bugs.bug_id, component, bug_severity, op_sys, target_milestone,
short_desc, bug_status, resolution
FROM bugs
......@@ -147,17 +151,14 @@ my $query = "
OR (bug_status != 'VERIFIED'))
AND bugs.bug_id IN (" . join(", ", keys %count) . ")";
# Limit to a single product if requested
$query .= (" AND product = " . SqlQuote($product)) if $product;
# Limit to a single product if requested
$query .= (" AND product = " . SqlQuote($product)) if $product;
SendSQL(SelectVisible($query,
SendSQL(SelectVisible($query,
$userid,
$usergroupset));
my @bugs;
my @bug_ids;
while (MoreSQLData()) {
while (MoreSQLData()) {
# Note: maximum row count is dealt with in the template.
my ($id, $component, $bug_severity, $op_sys, $target_milestone,
......@@ -177,6 +178,7 @@ while (MoreSQLData()) {
bug_status => $bug_status,
resolution => $resolution });
push (@bug_ids, $id);
}
}
$vars->{'bugs'} = \@bugs;
......
......@@ -44,7 +44,8 @@
[%# *** Column Headers *** %]
<table border>
[% IF bug_ids.size > 0 %]
<table border>
<tr bgcolor="#CCCCCC">
[% FOREACH column = [ { name => "id", description => "Bug #" },
{ name => "count", description => "Dupe<br>Count" },
......@@ -85,31 +86,31 @@
[% END %]
</tr>
[% IF NOT sortby %]
[% IF NOT sortby %]
[% sortby = "count"; reverse = "1" %]
[% END %]
[% END %]
[% IF sortby == "id" OR sortby == "count" OR sortby == "delta" %]
[% IF sortby == "id" OR sortby == "count" OR sortby == "delta" %]
[%# Numeric sort %]
[% sortedbugs = bugs.nsort(sortby) %]
[% ELSE %]
[% ELSE %]
[% sortedbugs = bugs.sort(sortby) %]
[% END %]
[% END %]
[% IF reverse %]
[% IF reverse %]
[% bugs = sortedbugs.reverse %]
[% ELSE %]
[% ELSE %]
[% bugs = sortedbugs %]
[% END %]
[% END %]
[%# *** Buglist *** %]
[%# *** Buglist *** %]
[%# We need to keep track of the bug IDs we are actually displaying, because
[%# We need to keep track of the bug IDs we are actually displaying, because
# if the user decides to sort the visible list, we need to know what that
# list actually is. %]
[% vis_bug_ids = [] %]
[% vis_bug_ids = [] %]
[% FOREACH bug = bugs %]
[% FOREACH bug = bugs %]
[% LAST IF loop.index() >= maxrows %]
[% vis_bug_ids.push(bug.id) %]
......@@ -138,6 +139,9 @@
<td><center>[% bug.target_milestone %]</center></td>
<td>[% bug.short_desc FILTER html %]</td>
</tr>
[% END %]
[% END %]
</table>
</table>
[% ELSE %]
<h3>No duplicate bugs found.</h3>
[% END %]
......@@ -49,9 +49,6 @@
[% PROCESS "reports/duplicates-table.html.tmpl" %]
<br>
<br>
[%# *** Parameters *** %]
[% bug_ids_string = vis_bug_ids.join(',') %]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment