summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2005-11-14 03:16:24 +0100
committerlpsolit%gmail.com <>2005-11-14 03:16:24 +0100
commit7c0a44b743db440fee8a63a71f1742fd8c92df03 (patch)
tree6ec2cbf98b83e4cbc89339aa9f1a726567b9c138
parent03352ccf9bdb6b816e0650f8f76e008a17df87c0 (diff)
downloadbugzilla-7c0a44b743db440fee8a63a71f1742fd8c92df03.tar.gz
bugzilla-7c0a44b743db440fee8a63a71f1742fd8c92df03.tar.xz
Bug 314547: [PostgreSQL] cannot check/uncheck the "Private" checkbox for comments in show_bug.cgi - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat a=justdave
-rwxr-xr-xBugzilla/Bug.pm10
-rwxr-xr-xprocess_bug.cgi10
-rw-r--r--template/en/default/bug/comments.html.tmpl2
-rw-r--r--template/en/default/filterexceptions.pl2
4 files changed, 10 insertions, 14 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index d094b8eae..6a6c87d37 100755
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -786,11 +786,9 @@ sub GetComments {
my @comments;
my $sth = $dbh->prepare(
"SELECT profiles.realname AS name, profiles.login_name AS email,
- " . $dbh->sql_date_format('longdescs.bug_when', '%Y.%m.%d %H:%i') . "
+ " . $dbh->sql_date_format('longdescs.bug_when', '%Y.%m.%d %H:%i:%s') . "
AS time, longdescs.thetext AS body, longdescs.work_time,
- isprivate, already_wrapped,
- " . $dbh->sql_date_format('longdescs.bug_when', '%Y%m%d%H%i%s') . "
- AS bug_when
+ isprivate, already_wrapped
FROM longdescs, profiles
WHERE profiles.userid = longdescs.who
AND longdescs.bug_id = ?
@@ -800,10 +798,6 @@ sub GetComments {
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'};
diff --git a/process_bug.cgi b/process_bug.cgi
index fdf5a405b..af0283d6c 100755
--- a/process_bug.cgi
+++ b/process_bug.cgi
@@ -936,16 +936,18 @@ if (defined $cgi->param('id')) {
if (defined $cgi->param('id') &&
(Param("insidergroup") && UserInGroup(Param("insidergroup")))) {
+ my $sth = $dbh->prepare('UPDATE longdescs SET isprivate = ?
+ WHERE bug_id = ? AND bug_when = ?');
+
foreach my $field ($cgi->param()) {
if ($field =~ /when-([0-9]+)/) {
my $sequence = $1;
my $private = $cgi->param("isprivate-$sequence") ? 1 : 0 ;
if ($private != $cgi->param("oisprivate-$sequence")) {
my $field_data = $cgi->param("$field");
- detaint_natural($field_data);
- SendSQL("UPDATE longdescs SET isprivate = $private " .
- "WHERE bug_id = " . $cgi->param('id') .
- " AND bug_when = $field_data");
+ # Make sure a valid date is given.
+ $field_data = format_time($field_data, '%Y-%m-%d %T');
+ $sth->execute($private, $cgi->param('id'), $field_data);
}
}
diff --git a/template/en/default/bug/comments.html.tmpl b/template/en/default/bug/comments.html.tmpl
index 79e5636fc..47c6edb61 100644
--- a/template/en/default/bug/comments.html.tmpl
+++ b/template/en/default/bug/comments.html.tmpl
@@ -124,7 +124,7 @@
<i>
<input type="hidden" name="oisprivate-[% count %]"
value="[% comment.isprivate %]">
- <input type="hidden" name="when-[% count %]" value="[% comment.when %]">
+ <input type="hidden" name="when-[% count %]" value="[% comment.time %]">
<input type="checkbox" name="isprivate-[% count %]" value="1"
onClick="updateCommentPrivacy(this, [% count %])"
id="isprivate-[% count %]"
diff --git a/template/en/default/filterexceptions.pl b/template/en/default/filterexceptions.pl
index eb0368c0c..e93f0b5e4 100644
--- a/template/en/default/filterexceptions.pl
+++ b/template/en/default/filterexceptions.pl
@@ -304,7 +304,7 @@
'bug/comments.html.tmpl' => [
'comment.isprivate',
- 'comment.when',
+ 'comment.time',
'bug.bug_id',
],