From 1f63e91c4c701e9034b7768350e73d61cf74fd5b Mon Sep 17 00:00:00 2001
From: vfilippov
Date: Mon, 13 Jul 2009 13:54:45 +0000
Subject: [PATCH] Bug 40933 Merge with Bugzilla 3.2.4 [08.07.2009]
git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@200 6955db30-a419-402b-8a0d-67ecbb4d7f56
---
Bugzilla/Bug.pm | 70 ++++++++++---------
Bugzilla/Constants.pm | 2 +-
Bugzilla/Install/Requirements.pm | 6 ++
Bugzilla/Template.pm | 8 +++
Bugzilla/User.pm | 20 ++++++
attachment.cgi | 4 ++
buglist.cgi | 2 +-
describecomponents.cgi | 2 +-
docs/bugzilla.ent | 1 +
docs/en/html/Bugzilla-Guide.html | 8 +--
docs/en/html/about.html | 8 +--
docs/en/html/administration.html | 4 +-
docs/en/html/api/Bugzilla/User.html | 17 +++++
docs/en/html/api/index.html | 4 +-
docs/en/html/attachments.html | 4 +-
docs/en/html/bug_page.html | 4 +-
docs/en/html/bug_status_workflow.html | 4 +-
docs/en/html/bugreports.html | 4 +-
docs/en/html/classifications.html | 4 +-
docs/en/html/cmdline-bugmail.html | 4 +-
docs/en/html/cmdline.html | 4 +-
docs/en/html/components.html | 4 +-
docs/en/html/configuration.html | 4 +-
docs/en/html/conventions.html | 4 +-
docs/en/html/copyright.html | 4 +-
docs/en/html/credits.html | 4 +-
docs/en/html/cust-change-permissions.html | 4 +-
docs/en/html/cust-hooks.html | 4 +-
docs/en/html/cust-skins.html | 4 +-
docs/en/html/cust-templates.html | 4 +-
docs/en/html/custom-fields.html | 4 +-
docs/en/html/customization.html | 4 +-
docs/en/html/disclaimer.html | 4 +-
docs/en/html/edit-values.html | 4 +-
docs/en/html/extraconfig.html | 4 +-
docs/en/html/flags-overview.html | 4 +-
docs/en/html/flags.html | 4 +-
docs/en/html/general-advice.html | 4 +-
docs/en/html/gfdl-0.html | 4 +-
docs/en/html/gfdl-1.html | 4 +-
docs/en/html/gfdl-10.html | 4 +-
docs/en/html/gfdl-2.html | 4 +-
docs/en/html/gfdl-3.html | 4 +-
docs/en/html/gfdl-4.html | 4 +-
docs/en/html/gfdl-5.html | 4 +-
docs/en/html/gfdl-6.html | 4 +-
docs/en/html/gfdl-7.html | 4 +-
docs/en/html/gfdl-8.html | 4 +-
docs/en/html/gfdl-9.html | 4 +-
docs/en/html/gfdl-howto.html | 4 +-
docs/en/html/gfdl.html | 4 +-
docs/en/html/glossary.html | 4 +-
docs/en/html/groups.html | 4 +-
docs/en/html/hintsandtips.html | 4 +-
docs/en/html/index.html | 6 +-
docs/en/html/install-perlmodules-manual.html | 4 +-
docs/en/html/installation.html | 4 +-
docs/en/html/installing-bugzilla.html | 4 +-
docs/en/html/integration.html | 4 +-
docs/en/html/keywords.html | 4 +-
docs/en/html/lifecycle.html | 4 +-
docs/en/html/milestones.html | 4 +-
docs/en/html/modules-manual-download.html | 4 +-
docs/en/html/modules-manual-instructions.html | 4 +-
docs/en/html/modules-manual-optional.html | 4 +-
docs/en/html/multiple-bz-dbs.html | 4 +-
docs/en/html/myaccount.html | 4 +-
docs/en/html/newversions.html | 6 +-
docs/en/html/nonroot.html | 4 +-
docs/en/html/os-specific.html | 4 +-
docs/en/html/parameters.html | 4 +-
docs/en/html/paranoid-security.html | 4 +-
docs/en/html/patches.html | 4 +-
docs/en/html/products.html | 4 +-
docs/en/html/query.html | 4 +-
docs/en/html/quips.html | 4 +-
docs/en/html/reporting.html | 4 +-
docs/en/html/sanitycheck.html | 4 +-
docs/en/html/security-bugzilla.html | 4 +-
docs/en/html/security-mysql.html | 4 +-
docs/en/html/security-os.html | 4 +-
docs/en/html/security-webserver.html | 4 +-
docs/en/html/security.html | 4 +-
docs/en/html/timetracking.html | 4 +-
docs/en/html/trbl-dbdsponge.html | 4 +-
docs/en/html/trbl-index.html | 4 +-
docs/en/html/trbl-passwd-encryption.html | 4 +-
docs/en/html/trbl-perlmodule.html | 4 +-
docs/en/html/trbl-relogin-everyone.html | 4 +-
docs/en/html/trbl-relogin-some.html | 4 +-
docs/en/html/trbl-testserver.html | 4 +-
docs/en/html/troubleshooting.html | 4 +-
docs/en/html/upgrade.html | 4 +-
docs/en/html/useradmin.html | 4 +-
docs/en/html/userpreferences.html | 4 +-
docs/en/html/using-intro.html | 4 +-
docs/en/html/using.html | 4 +-
docs/en/html/versions.html | 4 +-
docs/en/html/voting.html | 4 +-
docs/en/html/whining.html | 4 +-
docs/en/txt/Bugzilla-Guide.txt | 6 +-
docs/en/xml/Bugzilla-Guide.xml | 4 +-
docs/en/xml/bugzilla.ent | 1 +
editproducts.cgi | 2 +-
email_in.pl | 7 +-
process_bug.cgi | 2 +-
.../en/default/global/code-error.html.tmpl | 7 +-
.../en/default/global/field-descs.none.tmpl | 2 +-
template/en/default/global/header.html.tmpl | 26 +++----
.../en/default/pages/release-notes.html.tmpl | 36 +++++++++-
votes.cgi | 2 +-
111 files changed, 350 insertions(+), 249 deletions(-)
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index 6e6f75c4d..1c0a8e47c 100644
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -160,6 +160,7 @@ use constant UPDATE_VALIDATORS => {
bug_status => \&_check_bug_status,
cclist_accessible => \&Bugzilla::Object::check_boolean,
dup_id => \&_check_dup_id,
+ everconfirmed => \&Bugzilla::Object::check_boolean,
qa_contact => \&_check_qa_contact,
reporter_accessible => \&Bugzilla::Object::check_boolean,
resolution => \&_check_resolution,
@@ -2045,7 +2046,7 @@ sub set_status {
if ($new_status->is_open) {
# Check for the everconfirmed transition
- $self->_set_everconfirmed(1) if $new_status->name ne 'UNCONFIRMED';
+ $self->_set_everconfirmed($new_status->name eq 'UNCONFIRMED' ? 0 : 1);
$self->clear_resolution();
}
else {
@@ -3229,45 +3230,37 @@ sub RemoveVotes {
# If a user votes for a bug, or the number of votes required to
# confirm a bug has been reduced, check if the bug is now confirmed.
sub CheckIfVotedConfirmed {
- my ($id, $who) = (@_);
- my $dbh = Bugzilla->dbh;
-
- # XXX - Use bug methods to update the bug status and everconfirmed.
+ my $id = shift;
my $bug = new Bugzilla::Bug($id);
- my ($votes, $status, $everconfirmed, $votestoconfirm, $timestamp) =
- $dbh->selectrow_array("SELECT votes, bug_status, everconfirmed, " .
- " votestoconfirm, NOW() " .
- "FROM bugs INNER JOIN products " .
- " ON products.id = bugs.product_id " .
- "WHERE bugs.bug_id = ?",
- undef, $id);
-
my $ret = 0;
- if ($votes >= $votestoconfirm && !$everconfirmed) {
+ if (!$bug->everconfirmed && $bug->votes >= $bug->product_obj->votes_to_confirm) {
$bug->add_comment('', { type => CMT_POPULAR_VOTES });
- $bug->update();
- if ($status eq 'UNCONFIRMED') {
- my $fieldid = get_field_id("bug_status");
- $dbh->do("UPDATE bugs SET bug_status = 'NEW', everconfirmed = 1, " .
- "delta_ts = ? WHERE bug_id = ?",
- undef, ($timestamp, $id));
- $dbh->do("INSERT INTO bugs_activity " .
- "(bug_id, who, bug_when, fieldid, removed, added) " .
- "VALUES (?, ?, ?, ?, ?, ?)",
- undef, ($id, $who, $timestamp, $fieldid, 'UNCONFIRMED', 'NEW'));
+ if ($bug->bug_status eq 'UNCONFIRMED') {
+ # Get a valid open state.
+ my $new_status;
+ foreach my $state (@{$bug->status->can_change_to}) {
+ if ($state->is_open && $state->name ne 'UNCONFIRMED') {
+ $new_status = $state->name;
+ last;
+ }
+ }
+ ThrowCodeError('no_open_bug_status') unless $new_status;
+
+ # We cannot call $bug->set_status() here, because a user without
+ # canconfirm privs should still be able to confirm a bug by
+ # popular vote. We already know the new status is valid, so it's safe.
+ $bug->{bug_status} = $new_status;
+ $bug->{everconfirmed} = 1;
+ delete $bug->{'status'}; # Contains the status object.
}
else {
- $dbh->do("UPDATE bugs SET everconfirmed = 1, delta_ts = ? " .
- "WHERE bug_id = ?", undef, ($timestamp, $id));
+ # If the bug is in a closed state, only set everconfirmed to 1.
+ # Do not call $bug->_set_everconfirmed(), for the same reason as above.
+ $bug->{everconfirmed} = 1;
}
-
- my $fieldid = get_field_id("everconfirmed");
- $dbh->do("INSERT INTO bugs_activity " .
- "(bug_id, who, bug_when, fieldid, removed, added) " .
- "VALUES (?, ?, ?, ?, ?, ?)",
- undef, ($id, $who, $timestamp, $fieldid, '0', '1'));
+ $bug->update();
$ret = 1;
}
@@ -3343,6 +3336,7 @@ sub check_can_change_field {
# *Only* users with (product-specific) "canconfirm" privs can confirm bugs.
if ($field eq 'canconfirm'
+ || ($field eq 'everconfirmed' && $newvalue)
|| ($field eq 'bug_status'
&& $oldvalue eq 'UNCONFIRMED'
&& is_open_state($newvalue)))
@@ -3398,6 +3392,18 @@ sub check_can_change_field {
$$PrivilegesRequired = 2;
return 0;
}
+ # - unconfirm bugs (confirming them is handled above)
+ if ($field eq 'everconfirmed') {
+ $$PrivilegesRequired = 2;
+ return 0;
+ }
+ # - change the status from one open state to another
+ if ($field eq 'bug_status'
+ && is_open_state($oldvalue) && is_open_state($newvalue))
+ {
+ $$PrivilegesRequired = 2;
+ return 0;
+ }
# The reporter is allowed to change anything else.
if (!$self->{'error'} && $self->{'reporter_id'} == $user->id) {
diff --git a/Bugzilla/Constants.pm b/Bugzilla/Constants.pm
index d5aeabca2..0644e102d 100644
--- a/Bugzilla/Constants.pm
+++ b/Bugzilla/Constants.pm
@@ -159,7 +159,7 @@ use File::Basename;
# CONSTANTS
#
# Bugzilla version
-use constant BUGZILLA_VERSION => "3.2.3";
+use constant BUGZILLA_VERSION => "3.2.4";
# These are unique values that are unlikely to match a string or a number,
# to be used in criteria for match() functions and other things. They start
diff --git a/Bugzilla/Install/Requirements.pm b/Bugzilla/Install/Requirements.pm
index 47699e432..bf833846b 100644
--- a/Bugzilla/Install/Requirements.pm
+++ b/Bugzilla/Install/Requirements.pm
@@ -94,6 +94,12 @@ sub REQUIRED_MODULES {
module => 'Email::MIME',
version => '1.861'
},
+ {
+ package => 'Email-MIME-Encodings',
+ module => 'Email::MIME::Encodings',
+ # Fixes bug 486206
+ version => '1.313',
+ },
{
package => 'Email-MIME-Modifier',
module => 'Email::MIME::Modifier',
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm
index 12e7e9fc5..b9554246c 100644
--- a/Bugzilla/Template.pm
+++ b/Bugzilla/Template.pm
@@ -787,6 +787,14 @@ sub create {
# Allow templates to generate a token themselves.
'issue_hash_token' => \&Bugzilla::Token::issue_hash_token,
+ # A way for all templates to get at Field data, cached.
+ 'bug_fields' => sub {
+ my $cache = Bugzilla->request_cache;
+ $cache->{template_bug_fields} ||=
+ { map { $_->name => $_ } Bugzilla->get_fields() };
+ return $cache->{template_bug_fields};
+ },
+
# These don't work as normal constants.
DB_MODULE => \&Bugzilla::Constants::DB_MODULE,
REQUIRED_MODULES =>
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm
index 573c9b9a1..3429e7c57 100644
--- a/Bugzilla/User.pm
+++ b/Bugzilla/User.pm
@@ -768,6 +768,12 @@ sub get_enterable_products {
return $self->{enterable_products};
}
+sub can_access_product {
+ my ($self, $product_name) = @_;
+
+ return scalar(grep {$_->name eq $product_name} @{$self->get_accessible_products});
+}
+
sub get_accessible_products {
my $self = shift;
@@ -2031,6 +2037,20 @@ method should be called in such a case to force reresolution of these groups.
Returns: an array of product objects.
+=item C
+
+Returns 1 if the user can search or enter bugs into the specified product,
+and 0 if the user should not be aware of the existence of the product.
+
+=item C
+
+ Description: Returns an array of product objects the user can search
+ or enter bugs against.
+
+ Params: none
+
+ Returns: an array of product objects.
+
=item C
Description: Checks whether the user is allowed to administrate the product.
diff --git a/attachment.cgi b/attachment.cgi
index a17261f65..d9b552e59 100755
--- a/attachment.cgi
+++ b/attachment.cgi
@@ -264,6 +264,10 @@ sub view {
my $bug_id = $attachment->bug_id;
$attachbase =~ s/%bugid%/$bug_id/;
my $path = 'attachment.cgi?id=' . $attachment->id;
+ # The user is allowed to override the content type of the attachment.
+ if (defined $cgi->param('content_type')) {
+ $path .= '&content_type=' . url_quote($cgi->param('content_type'));
+ }
# Make sure the attachment is served from the correct server.
if ($cgi->self_url !~ /^\Q$attachbase\E/) {
diff --git a/buglist.cgi b/buglist.cgi
index 1e3146e8c..42e307b47 100755
--- a/buglist.cgi
+++ b/buglist.cgi
@@ -1213,7 +1213,7 @@ my $contenttype;
my $disposition = "inline";
if ($format->{'extension'} eq "html" && !$agent) {
- if ($order) {
+ if ($order && !$cgi->param('sharer_id')) {
$cgi->send_cookie(-name => 'LASTORDER',
-value => $order,
-expires => 'Fri, 01-Jan-2038 00:00:00 GMT');
diff --git a/describecomponents.cgi b/describecomponents.cgi
index 806183783..05bd4e59f 100755
--- a/describecomponents.cgi
+++ b/describecomponents.cgi
@@ -43,7 +43,7 @@ print $cgi->header();
my $product_name = trim($cgi->param('product') || '');
my $product = new Bugzilla::Product({'name' => $product_name});
-unless ($product && $user->can_enter_product($product->name)) {
+unless ($product && $user->can_access_product($product->name)) {
# Products which the user is allowed to see.
my @products = @{$user->get_enterable_products};
diff --git a/docs/bugzilla.ent b/docs/bugzilla.ent
index 04e3aa895..4bd19a3d8 100644
--- a/docs/bugzilla.ent
+++ b/docs/bugzilla.ent
@@ -8,6 +8,7 @@
+
diff --git a/docs/en/html/Bugzilla-Guide.html b/docs/en/html/Bugzilla-Guide.html
index ae62fccc1..6afab31f2 100644
--- a/docs/en/html/Bugzilla-Guide.html
+++ b/docs/en/html/Bugzilla-Guide.html
@@ -2,7 +2,7 @@
The Bugzilla Guide - 3.2.3
+>The Bugzilla Guide - 3.2.4
ReleaseThe Bugzilla Guide - 3.2.3
+>The Bugzilla Guide - 3.2.4
Release
The Bugzilla Team
2009-03-30
2009-07-08
1.3. New Versions
This is the 3.2.3 version of The Bugzilla Guide. It is so named
+>
This is the 3.2.4 version of The Bugzilla Guide. It is so named
to match the current version of Bugzilla.
Description: Returns an array of product objects the user can search
+ or enter bugs against.
+
+ Params: none
+
+ Returns: an array of product objects.
This is the 3.2.3 version of The Bugzilla Guide. It is so named
+>
This is the 3.2.4 version of The Bugzilla Guide. It is so named
to match the current version of Bugzilla.
-
+
-
+
diff --git a/docs/en/xml/bugzilla.ent b/docs/en/xml/bugzilla.ent
index 04e3aa895..4bd19a3d8 100644
--- a/docs/en/xml/bugzilla.ent
+++ b/docs/en/xml/bugzilla.ent
@@ -8,6 +8,7 @@
+
diff --git a/editproducts.cgi b/editproducts.cgi
index dd8c7b73e..c737e64b3 100755
--- a/editproducts.cgi
+++ b/editproducts.cgi
@@ -1026,7 +1026,7 @@ if ($action eq 'update') {
my @updated_bugs = ();
foreach my $bug_id (@$bug_list) {
- my $confirmed = CheckIfVotedConfirmed($bug_id, $whoid);
+ my $confirmed = CheckIfVotedConfirmed($bug_id);
push (@updated_bugs, $bug_id) if $confirmed;
}
diff --git a/email_in.pl b/email_in.pl
index 48209331d..089b1274e 100755
--- a/email_in.pl
+++ b/email_in.pl
@@ -24,10 +24,11 @@ use warnings;
# MTAs may call this script from any directory, but it should always
# run from this one so that it can find its modules.
+use Cwd qw(abs_path);
+use File::Basename qw(dirname);
BEGIN {
- require File::Basename;
- my ($a) = $0 =~ /^(.*)$/iso;
- chdir(File::Basename::dirname($a));
+ my ($a) = abs_path($0) =~ /^(.*)$/iso;
+ chdir dirname($a);
}
use lib qw(. lib);
diff --git a/process_bug.cgi b/process_bug.cgi
index e0fc78579..a3d2d42b4 100755
--- a/process_bug.cgi
+++ b/process_bug.cgi
@@ -632,7 +632,7 @@ foreach my $bug (@bug_objects) {
# a list of messages to send to voters.
# We delay the sending of these messages till tables are unlocked.
$msgs = RemoveVotes($bug->id, 0, 'votes_bug_moved');
- CheckIfVotedConfirmed($bug->id, Bugzilla->user->id);
+ CheckIfVotedConfirmed($bug->id);
}
# Set and update flags.
diff --git a/template/en/default/global/code-error.html.tmpl b/template/en/default/global/code-error.html.tmpl
index 7f709a2a0..980633b7f 100644
--- a/template/en/default/global/code-error.html.tmpl
+++ b/template/en/default/global/code-error.html.tmpl
@@ -32,7 +32,7 @@
# in this file; if you do not wish to change it, use the "none" filter.
#%]
-[% PROCESS global/variables.none.tmpl %]
+[% PROCESS "global/field-descs.none.tmpl" %]
[% DEFAULT title = "Internal Error" %]
@@ -313,6 +313,11 @@
You cannot set the resolution of [% terms.abug %] to MOVED without
moving the [% terms.bug %].
+ [% ELSIF error == "no_open_bug_status" %]
+ [% title = "$terms.Bug Cannot Be Confirmed" %]
+ There is no valid transition from
+ [%+ get_status("UNCONFIRMED") FILTER html %] to an open state.
+
[% ELSIF error == "param_must_be_numeric" %]
[% title = "Invalid Parameter" %]
Invalid parameter passed to [% function FILTER html %].
diff --git a/template/en/default/global/field-descs.none.tmpl b/template/en/default/global/field-descs.none.tmpl
index 344dc5528..e2c04a0a6 100644
--- a/template/en/default/global/field-descs.none.tmpl
+++ b/template/en/default/global/field-descs.none.tmpl
@@ -92,7 +92,7 @@
[% UNLESS Param('shutdownhtml') %]
[% USE Bugzilla %]
- [% FOREACH bz_field = Bugzilla.get_fields() %]
+ [% FOREACH bz_field = bug_fields.values %]
[% SET field_descs.${bz_field.name} = bz_field.description
IF !field_descs.${bz_field.name}.defined %]
[% END %]
diff --git a/template/en/default/global/header.html.tmpl b/template/en/default/global/header.html.tmpl
index a25cf70dc..fea1ad036 100644
--- a/template/en/default/global/header.html.tmpl
+++ b/template/en/default/global/header.html.tmpl
@@ -91,9 +91,10 @@
rel="stylesheet"
type="text/css">
[% END %]
-