diff options
Diffstat (limited to 'Bugzilla/Object.pm')
-rw-r--r-- | Bugzilla/Object.pm | 8 |
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. |