Commit c1e422c6 authored by jocuri%softhome.net's avatar jocuri%softhome.net

Bug 221900: duplicates.cgi query fails if more than one product selected; patch…

Bug 221900: duplicates.cgi query fails if more than one product selected; patch by chaduv <caduvall@glue.umd.edu>; r=gerv; a=justdave.
parent d7f41e15
...@@ -78,16 +78,16 @@ my $changedsince = formvalue("changedsince", 7); ...@@ -78,16 +78,16 @@ my $changedsince = formvalue("changedsince", 7);
my $maxrows = formvalue("maxrows", 100); my $maxrows = formvalue("maxrows", 100);
my $openonly = formvalue("openonly"); my $openonly = formvalue("openonly");
my $reverse = formvalue("reverse") ? 1 : 0; my $reverse = formvalue("reverse") ? 1 : 0;
my $product = formvalue("product"); my @query_products = $cgi->param('product');
my $sortvisible = formvalue("sortvisible"); my $sortvisible = formvalue("sortvisible");
my @buglist = (split(/[:,]/, formvalue("bug_id"))); my @buglist = (split(/[:,]/, formvalue("bug_id")));
my $product_id; my $product_id;
if ($product) { foreach my $p (@query_products) {
$product_id = get_product_id($product); $product_id = get_product_id($p);
if (!$product_id) { if (!$product_id) {
ThrowUserError("invalid_product_name", ThrowUserError("invalid_product_name",
{ product => $product }); { product => $p });
} }
} }
...@@ -209,7 +209,7 @@ if (scalar(%count)) { ...@@ -209,7 +209,7 @@ if (scalar(%count)) {
# Restrict to product if requested # Restrict to product if requested
if ($::FORM{'product'}) { if ($::FORM{'product'}) {
$params->param('product', $::FORM{'product'}); $params->param('product', join(',', @query_products));
} }
my $query = new Bugzilla::Search('fields' => [qw(bugs.bug_id my $query = new Bugzilla::Search('fields' => [qw(bugs.bug_id
...@@ -258,7 +258,7 @@ $vars->{'maxrows'} = $maxrows; ...@@ -258,7 +258,7 @@ $vars->{'maxrows'} = $maxrows;
$vars->{'openonly'} = $openonly; $vars->{'openonly'} = $openonly;
$vars->{'reverse'} = $reverse; $vars->{'reverse'} = $reverse;
$vars->{'format'} = $::FORM{'format'}; $vars->{'format'} = $::FORM{'format'};
$vars->{'product'} = $product; $vars->{'query_products'} = \@query_products;
$vars->{'products'} = \@::legal_product; $vars->{'products'} = \@::legal_product;
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
# maxrows: integer. Max number of rows to display. # maxrows: integer. Max number of rows to display.
# changedsince: integer. The number of days ago for the changedsince column. # changedsince: integer. The number of days ago for the changedsince column.
# openonly: boolean. True if we are only showing open bugs. # openonly: boolean. True if we are only showing open bugs.
# product: string. Restrict to this product only. # query_products: list of strings. Restrict to these products only.
#%] #%]
[% PROCESS global/variables.none.tmpl %] [% PROCESS global/variables.none.tmpl %]
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
[% "&amp;maxrows=$maxrows" IF maxrows %] [% "&amp;maxrows=$maxrows" IF maxrows %]
[% "&amp;changedsince=$changedsince" IF changedsince %] [% "&amp;changedsince=$changedsince" IF changedsince %]
[% "&amp;openonly=1" IF openonly %] [% "&amp;openonly=1" IF openonly %]
[% IF product %]&amp;product=[% product FILTER html %][% END %] [% FOREACH p = query_products %]&amp;product=[% p FILTER html %][% END %]
[% IF format %]&amp;format=[% format FILTER html %][% END %] [% IF format %]&amp;format=[% format FILTER html %][% END %]
[% "&amp;bug_id=$bug_ids_string&amp;sortvisible=1" [% "&amp;bug_id=$bug_ids_string&amp;sortvisible=1"
IF sortvisible %]"> IF sortvisible %]">
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
# maxrows: integer. Max number of rows to display. # maxrows: integer. Max number of rows to display.
# changedsince: integer. The number of days ago for the changedsince column. # changedsince: integer. The number of days ago for the changedsince column.
# openonly: boolean. True if we are only showing open bugs. # openonly: boolean. True if we are only showing open bugs.
# product: string. Restrict to this product only. # query_products: list of strings. The set of products we check for dups.
# #
# Additionally, you need to fulfill the interface to # Additionally, you need to fulfill the interface to
# duplicates-table.html.tmpl. # duplicates-table.html.tmpl.
...@@ -35,8 +35,8 @@ ...@@ -35,8 +35,8 @@
[% PROCESS global/variables.none.tmpl %] [% PROCESS global/variables.none.tmpl %]
[% IF product %] [% IF query_products.size %]
[% title = "Most Frequently Reported $terms.Bugs for $product" %] [% title = "Most Frequently Reported $terms.Bugs for ${query_products.join(', ')}" %]
[% ELSE %] [% ELSE %]
[% title = "Most Frequently Reported $terms.Bugs" %] [% title = "Most Frequently Reported $terms.Bugs" %]
[% END%] [% END%]
...@@ -85,7 +85,8 @@ ...@@ -85,7 +85,8 @@
<select name="product" size="5" multiple="multiple"> <select name="product" size="5" multiple="multiple">
[% FOREACH p = products %] [% FOREACH p = products %]
<option name="[% p FILTER html %]" <option name="[% p FILTER html %]"
[% " selected" IF product == p %]>[% p FILTER html %]</option> [% " selected" IF lsearch(query_products, p) != -1 %]
>[% p FILTER html %]</option>
[% END %] [% END %]
</select> </select>
</td> </td>
......
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