2000-06-09 00:30:10 +04:00
|
|
|
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
|
|
|
#
|
|
|
|
# The contents of this file are subject to the Mozilla Public
|
|
|
|
# License Version 1.1 (the "License"); you may not use this file
|
|
|
|
# except in compliance with the License. You may obtain a copy of
|
|
|
|
# the License at http://www.mozilla.org/MPL/
|
|
|
|
#
|
|
|
|
# Software distributed under the License is distributed on an "AS
|
|
|
|
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
# implied. See the License for the specific language governing
|
|
|
|
# rights and limitations under the License.
|
|
|
|
#
|
|
|
|
# The Original Code is the Bugzilla Bug Tracking System.
|
|
|
|
#
|
|
|
|
# The Initial Developer of the Original Code is Netscape Communications
|
|
|
|
# Corporation. Portions created by Netscape are
|
|
|
|
# Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
# Rights Reserved.
|
|
|
|
#
|
|
|
|
# Contributor(s): Dawn Endico <endico@mozilla.org>
|
|
|
|
# Terry Weissman <terry@mozilla.org>
|
2000-06-28 03:16:08 +04:00
|
|
|
# Chris Yeh <cyeh@bluemartini.com>
|
2000-06-09 00:30:10 +04:00
|
|
|
|
2002-11-28 13:49:58 +03:00
|
|
|
package Bug;
|
|
|
|
|
2000-06-09 00:30:10 +04:00
|
|
|
use strict;
|
|
|
|
|
|
|
|
use RelationSet;
|
2002-11-28 13:49:58 +03:00
|
|
|
use vars qw($unconfirmedstate $legal_keywords @legal_platform
|
|
|
|
@legal_priority @legal_severity @legal_opsys @legal_bugs_status
|
|
|
|
@settable_resolution %components %versions %target_milestone
|
|
|
|
@enterable_products %milestoneurl %prodmaxvotes);
|
2002-09-05 02:43:38 +04:00
|
|
|
|
2000-06-09 00:30:10 +04:00
|
|
|
use CGI::Carp qw(fatalsToBrowser);
|
|
|
|
|
2002-11-28 13:49:58 +03:00
|
|
|
use Attachment;
|
2002-08-29 13:25:54 +04:00
|
|
|
use Bugzilla::Config;
|
2002-11-28 13:49:58 +03:00
|
|
|
use Bugzilla::Constants;
|
|
|
|
use Bugzilla::Flag;
|
|
|
|
use Bugzilla::FlagType;
|
|
|
|
use Bugzilla::User;
|
2002-08-19 17:59:45 +04:00
|
|
|
use Bugzilla::Util;
|
|
|
|
|
2002-12-15 12:24:08 +03:00
|
|
|
sub fields {
|
|
|
|
# Keep this ordering in sync with bugzilla.dtd
|
|
|
|
my @fields = qw(bug_id alias creation_ts short_desc delta_ts
|
|
|
|
reporter_accessible cclist_accessible
|
|
|
|
product component version rep_platform op_sys
|
|
|
|
bug_status resolution
|
|
|
|
bug_file_loc status_whiteboard keywords
|
|
|
|
priority bug_severity target_milestone
|
|
|
|
dependson blocked votes
|
2003-02-23 10:31:09 +03:00
|
|
|
reporter assigned_to cc
|
2002-12-15 12:24:08 +03:00
|
|
|
);
|
|
|
|
|
2003-02-23 10:31:09 +03:00
|
|
|
if (Param('useqacontact')) {
|
|
|
|
push @fields, "qa_contact";
|
|
|
|
}
|
|
|
|
|
2002-12-15 12:24:08 +03:00
|
|
|
if (Param('timetrackinggroup')) {
|
|
|
|
push @fields, qw(estimated_time remaining_time actual_time);
|
|
|
|
}
|
|
|
|
|
|
|
|
return @fields;
|
|
|
|
}
|
|
|
|
|
|
|
|
my %ok_field;
|
|
|
|
foreach my $key (qw(error groups
|
|
|
|
longdescs milestoneurl attachments
|
|
|
|
isopened isunconfirmed
|
|
|
|
flag_types num_attachment_flag_types
|
|
|
|
show_attachment_flags use_keywords any_flags_requesteeble
|
|
|
|
),
|
|
|
|
fields()) {
|
2000-06-09 00:30:10 +04:00
|
|
|
$ok_field{$key}++;
|
2002-11-28 13:49:58 +03:00
|
|
|
}
|
2000-06-09 00:30:10 +04:00
|
|
|
|
|
|
|
# create a new empty bug
|
|
|
|
#
|
|
|
|
sub new {
|
|
|
|
my $type = shift();
|
2000-06-12 10:52:41 +04:00
|
|
|
my %bug;
|
2000-06-09 00:30:10 +04:00
|
|
|
|
|
|
|
# create a ref to an empty hash and bless it
|
|
|
|
#
|
|
|
|
my $self = {%bug};
|
|
|
|
bless $self, $type;
|
|
|
|
|
|
|
|
# construct from a hash containing a bug's info
|
|
|
|
#
|
|
|
|
if ($#_ == 1) {
|
|
|
|
$self->initBug(@_);
|
|
|
|
} else {
|
|
|
|
confess("invalid number of arguments \($#_\)($_)");
|
|
|
|
}
|
|
|
|
|
|
|
|
# bless as a Bug
|
|
|
|
#
|
|
|
|
return $self;
|
|
|
|
}
|
|
|
|
|
|
|
|
# dump info about bug into hash unless user doesn't have permission
|
|
|
|
# user_id 0 is used when person is not logged in.
|
|
|
|
#
|
|
|
|
sub initBug {
|
|
|
|
my $self = shift();
|
|
|
|
my ($bug_id, $user_id) = (@_);
|
|
|
|
|
2002-12-15 12:24:08 +03:00
|
|
|
$bug_id = trim($bug_id);
|
|
|
|
|
|
|
|
my $old_bug_id = $bug_id;
|
|
|
|
|
2002-07-04 03:07:14 +04:00
|
|
|
# If the bug ID isn't numeric, it might be an alias, so try to convert it.
|
|
|
|
$bug_id = &::BugAliasToID($bug_id) if $bug_id !~ /^[1-9][0-9]*$/;
|
2002-12-15 12:24:08 +03:00
|
|
|
|
2002-08-19 17:59:45 +04:00
|
|
|
if ((! defined $bug_id) || (!$bug_id) || (!detaint_natural($bug_id))) {
|
2002-07-04 03:07:14 +04:00
|
|
|
# no bug number given or the alias didn't match a bug
|
2002-01-20 04:44:52 +03:00
|
|
|
$self->{'bug_id'} = $old_bug_id;
|
|
|
|
$self->{'error'} = "InvalidBugId";
|
|
|
|
return $self;
|
2000-06-09 00:30:10 +04:00
|
|
|
}
|
|
|
|
|
2000-06-28 03:16:08 +04:00
|
|
|
# default userid 0, or get DBID if you used an email address
|
|
|
|
unless (defined $user_id) {
|
2000-06-09 00:30:10 +04:00
|
|
|
$user_id = 0;
|
|
|
|
}
|
2000-06-28 03:16:08 +04:00
|
|
|
else {
|
|
|
|
if ($user_id =~ /^\@/) {
|
2001-10-31 06:31:00 +03:00
|
|
|
$user_id = &::DBname_to_id($user_id);
|
2000-06-28 03:16:08 +04:00
|
|
|
}
|
|
|
|
}
|
2002-11-28 13:49:58 +03:00
|
|
|
|
2000-06-28 03:16:08 +04:00
|
|
|
$self->{'whoid'} = $user_id;
|
2000-06-09 00:30:10 +04:00
|
|
|
|
|
|
|
my $query = "
|
2002-11-28 13:49:58 +03:00
|
|
|
SELECT
|
|
|
|
bugs.bug_id, alias, bugs.product_id, products.name, version,
|
|
|
|
rep_platform, op_sys, bug_status, resolution, priority,
|
|
|
|
bug_severity, bugs.component_id, components.name, assigned_to,
|
|
|
|
reporter, bug_file_loc, short_desc, target_milestone,
|
|
|
|
qa_contact, status_whiteboard,
|
|
|
|
DATE_FORMAT(creation_ts,'%Y.%m.%d %H:%i'),
|
2003-09-02 10:54:58 +04:00
|
|
|
delta_ts, ifnull(sum(votes.vote_count),0),
|
2002-11-28 13:49:58 +03:00
|
|
|
reporter_accessible, cclist_accessible,
|
|
|
|
estimated_time, remaining_time
|
2002-08-12 09:43:05 +04:00
|
|
|
from bugs left join votes using(bug_id),
|
|
|
|
products, components
|
2000-06-09 00:30:10 +04:00
|
|
|
where bugs.bug_id = $bug_id
|
2002-08-12 09:43:05 +04:00
|
|
|
AND products.id = bugs.product_id
|
|
|
|
AND components.id = bugs.component_id
|
2000-06-09 00:30:10 +04:00
|
|
|
group by bugs.bug_id";
|
|
|
|
|
2002-09-22 21:15:13 +04:00
|
|
|
&::SendSQL($query);
|
|
|
|
my @row = ();
|
2000-06-09 00:30:10 +04:00
|
|
|
|
2002-09-22 21:15:13 +04:00
|
|
|
if ((@row = &::FetchSQLData()) && &::CanSeeBug($bug_id, $self->{'whoid'})) {
|
2000-06-09 00:30:10 +04:00
|
|
|
my $count = 0;
|
|
|
|
my %fields;
|
2002-11-28 13:49:58 +03:00
|
|
|
foreach my $field ("bug_id", "alias", "product_id", "product", "version",
|
|
|
|
"rep_platform", "op_sys", "bug_status", "resolution",
|
|
|
|
"priority", "bug_severity", "component_id", "component",
|
|
|
|
"assigned_to", "reporter", "bug_file_loc", "short_desc",
|
|
|
|
"target_milestone", "qa_contact", "status_whiteboard",
|
|
|
|
"creation_ts", "delta_ts", "votes",
|
2002-12-03 12:44:42 +03:00
|
|
|
"reporter_accessible", "cclist_accessible",
|
2002-11-28 13:49:58 +03:00
|
|
|
"estimated_time", "remaining_time")
|
|
|
|
{
|
2001-10-31 06:31:00 +03:00
|
|
|
$fields{$field} = shift @row;
|
2002-11-28 13:49:58 +03:00
|
|
|
if (defined $fields{$field}) {
|
2001-10-31 06:31:00 +03:00
|
|
|
$self->{$field} = $fields{$field};
|
|
|
|
}
|
|
|
|
$count++;
|
2000-06-09 00:30:10 +04:00
|
|
|
}
|
2002-09-22 21:15:13 +04:00
|
|
|
} elsif (@row) {
|
2000-06-12 10:52:41 +04:00
|
|
|
$self->{'bug_id'} = $bug_id;
|
|
|
|
$self->{'error'} = "NotPermitted";
|
2000-06-09 00:30:10 +04:00
|
|
|
return $self;
|
2002-09-22 21:15:13 +04:00
|
|
|
} else {
|
2000-06-12 10:52:41 +04:00
|
|
|
$self->{'bug_id'} = $bug_id;
|
|
|
|
$self->{'error'} = "NotFound";
|
2000-06-09 00:30:10 +04:00
|
|
|
return $self;
|
|
|
|
}
|
|
|
|
|
2002-11-28 13:49:58 +03:00
|
|
|
$self->{'assigned_to'} = new Bugzilla::User($self->{'assigned_to'});
|
|
|
|
$self->{'reporter'} = new Bugzilla::User($self->{'reporter'});
|
|
|
|
|
|
|
|
if (Param('useqacontact') && $self->{'qa_contact'} > 0) {
|
|
|
|
$self->{'qa_contact'} = new Bugzilla::User($self->{'qa_contact'});
|
2003-02-23 10:31:09 +03:00
|
|
|
} else {
|
|
|
|
$self->{'qa_contact'} = undef;
|
2002-11-28 13:49:58 +03:00
|
|
|
}
|
2000-06-09 00:30:10 +04:00
|
|
|
|
|
|
|
my $ccSet = new RelationSet;
|
|
|
|
$ccSet->mergeFromDB("select who from cc where bug_id=$bug_id");
|
|
|
|
my @cc = $ccSet->toArrayOfStrings();
|
|
|
|
if (@cc) {
|
2000-06-12 10:52:41 +04:00
|
|
|
$self->{'cc'} = \@cc;
|
2000-06-09 00:30:10 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (@::legal_keywords) {
|
|
|
|
&::SendSQL("SELECT keyworddefs.name
|
|
|
|
FROM keyworddefs, keywords
|
|
|
|
WHERE keywords.bug_id = $bug_id
|
|
|
|
AND keyworddefs.id = keywords.keywordid
|
|
|
|
ORDER BY keyworddefs.name");
|
|
|
|
my @list;
|
|
|
|
while (&::MoreSQLData()) {
|
|
|
|
push(@list, &::FetchOneColumn());
|
|
|
|
}
|
|
|
|
if (@list) {
|
2001-11-26 17:16:10 +03:00
|
|
|
$self->{'keywords'} = join(', ', @list);
|
2000-06-09 00:30:10 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-11-28 13:49:58 +03:00
|
|
|
$self->{'attachments'} = Attachment::query($self->{bug_id});
|
|
|
|
|
|
|
|
# The types of flags that can be set on this bug.
|
|
|
|
# If none, no UI for setting flags will be displayed.
|
|
|
|
my $flag_types =
|
|
|
|
Bugzilla::FlagType::match({ 'target_type' => 'bug',
|
|
|
|
'product_id' => $self->{'product_id'},
|
|
|
|
'component_id' => $self->{'component_id'} });
|
|
|
|
foreach my $flag_type (@$flag_types) {
|
|
|
|
$flag_type->{'flags'} =
|
|
|
|
Bugzilla::Flag::match({ 'bug_id' => $self->{bug_id},
|
|
|
|
'type_id' => $flag_type->{'id'},
|
|
|
|
'target_type' => 'bug' });
|
|
|
|
}
|
|
|
|
$self->{'flag_types'} = $flag_types;
|
2002-12-03 15:35:44 +03:00
|
|
|
$self->{'any_flags_requesteeble'} = grep($_->{'is_requesteeble'}, @$flag_types);
|
2002-11-28 13:49:58 +03:00
|
|
|
|
|
|
|
# The number of types of flags that can be set on attachments to this bug
|
|
|
|
# and the number of flags on those attachments. One of these counts must be
|
|
|
|
# greater than zero in order for the "flags" column to appear in the table
|
|
|
|
# of attachments.
|
|
|
|
my $num_attachment_flag_types =
|
|
|
|
Bugzilla::FlagType::count({ 'target_type' => 'attachment',
|
|
|
|
'product_id' => $self->{'product_id'},
|
|
|
|
'component_id' => $self->{'component_id'},
|
|
|
|
'is_active' => 1 });
|
|
|
|
my $num_attachment_flags =
|
|
|
|
Bugzilla::Flag::count({ 'target_type' => 'attachment',
|
|
|
|
'bug_id' => $self->{bug_id} });
|
|
|
|
|
|
|
|
$self->{'show_attachment_flags'}
|
|
|
|
= $num_attachment_flag_types || $num_attachment_flags;
|
|
|
|
|
|
|
|
$self->{'milestoneurl'} = $::milestoneurl{$self->{product}};
|
|
|
|
|
|
|
|
$self->{'isunconfirmed'} = ($self->{bug_status} eq $::unconfirmedstate);
|
|
|
|
$self->{'isopened'} = &::IsOpenedState($self->{bug_status});
|
2002-07-29 03:15:53 +04:00
|
|
|
|
|
|
|
my @depends = EmitDependList("blocked", "dependson", $bug_id);
|
|
|
|
if (@depends) {
|
2000-06-12 10:52:41 +04:00
|
|
|
$self->{'dependson'} = \@depends;
|
2002-12-15 12:24:08 +03:00
|
|
|
}
|
2002-12-03 12:44:42 +03:00
|
|
|
my @blocked = EmitDependList("dependson", "blocked", $bug_id);
|
|
|
|
if (@blocked) {
|
|
|
|
$self->{'blocked'} = \@blocked;
|
2000-06-09 00:30:10 +04:00
|
|
|
}
|
2000-06-28 03:16:08 +04:00
|
|
|
|
2000-06-09 00:30:10 +04:00
|
|
|
return $self;
|
|
|
|
}
|
|
|
|
|
2003-04-09 13:29:19 +04:00
|
|
|
sub dup_id {
|
|
|
|
my ($self) = @_;
|
|
|
|
|
|
|
|
return $self->{'dup_id'} if exists $self->{'dup_id'};
|
|
|
|
|
|
|
|
$self->{'dup_id'} = undef;
|
|
|
|
if ($self->{'resolution'} eq 'DUPLICATE') {
|
|
|
|
my $dbh = Bugzilla->dbh;
|
|
|
|
$self->{'dup_id'} =
|
|
|
|
$dbh->selectrow_array(q{SELECT dupe_of
|
|
|
|
FROM duplicates
|
|
|
|
WHERE dupe = ?},
|
|
|
|
undef,
|
|
|
|
$self->{'bug_id'});
|
|
|
|
}
|
|
|
|
return $self->{'dup_id'};
|
|
|
|
}
|
|
|
|
|
2002-11-28 13:49:58 +03:00
|
|
|
sub actual_time {
|
|
|
|
my ($self) = @_;
|
|
|
|
|
|
|
|
return $self->{'actual_time'} if exists $self->{'actual_time'};
|
|
|
|
|
|
|
|
if (&::UserInGroup(Param("timetrackinggroup"))) {
|
|
|
|
&::SendSQL("SELECT SUM(work_time)
|
|
|
|
FROM longdescs WHERE longdescs.bug_id=$self->{bug_id}");
|
|
|
|
$self->{'actual_time'} = &::FetchSQLData();
|
|
|
|
}
|
|
|
|
|
|
|
|
return $self->{'actual_time'};
|
|
|
|
}
|
|
|
|
|
|
|
|
sub longdescs {
|
|
|
|
my ($self) = @_;
|
|
|
|
|
|
|
|
return $self->{'longdescs'} if exists $self->{'longdescs'};
|
|
|
|
|
|
|
|
$self->{'longdescs'} = &::GetComments($self->{bug_id});
|
|
|
|
|
|
|
|
return $self->{'longdescs'};
|
|
|
|
}
|
|
|
|
|
|
|
|
sub use_keywords {
|
|
|
|
return @::legal_keywords;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub use_votes {
|
|
|
|
my ($self) = @_;
|
|
|
|
|
|
|
|
return Param('usevotes')
|
|
|
|
&& $::prodmaxvotes{$self->{product}} > 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub groups {
|
|
|
|
my $self = shift;
|
|
|
|
|
|
|
|
return $self->{'groups'} if exists $self->{'groups'};
|
|
|
|
|
|
|
|
my @groups;
|
|
|
|
|
|
|
|
# Some of this stuff needs to go into Bugzilla::User
|
|
|
|
|
|
|
|
# For every group, we need to know if there is ANY bug_group_map
|
|
|
|
# record putting the current bug in that group and if there is ANY
|
|
|
|
# user_group_map record putting the user in that group.
|
|
|
|
# The LEFT JOINs are checking for record existence.
|
|
|
|
#
|
|
|
|
&::SendSQL("SELECT DISTINCT groups.id, name, description," .
|
|
|
|
" bug_group_map.group_id IS NOT NULL," .
|
|
|
|
" user_group_map.group_id IS NOT NULL," .
|
|
|
|
" isactive, membercontrol, othercontrol" .
|
|
|
|
" FROM groups" .
|
|
|
|
" LEFT JOIN bug_group_map" .
|
|
|
|
" ON bug_group_map.group_id = groups.id" .
|
|
|
|
" AND bug_id = $self->{'bug_id'}" .
|
|
|
|
" LEFT JOIN user_group_map" .
|
|
|
|
" ON user_group_map.group_id = groups.id" .
|
|
|
|
" AND user_id = $::userid" .
|
|
|
|
" AND NOT isbless" .
|
|
|
|
" LEFT JOIN group_control_map" .
|
|
|
|
" ON group_control_map.group_id = groups.id" .
|
|
|
|
" AND group_control_map.product_id = " . $self->{'product_id'} .
|
|
|
|
" WHERE isbuggroup");
|
|
|
|
|
|
|
|
while (&::MoreSQLData()) {
|
|
|
|
my ($groupid, $name, $description, $ison, $ingroup, $isactive,
|
|
|
|
$membercontrol, $othercontrol) = &::FetchSQLData();
|
|
|
|
|
|
|
|
$membercontrol ||= 0;
|
|
|
|
|
|
|
|
# For product groups, we only want to use the group if either
|
|
|
|
# (1) The bit is set and not required, or
|
|
|
|
# (2) The group is Shown or Default for members and
|
|
|
|
# the user is a member of the group.
|
|
|
|
if ($ison ||
|
|
|
|
($isactive && $ingroup
|
|
|
|
&& (($membercontrol == CONTROLMAPDEFAULT)
|
|
|
|
|| ($membercontrol == CONTROLMAPSHOWN))
|
|
|
|
))
|
|
|
|
{
|
|
|
|
my $ismandatory = $isactive
|
|
|
|
&& ($membercontrol == CONTROLMAPMANDATORY);
|
|
|
|
|
|
|
|
push (@groups, { "bit" => $groupid,
|
2002-12-15 12:24:08 +03:00
|
|
|
"name" => $name,
|
2002-11-28 13:49:58 +03:00
|
|
|
"ison" => $ison,
|
|
|
|
"ingroup" => $ingroup,
|
|
|
|
"mandatory" => $ismandatory,
|
|
|
|
"description" => $description });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$self->{'groups'} = \@groups;
|
|
|
|
|
|
|
|
return $self->{'groups'};
|
|
|
|
}
|
|
|
|
|
|
|
|
sub user {
|
|
|
|
my $self = shift;
|
|
|
|
return $self->{'user'} if exists $self->{'user'};
|
|
|
|
|
|
|
|
$self->{'user'} = {};
|
|
|
|
|
|
|
|
my $movers = Param("movers");
|
2003-01-24 03:27:28 +03:00
|
|
|
$movers =~ s/\s?,\s?/|/g;
|
|
|
|
$movers =~ s/@/\@/g;
|
2002-11-28 13:49:58 +03:00
|
|
|
$self->{'user'}->{'canmove'} = Param("move-enabled")
|
|
|
|
&& (defined $::COOKIE{"Bugzilla_login"})
|
|
|
|
&& ($::COOKIE{"Bugzilla_login"} =~ /$movers/);
|
|
|
|
|
|
|
|
# In the below, if the person hasn't logged in ($::userid == 0), then
|
|
|
|
# we treat them as if they can do anything. That's because we don't
|
|
|
|
# know why they haven't logged in; it may just be because they don't
|
|
|
|
# use cookies. Display everything as if they have all the permissions
|
|
|
|
# in the world; their permissions will get checked when they log in
|
|
|
|
# and actually try to make the change.
|
|
|
|
$self->{'user'}->{'canedit'} = $::userid == 0
|
2003-01-23 10:11:25 +03:00
|
|
|
|| $::userid == $self->{'reporter'}{'id'}
|
2003-02-23 10:31:09 +03:00
|
|
|
|| (Param('useqacontact') && $self->{'qa_contact'} && $::userid == $self->{'qa_contact'}{'id'})
|
2003-01-23 10:11:25 +03:00
|
|
|
|| $::userid == $self->{'assigned_to'}{'id'}
|
2002-11-28 13:49:58 +03:00
|
|
|
|| &::UserInGroup("editbugs");
|
2003-02-16 14:59:44 +03:00
|
|
|
$self->{'user'}->{'canconfirm'} = $::userid == 0
|
|
|
|
|| ($self->{'qa_contact'} && $::userid == $self->{'qa_contact'}{'id'})
|
|
|
|
|| $::userid == $self->{'assigned_to'}{'id'}
|
|
|
|
|| &::UserInGroup("editbugs")
|
|
|
|
|| &::UserInGroup("canconfirm");
|
2002-11-28 13:49:58 +03:00
|
|
|
|
|
|
|
return $self->{'user'};
|
|
|
|
}
|
|
|
|
|
|
|
|
sub choices {
|
|
|
|
my $self = shift;
|
|
|
|
return $self->{'choices'} if exists $self->{'choices'};
|
|
|
|
|
|
|
|
&::GetVersionTable();
|
|
|
|
|
|
|
|
$self->{'choices'} = {};
|
2000-06-09 00:30:10 +04:00
|
|
|
|
2002-11-28 13:49:58 +03:00
|
|
|
# Fiddle the product list.
|
|
|
|
my $seen_curr_prod;
|
|
|
|
my @prodlist;
|
|
|
|
|
|
|
|
foreach my $product (@::enterable_products) {
|
|
|
|
if ($product eq $self->{'product'}) {
|
|
|
|
# if it's the product the bug is already in, it's ALWAYS in
|
|
|
|
# the popup, period, whether the user can see it or not, and
|
|
|
|
# regardless of the disallownew setting.
|
|
|
|
$seen_curr_prod = 1;
|
|
|
|
push(@prodlist, $product);
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!&::CanEnterProduct($product)) {
|
|
|
|
# If we're using bug groups to restrict entry on products, and
|
|
|
|
# this product has an entry group, and the user is not in that
|
|
|
|
# group, we don't want to include that product in this list.
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
|
|
|
push(@prodlist, $product);
|
|
|
|
}
|
|
|
|
|
|
|
|
# The current product is part of the popup, even if new bugs are no longer
|
|
|
|
# allowed for that product
|
|
|
|
if (!$seen_curr_prod) {
|
|
|
|
push (@prodlist, $self->{'product'});
|
|
|
|
@prodlist = sort @prodlist;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Hack - this array contains "". See bug 106589.
|
|
|
|
my @res = grep ($_, @::settable_resolution);
|
|
|
|
|
|
|
|
$self->{'choices'} =
|
|
|
|
{
|
|
|
|
'product' => \@prodlist,
|
|
|
|
'rep_platform' => \@::legal_platform,
|
|
|
|
'priority' => \@::legal_priority,
|
|
|
|
'bug_severity' => \@::legal_severity,
|
|
|
|
'op_sys' => \@::legal_opsys,
|
|
|
|
'bug_status' => \@::legal_bugs_status,
|
|
|
|
'resolution' => \@res,
|
|
|
|
'component' => $::components{$self->{product}},
|
|
|
|
'version' => $::versions{$self->{product}},
|
|
|
|
'target_milestone' => $::target_milestone{$self->{product}},
|
|
|
|
};
|
|
|
|
|
|
|
|
return $self->{'choices'};
|
|
|
|
}
|
2000-06-09 00:30:10 +04:00
|
|
|
|
|
|
|
sub EmitDependList {
|
|
|
|
my ($myfield, $targetfield, $bug_id) = (@_);
|
|
|
|
my @list;
|
|
|
|
&::SendSQL("select dependencies.$targetfield, bugs.bug_status
|
|
|
|
from dependencies, bugs
|
|
|
|
where dependencies.$myfield = $bug_id
|
|
|
|
and bugs.bug_id = dependencies.$targetfield
|
|
|
|
order by dependencies.$targetfield");
|
|
|
|
while (&::MoreSQLData()) {
|
|
|
|
my ($i, $stat) = (&::FetchSQLData());
|
|
|
|
push @list, $i;
|
|
|
|
}
|
|
|
|
return @list;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub AUTOLOAD {
|
|
|
|
use vars qw($AUTOLOAD);
|
|
|
|
my $attr = $AUTOLOAD;
|
|
|
|
|
|
|
|
$attr =~ s/.*:://;
|
|
|
|
return unless $attr=~ /[^A-Z]/;
|
2000-06-12 10:52:41 +04:00
|
|
|
confess ("invalid bug attribute $attr") unless $ok_field{$attr};
|
2002-11-28 13:49:58 +03:00
|
|
|
|
|
|
|
no strict 'refs';
|
|
|
|
*$AUTOLOAD = sub {
|
|
|
|
my $self = shift;
|
|
|
|
if (defined $self->{$attr}) {
|
|
|
|
return $self->{$attr};
|
|
|
|
} else {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
goto &$AUTOLOAD;
|
2000-06-09 00:30:10 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
1;
|