summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorghendricks%novell.com <>2009-07-18 00:40:09 +0200
committerghendricks%novell.com <>2009-07-18 00:40:09 +0200
commite394756f42902de5eade4f6738127c25fa2bcef7 (patch)
treebbb29b8118eb619d791ea4605207befa1a076692 /Bugzilla
parentf304db03fdb9c7ad5c814700f048bb9061131cd3 (diff)
downloadbugzilla-e394756f42902de5eade4f6738127c25fa2bcef7.tar.gz
bugzilla-e394756f42902de5eade4f6738127c25fa2bcef7.tar.xz
Bug 456743 - Add the ability to disable field values (mark them as inactive)
patch by ghendricks@novell.com r=LpSolit, a=LpSolit
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Field.pm9
-rw-r--r--Bugzilla/Field/Choice.pm12
2 files changed, 17 insertions, 4 deletions
diff --git a/Bugzilla/Field.pm b/Bugzilla/Field.pm
index 1cc89239e..a71afef35 100644
--- a/Bugzilla/Field.pm
+++ b/Bugzilla/Field.pm
@@ -15,6 +15,7 @@
# Contributor(s): Dan Mosedale <dmose@mozilla.org>
# Frédéric Buclin <LpSolit@gmail.com>
# Myk Melez <myk@mozilla.org>
+# Greg Hendricks <ghendricks@novell.com>
=head1 NAME
@@ -1033,8 +1034,14 @@ sub check_field {
my $dbh = Bugzilla->dbh;
# If $legalsRef is undefined, we use the default valid values.
+ # Valid values for this check are all possible values.
+ # Using get_legal_values would only return active values, but since
+ # some bugs may have inactive values set, we want to check them too.
unless (defined $legalsRef) {
- $legalsRef = get_legal_field_values($name);
+ $legalsRef = Bugzilla::Field->new({name => $name})->legal_values;
+ my @values = map($_->name, @$legalsRef);
+ $legalsRef = \@values;
+
}
if (!defined($value)
diff --git a/Bugzilla/Field/Choice.pm b/Bugzilla/Field/Choice.pm
index f23b0c46d..ce1020d6b 100644
--- a/Bugzilla/Field/Choice.pm
+++ b/Bugzilla/Field/Choice.pm
@@ -17,6 +17,7 @@
# The Original Code is the Bugzilla Bug Tracking System.
#
# Contributor(s): Max Kanat-Alexander <mkanat@bugzilla.org>
+# Greg Hendricks <ghendricks@novell.com>
use strict;
@@ -40,12 +41,14 @@ use constant DB_COLUMNS => qw(
id
value
sortkey
+ isactive
visibility_value_id
);
use constant UPDATE_COLUMNS => qw(
value
sortkey
+ isactive
visibility_value_id
);
@@ -58,6 +61,7 @@ use constant VALIDATORS => {
value => \&_check_value,
sortkey => \&_check_sortkey,
visibility_value_id => \&_check_visibility_value_id,
+ isactive => \&Bugzilla::Object::check_boolean,
};
use constant CLASS_MAP => {
@@ -211,7 +215,8 @@ sub _check_if_controller {
# Accessors #
#############
-sub sortkey { return $_[0]->{'sortkey'}; }
+sub is_active { return $_[0]->{'isactive'}; }
+sub sortkey { return $_[0]->{'sortkey'}; }
sub bug_count {
my $self = shift;
@@ -301,8 +306,9 @@ sub controlled_values {
# Mutators #
############
-sub set_name { $_[0]->set('value', $_[1]); }
-sub set_sortkey { $_[0]->set('sortkey', $_[1]); }
+sub set_is_active { $_[0]->set('isactive', $_[1]); }
+sub set_name { $_[0]->set('value', $_[1]); }
+sub set_sortkey { $_[0]->set('sortkey', $_[1]); }
sub set_visibility_value {
my ($self, $value) = @_;
$self->set('visibility_value_id', $value);