summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
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) = @_;