summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Object.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/Object.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/Object.pm')
-rw-r--r--Bugzilla/Object.pm8
1 files changed, 6 insertions, 2 deletions
diff --git a/Bugzilla/Object.pm b/Bugzilla/Object.pm
index 8de20d5f3..5d80a9d0f 100644
--- a/Bugzilla/Object.pm
+++ b/Bugzilla/Object.pm
@@ -17,6 +17,7 @@
# Everything Solved. All Rights Reserved.
#
# Contributor(s): Max Kanat-Alexander <mkanat@bugzilla.org>
+# Frédéric Buclin <LpSolit@gmail.com>
use strict;
@@ -136,7 +137,7 @@ sub set {
my $validators = $self->VALIDATORS;
if (exists $validators->{$field}) {
my $validator = $validators->{$field};
- $value = $self->$validator($value);
+ $value = $self->$validator($value, $field);
}
$self->{$field} = $value;
@@ -196,7 +197,7 @@ sub run_create_validators {
my $value;
if (exists $validators->{$field}) {
my $validator = $validators->{$field};
- $value = $class->$validator($params->{$field});
+ $value = $class->$validator($params->{$field}, $field);
}
else {
$value = $params->{$field};
@@ -328,6 +329,9 @@ a reference to the current object (what we normally call C<$self>).
The second argument will be the value passed to L</create> or
L</set>for that field.
+The third argument will be the name of the field being validated.
+This may be required by validators which validate several distinct fields.
+
These functions should call L<Bugzilla::Error/ThrowUserError> if they fail.
The validator must return the validated value.