summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Bug.pm
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2006-09-09 08:11:40 +0200
committerlpsolit%gmail.com <>2006-09-09 08:11:40 +0200
commita806b298f5bfe5914f27a1419d27366fe59da449 (patch)
tree25d737aeb60f17360de9a67f2017369a4d5d8349 /Bugzilla/Bug.pm
parent27c1be36a3cbc57e01c8d51af85be76b0748ece6 (diff)
downloadbugzilla-a806b298f5bfe5914f27a1419d27366fe59da449.tar.gz
bugzilla-a806b298f5bfe5914f27a1419d27366fe59da449.tar.xz
Bug 287326: Ability to add custom single-select fields to a bug - Patch by Frédéric Buclin <LpSolit@gmail.com> and Max Kanat-Alexander <mkanat@bugzilla.org> r=mkanat a=myk
Diffstat (limited to 'Bugzilla/Bug.pm')
-rwxr-xr-xBugzilla/Bug.pm46
1 files changed, 31 insertions, 15 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index 03a28bf5d..6e8079d27 100755
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -110,20 +110,30 @@ use constant REQUIRED_CREATE_FIELDS => qw(
# There are also other, more complex validators that are called
# from run_create_validators.
-use constant VALIDATORS => {
- alias => \&_check_alias,
- bug_file_loc => \&_check_bug_file_loc,
- bug_severity => \&_check_bug_severity,
- cc => \&_check_cc,
- deadline => \&_check_deadline,
- estimated_time => \&_check_estimated_time,
- op_sys => \&_check_op_sys,
- priority => \&_check_priority,
- product => \&_check_product,
- remaining_time => \&_check_remaining_time,
- rep_platform => \&_check_rep_platform,
- short_desc => \&_check_short_desc,
- status_whiteboard => \&_check_status_whiteboard,
+sub VALIDATORS {
+ my $validators = {
+ alias => \&_check_alias,
+ bug_file_loc => \&_check_bug_file_loc,
+ bug_severity => \&_check_bug_severity,
+ cc => \&_check_cc,
+ deadline => \&_check_deadline,
+ estimated_time => \&_check_estimated_time,
+ op_sys => \&_check_op_sys,
+ priority => \&_check_priority,
+ product => \&_check_product,
+ remaining_time => \&_check_remaining_time,
+ rep_platform => \&_check_rep_platform,
+ short_desc => \&_check_short_desc,
+ status_whiteboard => \&_check_status_whiteboard,
+ };
+
+ my @select_fields = Bugzilla->get_fields({custom => 1, obsolete => 0,
+ type => FIELD_TYPE_SINGLE_SELECT});
+
+ foreach my $field (@select_fields) {
+ $validators->{$field->name} = \&_check_select_field;
+ }
+ return $validators;
};
# Used in LogActivityEntry(). Gives the max length of lines in the
@@ -279,7 +289,7 @@ sub run_create_validators {
$params->{remaining_time} = $params->{estimated_time};
$class->_check_strict_isolation($product, $params->{cc},
- $params->{assigned_to}, $params->{qa_contact});
+ $params->{assigned_to}, $params->{qa_contact});
return $params;
}
@@ -657,6 +667,12 @@ sub _check_version {
return $version;
}
+sub _check_select_field {
+ my ($invocant, $value, $field) = @_;
+ $value = trim($value);
+ check_field($field, $value);
+ return $value;
+}
#####################################################################
# Class Accessors