summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Field
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-05-14 16:25:05 +0200
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-05-14 16:25:05 +0200
commit7072d6a673f9a05b688d07e05980b7932c7abbe6 (patch)
treea0356451566ff1a744714c8fcadf040cb9b20e2a /Bugzilla/Field
parent80130158d4f4baa47cf1212cf28da1dc84b9d096 (diff)
downloadbugzilla-7072d6a673f9a05b688d07e05980b7932c7abbe6.tar.gz
bugzilla-7072d6a673f9a05b688d07e05980b7932c7abbe6.tar.xz
Bug 561296: A fix allowing updating a field value's name when it is
the default value r=LpSolit, a=LpSolit
Diffstat (limited to 'Bugzilla/Field')
-rw-r--r--Bugzilla/Field/Choice.pm21
1 files changed, 20 insertions, 1 deletions
diff --git a/Bugzilla/Field/Choice.pm b/Bugzilla/Field/Choice.pm
index 95fb4bf82..e4cb4406a 100644
--- a/Bugzilla/Field/Choice.pm
+++ b/Bugzilla/Field/Choice.pm
@@ -61,7 +61,7 @@ use constant VALIDATORS => {
value => \&_check_value,
sortkey => \&_check_sortkey,
visibility_value_id => \&_check_visibility_value_id,
- isactive => \&Bugzilla::Object::check_boolean,
+ isactive => \&_check_isactive,
};
use constant CLASS_MAP => {
@@ -216,6 +216,25 @@ sub set_visibility_value {
# Validators #
##############
+sub _check_isactive {
+ my ($invocant, $value) = @_;
+ $value = Bugzilla::Object::check_boolean($invocant, $value);
+ if (!$value and ref $invocant) {
+ if ($invocant->is_default) {
+ my $field = $invocant->field;
+ ThrowUserError('fieldvalue_is_default',
+ { value => $invocant, field => $field,
+ param_name => $invocant->DEFAULT_MAP->{$field->name}
+ });
+ }
+ if ($invocant->is_static) {
+ ThrowUserError('fieldvalue_not_deletable',
+ { value => $invocant, field => $invocant->field });
+ }
+ }
+ return $value;
+}
+
sub _check_value {
my ($invocant, $value) = @_;