]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 425668: Make the body classes and other header information show up properly in...
authormkanat%bugzilla.org <>
Thu, 10 Dec 2009 22:13:09 +0000 (22:13 +0000)
committermkanat%bugzilla.org <>
Thu, 10 Dec 2009 22:13:09 +0000 (22:13 +0000)
Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=LpSolit

process_bug.cgi
template/en/default/bug/process/header.html.tmpl

index a4547ad6b84cb1c5bd7ddd64705ec9c561f2168f..21cf94fc79a680beb18cef9668e622936051b261 100755 (executable)
@@ -197,7 +197,7 @@ else {
 
 $vars->{'title_tag'} = "bug_processed";
 
-my ($action, $next_bug);
+my $action;
 if (defined $cgi->param('id')) {
     $action = Bugzilla->user->settings->{'post_bug_submit_action'}->{'value'};
 
@@ -208,16 +208,18 @@ if (defined $cgi->param('id')) {
         }
         my $cur = lsearch(\@bug_list, $cgi->param('id'));
         if ($cur >= 0 && $cur < $#bug_list) {
-            $next_bug = $bug_list[$cur + 1];
-            # No need to check whether the user can see the bug or not.
-            # All we want is its ID. An error will be thrown later
-            # if the user cannot see it.
-            $vars->{'bug'} = {bug_id => $next_bug};
+            my $next_bug_id = $bug_list[$cur + 1];
+            detaint_natural($next_bug_id);
+            if ($next_bug_id and $user->can_see_bug($next_bug_id)) {
+                # We create an object here so that send_results can use it
+                # when displaying the header.
+                $vars->{'bug'} = new Bugzilla::Bug($next_bug_id);
+            }
         }
     }
     # Include both action = 'same_bug' and 'nothing'.
     else {
-        $vars->{'bug'} = {bug_id => $cgi->param('id')};
+        $vars->{'bug'} = $first_bug;
     }
 }
 else {
@@ -535,7 +537,7 @@ foreach my $b (@bug_objects) {
 foreach my $bug (@bug_objects) {
     $dbh->bz_start_transaction();
 
-    my $timestamp = $dbh->selectrow_array(q{SELECT NOW()});
+    my $timestamp = $dbh->selectrow_array(q{SELECT LOCALTIMESTAMP(0)});
     my $changes = $bug->update($timestamp);
 
     my %notify_deps;
@@ -636,31 +638,23 @@ foreach my $bug (@bug_objects) {
 if (Bugzilla->usage_mode == USAGE_MODE_EMAIL) {
     # Do nothing.
 }
-elsif ($action eq 'next_bug') {
-    if ($next_bug) {
-        if (detaint_natural($next_bug) && Bugzilla->user->can_see_bug($next_bug)) {
-            my $bug = new Bugzilla::Bug($next_bug);
-            ThrowCodeError("bug_error", { bug => $bug }) if $bug->error;
-
-            $vars->{'bugs'} = [$bug];
-            $vars->{'nextbug'} = $bug->bug_id;
-
-            $template->process("bug/show.html.tmpl", $vars)
-              || ThrowTemplateError($template->error());
-
-            exit;
+elsif ($action eq 'next_bug' or $action eq 'same_bug') {
+    my $bug = $vars->{'bug'};
+    if ($bug and $user->can_see_bug($bug)) {
+        if ($action eq 'same_bug') {
+            # $bug->update() does not update the internal structure of
+            # the bug sufficiently to display the bug with the new values.
+            # (That is, if we just passed in the old Bug object, we'd get
+            # a lot of old values displayed.)
+            $bug = new Bugzilla::Bug($bug->id);
+            $vars->{'bug'} = $bug;
         }
-    }
-} elsif ($action eq 'same_bug') {
-    if (Bugzilla->user->can_see_bug($cgi->param('id'))) {
-        my $bug = new Bugzilla::Bug($cgi->param('id'));
-        ThrowCodeError("bug_error", { bug => $bug }) if $bug->error;
-
         $vars->{'bugs'} = [$bug];
-
+        if ($action eq 'next_bug') {
+            $vars->{'nextbug'} = $bug->id;
+        }
         $template->process("bug/show.html.tmpl", $vars)
           || ThrowTemplateError($template->error());
-
         exit;
     }
 } elsif ($action ne 'nothing') {
index 25571354ec00eb5bde532697e4f15d1a49d7f0d0..79f0126d4f41385111a57b84bdab16fa930803f9 100644 (file)
@@ -43,8 +43,4 @@
   [% title = "Change Votes" %]
 [% END %]
 
-[% PROCESS global/header.html.tmpl 
-  # We don't have a bug object at this point, unfortunately, so we can't
-  # actually display all the proper header info.
-  header_addl_info = '' 
-%]
+[% PROCESS global/header.html.tmpl %]