summaryrefslogtreecommitdiffstats
path: root/Bugzilla
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
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')
-rw-r--r--Bugzilla/CGI.pm8
-rw-r--r--Bugzilla/Field/Choice.pm21
2 files changed, 28 insertions, 1 deletions
diff --git a/Bugzilla/CGI.pm b/Bugzilla/CGI.pm
index 75b7f18d7..00f23c393 100644
--- a/Bugzilla/CGI.pm
+++ b/Bugzilla/CGI.pm
@@ -329,6 +329,14 @@ sub _fix_utf8 {
return $input;
}
+sub should_set {
+ my ($self, $param) = @_;
+ my $set = (defined $self->param($param)
+ or defined $self->param("defined_$param"))
+ ? 1 : 0;
+ return $set;
+}
+
# The various parts of Bugzilla which create cookies don't want to have to
# pass them around to all of the callers. Instead, store them locally here,
# and then output as required from |header|.
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) = @_;