diff options
author | Byron Jones <glob@mozilla.com> | 2015-05-26 17:59:57 +0200 |
---|---|---|
committer | Byron Jones <glob@mozilla.com> | 2015-05-26 17:59:57 +0200 |
commit | f8b984852ae27f14a5f44e651193f00977737ab1 (patch) | |
tree | 7b7d631f17fa9b82844f0db79b605f157fa48e2c /extensions/ProdCompSearch/lib/WebService.pm | |
parent | 95e71eea95c977eb7512156be813ede7eb161600 (diff) | |
download | bugzilla-f8b984852ae27f14a5f44e651193f00977737ab1.tar.gz bugzilla-f8b984852ae27f14a5f44e651193f00977737ab1.tar.xz |
Bug 1146782: backport bug 1159589 to bmo (migrate autocomplete from yui to jquery)
Diffstat (limited to 'extensions/ProdCompSearch/lib/WebService.pm')
-rw-r--r-- | extensions/ProdCompSearch/lib/WebService.pm | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/extensions/ProdCompSearch/lib/WebService.pm b/extensions/ProdCompSearch/lib/WebService.pm index a28b5d059..521d1588f 100644 --- a/extensions/ProdCompSearch/lib/WebService.pm +++ b/extensions/ProdCompSearch/lib/WebService.pm @@ -113,7 +113,7 @@ sub prod_comp_search { unshift @order, "products.name != 'bugzilla.mozilla.org'"; } - my $products = $dbh->selectall_arrayref(" + my $components = $dbh->selectall_arrayref(" SELECT products.name AS product, components.name AS component FROM products @@ -124,6 +124,15 @@ sub prod_comp_search { ORDER BY " . join(", ", @order) . " $limit", { Slice => {} }); + my $products = []; + my $current_product; + foreach my $component (@$components) { + if (!$current_product || $component->{product} ne $current_product) { + $current_product = $component->{product}; + push @$products, { product => $current_product }; + } + push @$products, $component; + } return { products => $products }; } |