]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 314547: [PostgreSQL] cannot check/uncheck the "Private" checkbox for comments...
authorlpsolit%gmail.com <>
Mon, 14 Nov 2005 02:16:24 +0000 (02:16 +0000)
committerlpsolit%gmail.com <>
Mon, 14 Nov 2005 02:16:24 +0000 (02:16 +0000)
Bugzilla/Bug.pm
process_bug.cgi
template/en/default/bug/comments.html.tmpl
template/en/default/filterexceptions.pl

index d094b8eae517f9224f3596157855c5e1ec2cf6ac..6a6c87d378bf0c93ec0e444422f33fa7b083c911 100755 (executable)
@@ -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'};
 
index fdf5a405b46bbe2d9a300b889fb77648e3e55b29..af0283d6ceb5cf739c27c562629a40cbd492fb58 100755 (executable)
@@ -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);
             }
         }
 
index 79e5636fca6bbb6cf99aef4b0dfaa1c0d2b30077..47c6edb61e322273f2480c2f44a3077b9d898438 100644 (file)
         <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 %]"
index eb0368c0ce94e318151a9a942bc1a3a5ff6d2822..e93f0b5e41e92c93b9ee250df6e8e31309fc749c 100644 (file)
 
 'bug/comments.html.tmpl' => [
   'comment.isprivate', 
-  'comment.when', 
+  'comment.time', 
   'bug.bug_id',
 ],