summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2009-10-24 07:27:20 +0200
committermkanat%bugzilla.org <>2009-10-24 07:27:20 +0200
commit99328846cf347d5fe978d7d674617dd200472d51 (patch)
tree8f7fc5a8dbaed1da2bb337318afb901baece0577
parent0ddb000b0c5280b9a13d9b930ea21ecf546bd5c9 (diff)
downloadbugzilla-99328846cf347d5fe978d7d674617dd200472d51.tar.gz
bugzilla-99328846cf347d5fe978d7d674617dd200472d51.tar.xz
Bug 522428: Bugzilla::Bug->create should be case-insensitive for global select field
Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=LpSolit
-rw-r--r--Bugzilla/Bug.pm46
1 files changed, 10 insertions, 36 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index 326c9d84d..5a7863559 100644
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -122,16 +122,16 @@ sub VALIDATORS {
my $validators = {
alias => \&_check_alias,
bug_file_loc => \&_check_bug_file_loc,
- bug_severity => \&_check_bug_severity,
+ bug_severity => \&_check_select_field,
comment => \&_check_comment,
commentprivacy => \&_check_commentprivacy,
deadline => \&_check_deadline,
estimated_time => \&_check_estimated_time,
- op_sys => \&_check_op_sys,
+ op_sys => \&_check_select_field,
priority => \&_check_priority,
product => \&_check_product,
remaining_time => \&_check_remaining_time,
- rep_platform => \&_check_rep_platform,
+ rep_platform => \&_check_select_field,
short_desc => \&_check_short_desc,
status_whiteboard => \&_check_status_whiteboard,
};
@@ -1077,13 +1077,6 @@ sub _check_bug_file_loc {
return $url;
}
-sub _check_bug_severity {
- my ($invocant, $severity) = @_;
- $severity = trim($severity);
- check_field('bug_severity', $severity);
- return $severity;
-}
-
sub _check_bug_status {
my ($invocant, $new_status, $product, $comment) = @_;
my $user = Bugzilla->user;
@@ -1473,22 +1466,12 @@ sub _check_product {
return new Bugzilla::Product({ name => $name });
}
-sub _check_op_sys {
- my ($invocant, $op_sys) = @_;
- $op_sys = trim($op_sys);
- check_field('op_sys', $op_sys);
- return $op_sys;
-}
-
sub _check_priority {
my ($invocant, $priority) = @_;
if (!ref $invocant && !Bugzilla->params->{'letsubmitterchoosepriority'}) {
$priority = Bugzilla->params->{'defaultpriority'};
}
- $priority = trim($priority);
- check_field('priority', $priority);
-
- return $priority;
+ return $invocant->_check_select_field($priority, 'priority');
}
sub _check_qa_contact {
@@ -1528,13 +1511,6 @@ sub _check_remaining_time {
return $_[0]->_check_time($_[1], 'remaining_time');
}
-sub _check_rep_platform {
- my ($invocant, $platform) = @_;
- $platform = trim($platform);
- check_field('rep_platform', $platform);
- return $platform;
-}
-
sub _check_reporter {
my $invocant = shift;
my $reporter;
@@ -1562,7 +1538,7 @@ sub _check_resolution {
if !$resolution && !$self->status->is_open;
# Make sure this is a valid resolution.
- check_field('resolution', $resolution);
+ $resolution = $self->_check_select_field($resolution, 'resolution');
# Don't allow open bugs to have resolutions.
ThrowUserError('resolution_not_allowed') if $self->status->is_open;
@@ -1752,19 +1728,17 @@ sub _check_freetext_field {
sub _check_multi_select_field {
my ($invocant, $values, $field) = @_;
return [] if !$values;
+ my @checked_values;
foreach my $value (@$values) {
- $value = trim($value);
- check_field($field, $value);
- trick_taint($value);
+ push(@checked_values, $invocant->_check_select_field($value, $field));
}
- return $values;
+ return \@checked_values;
}
sub _check_select_field {
my ($invocant, $value, $field) = @_;
- $value = trim($value);
- check_field($field, $value);
- return $value;
+ my $object = Bugzilla::Field::Choice->type($field)->check($value);
+ return $object->name;
}
sub _check_bugid_field {