summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2009-12-10 23:13:09 +0100
committermkanat%bugzilla.org <>2009-12-10 23:13:09 +0100
commit56285b05dcdc9ebfe8df8119b387205def6db9dc (patch)
treef6f06c1dfbc9386021949e85d45384c290969631
parentc0b214bc396fe0db56fad1757c33ce640cc8aea7 (diff)
downloadbugzilla-56285b05dcdc9ebfe8df8119b387205def6db9dc.tar.gz
bugzilla-56285b05dcdc9ebfe8df8119b387205def6db9dc.tar.xz
Bug 425668: Make the body classes and other header information show up properly in process_bug.cgi if we're doing same_bug or next_bug
Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=LpSolit
-rwxr-xr-xprocess_bug.cgi52
-rw-r--r--template/en/default/bug/process/header.html.tmpl6
2 files changed, 24 insertions, 34 deletions
diff --git a/process_bug.cgi b/process_bug.cgi
index a4547ad6b..21cf94fc7 100755
--- a/process_bug.cgi
+++ b/process_bug.cgi
@@ -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') {
diff --git a/template/en/default/bug/process/header.html.tmpl b/template/en/default/bug/process/header.html.tmpl
index 25571354e..79f0126d4 100644
--- a/template/en/default/bug/process/header.html.tmpl
+++ b/template/en/default/bug/process/header.html.tmpl
@@ -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 %]