diff options
author | Frédéric Guillot <fred@kanboard.net> | 2014-09-23 20:16:07 +0200 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2014-09-23 20:16:07 +0200 |
commit | a5337cfe5c688c8b7bc91135af47cbafe7c0527d (patch) | |
tree | b8bf6d0510fec83b18dfe500572a042ac4ba703b /app/Model/TaskValidator.php | |
parent | dd7579e5a809de9f4c5fe151800bd7ca514af3dc (diff) |
Move task edit form to the task layout
Diffstat (limited to 'app/Model/TaskValidator.php')
-rw-r--r-- | app/Model/TaskValidator.php | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/app/Model/TaskValidator.php b/app/Model/TaskValidator.php index 461c03d4..1c7b0b14 100644 --- a/app/Model/TaskValidator.php +++ b/app/Model/TaskValidator.php @@ -79,7 +79,7 @@ class TaskValidator extends Base } /** - * Validate task modification + * Validate task modification (form) * * @access public * @param array $values Form values @@ -89,6 +89,28 @@ class TaskValidator extends Base { $rules = array( new Validators\Required('id', t('The id is required')), + new Validators\Required('title', t('The title is required')), + ); + + $v = new Validator($values, array_merge($rules, $this->commonValidationRules())); + + return array( + $v->execute(), + $v->getErrors() + ); + } + + /** + * Validate task modification (Api) + * + * @access public + * @param array $values Form values + * @return array $valid, $errors [0] = Success or not, [1] = List of errors + */ + public function validateApiModification(array $values) + { + $rules = array( + new Validators\Required('id', t('The id is required')), ); $v = new Validator($values, array_merge($rules, $this->commonValidationRules())); |