diff options
Diffstat (limited to 'app/Validator/TaskValidator.php')
-rw-r--r-- | app/Validator/TaskValidator.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/app/Validator/TaskValidator.php b/app/Validator/TaskValidator.php index 7ca377d9..f9441c8b 100644 --- a/app/Validator/TaskValidator.php +++ b/app/Validator/TaskValidator.php @@ -204,4 +204,27 @@ class TaskValidator extends BaseValidator $v->getErrors() ); } + + /** + * Validate task email creation + * + * @access public + * @param array $values Required parameters to save an action + * @return array $valid, $errors [0] = Success or not, [1] = List of errors + */ + public function validateEmailCreation(array $values) + { + $rules = array( + new Validators\Required('subject', t('This field is required')), + new Validators\Required('email', t('This field is required')), + new Validators\Email('email', t('Email address invalid')), + ); + + $v = new Validator($values, $rules); + + return array( + $v->execute(), + $v->getErrors() + ); + } } |