summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authortravis%sedsystems.ca <>2005-02-01 01:32:56 +0100
committertravis%sedsystems.ca <>2005-02-01 01:32:56 +0100
commit7c95655a860e263df00376c2c1b5658f53151654 (patch)
tree70fd45dea1dae1d4e4a58956d4a60d2e6620d7cb /Bugzilla
parent6cf9cae950f0cc24fa517d5847d7fb3e8c9a8667 (diff)
downloadbugzilla-7c95655a860e263df00376c2c1b5658f53151654.tar.gz
bugzilla-7c95655a860e263df00376c2c1b5658f53151654.tar.xz
Bug 279700 : Move GetComments from globals.pl into Bugzilla::Bug
Patch by Max Kanat-Alexander <mkanat@kerio.com> r=vladd a=justdave
Diffstat (limited to 'Bugzilla')
-rwxr-xr-xBugzilla/Bug.pm34
1 files changed, 33 insertions, 1 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index 85f7ee030..ad48e763f 100755
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -308,7 +308,7 @@ sub longdescs {
return $self->{'longdescs'} if exists $self->{'longdescs'};
- $self->{'longdescs'} = &::GetComments($self->{bug_id});
+ $self->{'longdescs'} = GetComments($self->{bug_id});
return $self->{'longdescs'};
}
@@ -504,6 +504,38 @@ sub ValidateTime {
}
}
+sub GetComments {
+ my ($id) = (@_);
+ my $dbh = Bugzilla->dbh;
+ my @comments;
+ my $sth = $dbh->prepare(
+ "SELECT profiles.realname AS name, profiles.login_name AS email,
+ date_format(longdescs.bug_when,'%Y.%m.%d %H:%i') AS time,
+ longdescs.thetext AS body, longdescs.work_time,
+ isprivate,
+ date_format(longdescs.bug_when,'%Y%m%d%H%i%s')
+ FROM longdescs, profiles
+ WHERE profiles.userid = longdescs.who
+ AND longdescs.bug_id = ?
+ ORDER BY longdescs.bug_when");
+ $sth->execute($id);
+
+ while (my $comment_ref = $sth->fetchrow_hashref()) {
+ my %comment = %$comment_ref;
+
+ # Can't use "when" as a field name in MySQL
+ $comment{'when'} = $comment{'bug_when'};
+ delete($comment{'bug_when'});
+
+ $comment{'email'} .= Param('emailsuffix');
+ $comment{'name'} = $comment{'name'} || $comment{'email'};
+
+ push (@comments, \%comment);
+ }
+
+ return \@comments;
+}
+
sub AUTOLOAD {
use vars qw($AUTOLOAD);
my $attr = $AUTOLOAD;