diff options
author | Byron Jones <bjones@mozilla.com> | 2013-02-12 09:45:43 +0100 |
---|---|---|
committer | Byron Jones <bjones@mozilla.com> | 2013-02-12 09:45:43 +0100 |
commit | 37582cecb75ccadc2017a1472da8da62150b4289 (patch) | |
tree | f5a27614056d6c60bcce4e8de769e711409f0a73 /extensions/ProdCompSearch/lib | |
parent | baae38d55a69917ae183acb9811d9e6a3467af3a (diff) | |
download | bugzilla-37582cecb75ccadc2017a1472da8da62150b4289.tar.gz bugzilla-37582cecb75ccadc2017a1472da8da62150b4289.tar.xz |
fix a few minor issues with ProdCompSearch
Diffstat (limited to 'extensions/ProdCompSearch/lib')
-rw-r--r-- | extensions/ProdCompSearch/lib/WebService.pm | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/extensions/ProdCompSearch/lib/WebService.pm b/extensions/ProdCompSearch/lib/WebService.pm index f972b80f7..bbc355e00 100644 --- a/extensions/ProdCompSearch/lib/WebService.pm +++ b/extensions/ProdCompSearch/lib/WebService.pm @@ -1,3 +1,10 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This Source Code Form is "Incompatible With Secondary Licenses", as +# defined by the Mozilla Public License, v. 2.0. + package Bugzilla::Extension::ProdCompSearch::WebService; use strict; @@ -17,13 +24,13 @@ sub prod_comp_search { $search || ThrowCodeError('param_required', { function => 'Bug.prod_comp_search', param => 'search' }); - my $limit = detaint_natural($params->{'limit'}) - ? $dbh->sql_limit($params->{'limit'}) + my $limit = detaint_natural($params->{'limit'}) + ? $dbh->sql_limit($params->{'limit'}) : ''; # We do this in the DB directly as we want it to be fast and # not have the overhead of loading full product objects - + # All products which the user has "Entry" access to. my $enterable_ids = $dbh->selectcol_arrayref( 'SELECT products.id FROM products @@ -55,7 +62,7 @@ sub prod_comp_search { if ($word ne "") { my $sql_word = $dbh->quote($word); trick_taint($sql_word); - # XXX CONCAT_WS is MySQL specific + # note: CONCAT_WS is MySQL specific my $field = "CONCAT_WS(' ', products.name, components.name, components.description)"; push(@list, $dbh->sql_iposition($sql_word, $field) . " > 0"); } @@ -64,11 +71,11 @@ sub prod_comp_search { my $products = $dbh->selectall_arrayref(" SELECT products.name AS product, components.name AS component - FROM products + FROM products INNER JOIN components ON products.id = components.product_id WHERE (" . join(" AND ", @list) . ") AND products.id IN (" . join(",", @$enterable_ids) . ") - ORDER BY products.name $limit", + ORDER BY products.name $limit", { Slice => {} }); # To help mozilla staff file bmo administration bugs into the right @@ -90,5 +97,3 @@ sub prod_comp_search { } 1; - - |