aboutsummaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2009-12-17 23:31:51 +0000
committermkanat%bugzilla.org <>2009-12-17 23:31:51 +0000
commita73890d2ef8851ddae6b4991998824596a0f5644 (patch)
treea154cc5cd26842300bb0dd513ed7949c67682153 /Bugzilla
parent3eb0b0d657efa47583d5bea699d8b9a62547fb6c (diff)
downloadbugs-a73890d2ef8851ddae6b4991998824596a0f5644.tar
bugs-a73890d2ef8851ddae6b4991998824596a0f5644.tar.gz
bugs-a73890d2ef8851ddae6b4991998824596a0f5644.tar.bz2
bugs-a73890d2ef8851ddae6b4991998824596a0f5644.tar.xz
bugs-a73890d2ef8851ddae6b4991998824596a0f5644.zip
Bug 162060: Remove the relationship between "votestoconfirm" and whether or not the UNCONFIRMED status is available, by adding a checkbox to enable the UNCONFIRMED status in editproducts.cgi.
Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=LpSolit
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Bug.pm22
-rw-r--r--Bugzilla/DB/Schema.pm2
-rw-r--r--Bugzilla/Install/DB.pm12
-rw-r--r--Bugzilla/Product.pm6
4 files changed, 36 insertions, 6 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index ab035fcba..1eaafb698 100644
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -1122,9 +1122,7 @@ sub _check_bug_status {
}
else {
@valid_statuses = @{Bugzilla::Status->can_change_to()};
- if (!$product->votes_to_confirm) {
- # UNCONFIRMED becomes an invalid status if votes_to_confirm is 0,
- # even if you are in editbugs.
+ if (!$product->allows_unconfirmed) {
@valid_statuses = grep {$_->name ne 'UNCONFIRMED'} @valid_statuses;
}
}
@@ -1157,9 +1155,13 @@ sub _check_bug_status {
}
}
}
+
# Time to validate the bug status.
$new_status = Bugzilla::Status->check($new_status) unless ref($new_status);
- if (!grep {$_->name eq $new_status->name} @valid_statuses) {
+ # We skip this check if we are changing from a status to itself.
+ if ( (!$old_status || $old_status->id != $new_status->id)
+ && !grep {$_->name eq $new_status->name} @valid_statuses)
+ {
ThrowUserError('illegal_bug_status_transition',
{ old => $old_status, new => $new_status });
}
@@ -2804,7 +2806,7 @@ sub statuses_available {
my @statuses = @{ $self->status->can_change_to };
# UNCONFIRMED is only a valid status if it is enabled in this product.
- if (!$self->product_obj->votes_to_confirm) {
+ if (!$self->product_obj->allows_unconfirmed) {
@statuses = grep { $_->name ne 'UNCONFIRMED' } @statuses;
}
@@ -2816,6 +2818,11 @@ sub statuses_available {
push(@available, $status);
}
+ # If this bug has an inactive status set, it should still be in the list.
+ if (!grep($_->name eq $self->status->name, @available)) {
+ unshift(@available, $self->status);
+ }
+
$self->{'statuses_available'} = \@available;
return $self->{'statuses_available'};
}
@@ -3367,7 +3374,10 @@ sub CheckIfVotedConfirmed {
my $bug = new Bugzilla::Bug($id);
my $ret = 0;
- if (!$bug->everconfirmed && $bug->votes >= $bug->product_obj->votes_to_confirm) {
+ if (!$bug->everconfirmed
+ and $bug->product_obj->votes_to_confirm
+ and $bug->votes >= $bug->product_obj->votes_to_confirm)
+ {
$bug->add_comment('', { type => CMT_POPULAR_VOTES });
if ($bug->bug_status eq 'UNCONFIRMED') {
diff --git a/Bugzilla/DB/Schema.pm b/Bugzilla/DB/Schema.pm
index e4dcfd966..a1102dd64 100644
--- a/Bugzilla/DB/Schema.pm
+++ b/Bugzilla/DB/Schema.pm
@@ -1224,6 +1224,8 @@ use constant ABSTRACT_SCHEMA => {
DEFAULT => 0},
defaultmilestone => {TYPE => 'varchar(20)',
NOTNULL => 1, DEFAULT => "'---'"},
+ allows_unconfirmed => {TYPE => 'BOOLEAN', NOTNULL => 1,
+ DEFAULT => 'FALSE'},
],
INDEXES => [
products_name_idx => {FIELDS => ['name'],
diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm
index 414731fbe..adbcb285f 100644
--- a/Bugzilla/Install/DB.pm
+++ b/Bugzilla/Install/DB.pm
@@ -592,6 +592,8 @@ sub update_table_definitions {
$dbh->bz_drop_column('products', 'milestoneurl');
+ _add_allows_unconfirmed_to_product_table();
+
################################################################
# New --TABLE-- changes should go *** A B O V E *** this point #
################################################################
@@ -3328,6 +3330,16 @@ sub _set_attachment_comment_types {
_populate_bugs_fulltext($bug_ids);
}
+sub _add_allows_unconfirmed_to_product_table {
+ my $dbh = Bugzilla->dbh;
+ if (!$dbh->bz_column_info('products', 'allows_unconfirmed')) {
+ $dbh->bz_add_column('products', 'allows_unconfirmed',
+ { TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 'FALSE' });
+ $dbh->do('UPDATE products SET allows_unconfirmed = 1
+ WHERE votestoconfirm > 0');
+ }
+}
+
1;
__END__
diff --git a/Bugzilla/Product.pm b/Bugzilla/Product.pm
index 410f1bd20..0228aca02 100644
--- a/Bugzilla/Product.pm
+++ b/Bugzilla/Product.pm
@@ -58,6 +58,7 @@ use constant DB_COLUMNS => qw(
maxvotesperbug
votestoconfirm
defaultmilestone
+ allows_unconfirmed
);
use constant REQUIRED_CREATE_FIELDS => qw(
@@ -74,9 +75,11 @@ use constant UPDATE_COLUMNS => qw(
votesperuser
maxvotesperbug
votestoconfirm
+ allows_unconfirmed
);
use constant VALIDATORS => {
+ allows_unconfirmed => \&Bugzilla::Object::check_boolean,
classification => \&_check_classification,
name => \&_check_name,
description => \&_check_description,
@@ -631,6 +634,7 @@ sub set_is_active { $_[0]->set('isactive', $_[1]); }
sub set_votes_per_user { $_[0]->set('votesperuser', $_[1]); }
sub set_votes_per_bug { $_[0]->set('maxvotesperbug', $_[1]); }
sub set_votes_to_confirm { $_[0]->set('votestoconfirm', $_[1]); }
+sub set_allows_unconfirmed { $_[0]->set('allows_unconfirmed', $_[1]); }
sub set_group_controls {
my ($self, $group, $settings) = @_;
@@ -882,6 +886,7 @@ sub flag_types {
#### Accessors ######
###############################
+sub allows_unconfirmed { return $_[0]->{'allows_unconfirmed'}; }
sub description { return $_[0]->{'description'}; }
sub is_active { return $_[0]->{'isactive'}; }
sub votes_per_user { return $_[0]->{'votesperuser'}; }
@@ -941,6 +946,7 @@ Bugzilla::Product - Bugzilla product class.
my votestoconfirm = $product->votes_to_confirm;
my $defaultmilestone = $product->default_milestone;
my $classificationid = $product->classification_id;
+ my $allows_unconfirmed = $product->allows_unconfirmed;
=head1 DESCRIPTION