summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Bug.pm
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2011-08-07 02:31:57 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2011-08-07 02:31:57 +0200
commitfa8fd93aa2a2625b87f17cf4b61f60a774f8b8b4 (patch)
tree86c6f527aa08d9d1b5b05abb3c50ce89cacaae13 /Bugzilla/Bug.pm
parent9f377584a44739183c3ce1eced8ed33f4f0894d4 (diff)
downloadbugzilla-fa8fd93aa2a2625b87f17cf4b61f60a774f8b8b4.tar.gz
bugzilla-fa8fd93aa2a2625b87f17cf4b61f60a774f8b8b4.tar.xz
Bug 55436: Implement list of duplicate bug numbers on show_bug.cgi
r=mkanat a=LpSolit
Diffstat (limited to 'Bugzilla/Bug.pm')
-rw-r--r--Bugzilla/Bug.pm23
1 files changed, 22 insertions, 1 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index 40bf3af2e..62099c423 100644
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -487,10 +487,11 @@ sub preload {
my @all_dep_ids;
foreach my $bug (@$bugs) {
push(@all_dep_ids, @{ $bug->blocked }, @{ $bug->dependson });
+ push(@all_dep_ids, @{ $bug->duplicate_ids });
}
@all_dep_ids = uniq @all_dep_ids;
# If we don't do this, can_see_bug will do one call per bug in
- # the dependency lists, during get_bug_link in Bugzilla::Template.
+ # the dependency and duplicate lists, in Bugzilla::Template::get_bug_link.
$user->visible_bugs(\@all_dep_ids);
}
@@ -3243,6 +3244,26 @@ sub depends_on_obj {
return $self->{depends_on_obj};
}
+sub duplicates {
+ my $self = shift;
+ return $self->{duplicates} if exists $self->{duplicates};
+ return [] if $self->{error};
+ $self->{duplicates} = Bugzilla::Bug->new_from_list($self->duplicate_ids);
+ return $self->{duplicates};
+}
+
+sub duplicate_ids {
+ my $self = shift;
+ return $self->{duplicate_ids} if exists $self->{duplicate_ids};
+ return [] if $self->{error};
+
+ my $dbh = Bugzilla->dbh;
+ $self->{duplicate_ids} =
+ $dbh->selectcol_arrayref('SELECT dupe FROM duplicates WHERE dupe_of = ?',
+ undef, $self->id);
+ return $self->{duplicate_ids};
+}
+
sub flag_types {
my ($self) = @_;
return $self->{'flag_types'} if exists $self->{'flag_types'};