From 6b44875b901ac8d1d7383fed017c973a9f954051 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Sat, 3 Sep 2005 04:12:07 +0000 Subject: Bug 286158: Remove GetSelectableProducts() from globals.pl and use Bugzilla::User::get_selectable_products() instead - Patch by Frédéric Buclin r=joel,kiko a=justdave MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- request.cgi | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) (limited to 'request.cgi') diff --git a/request.cgi b/request.cgi index b0f45b1cc..c7705f38d 100755 --- a/request.cgi +++ b/request.cgi @@ -27,28 +27,26 @@ # Make it harder for us to do dangerous things in Perl. use strict; -# Include the Bugzilla CGI and general utility library. use lib qw(.); require "globals.pl"; use Bugzilla; -# Use Bugzilla's Request module which contains utilities for handling requests. use Bugzilla::Flag; use Bugzilla::FlagType; - -# use Bugzilla's User module which contains utilities for handling users. use Bugzilla::User; -use vars qw($template $vars @legal_product @legal_components %components); +use vars qw($template $vars); # Make sure the user is logged in. -Bugzilla->login(); +my $user = Bugzilla->login(); +my $userid = $user->id; + +my $cgi = Bugzilla->cgi; + ################################################################################ # Main Body Execution ################################################################################ -my $cgi = Bugzilla->cgi; - my $fields; $fields->{'requester'}->{'type'} = 'single'; # If the user doesn't restrict his search to requests from the wind @@ -116,17 +114,17 @@ sub queue { LEFT JOIN bug_group_map AS bgmap ON bgmap.bug_id = bugs.bug_id AND bgmap.group_id NOT IN (" . - join(', ', (-1, values(%{Bugzilla->user->groups}))) . ") + join(', ', (-1, values(%{$user->groups}))) . ") LEFT JOIN cc AS ccmap - ON ccmap.who = $::userid - AND ccmap.bug_id = bugs.bug_id + ON ccmap.who = $userid + AND ccmap.bug_id = bugs.bug_id " . # Weed out bug the user does not have access to " WHERE ((bgmap.group_id IS NULL) OR (ccmap.who IS NOT NULL AND cclist_accessible = 1) OR - (bugs.reporter = $::userid AND bugs.reporter_accessible = 1) OR - (bugs.assigned_to = $::userid))"; + (bugs.reporter = $userid AND bugs.reporter_accessible = 1) OR + (bugs.assigned_to = $userid))"; # Non-deleted flags only $query .= " AND flags.is_active = 1 "; @@ -279,15 +277,7 @@ sub queue { SendSQL("SELECT DISTINCT(name) FROM flagtypes ORDER BY name"); push(@types, FetchOneColumn()) while MoreSQLData(); - # products and components and the function used to modify the components - # menu when the products menu changes; used by the template to populate - # the menus and keep the components menu consistent with the products menu - GetVersionTable(); - my $selectable = GetSelectableProductHash(); - $vars->{'products'} = $selectable->{legal_products}; - $vars->{'components'} = $selectable->{legal_components}; - $vars->{'components_by_product'} = $selectable->{components_by_product}; - + $vars->{'products'} = $user->get_selectable_products; $vars->{'excluded_columns'} = \@excluded_columns; $vars->{'group_field'} = $form_group; $vars->{'requests'} = \@requests; -- cgit v1.2.3-24-g4f1b