diff options
author | Frédéric Guillot <fred@kanboard.net> | 2014-10-11 21:11:10 -0400 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2014-10-11 21:11:10 -0400 |
commit | acba6839a6082e3e3800a733f8baea7c843fc02e (patch) | |
tree | e2847dcd13d9ccc3d8f0f6f936a5776df852e11b /app/Model/TaskValidator.php | |
parent | a8418afdebe92dde495bc5010645779c73939b7b (diff) |
Add 3 new fields for tasks: start date, time estimated and time spent
Diffstat (limited to 'app/Model/TaskValidator.php')
-rw-r--r-- | app/Model/TaskValidator.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/app/Model/TaskValidator.php b/app/Model/TaskValidator.php index 1c7b0b14..816008cf 100644 --- a/app/Model/TaskValidator.php +++ b/app/Model/TaskValidator.php @@ -31,6 +31,9 @@ class TaskValidator extends Base new Validators\Integer('category_id', t('This value must be an integer')), new Validators\MaxLength('title', t('The maximum length is %d characters', 200), 200), new Validators\Date('date_due', t('Invalid date'), $this->dateParser->getDateFormats()), + new Validators\Date('date_started', t('Invalid date'), $this->dateParser->getDateFormats()), + new Validators\Numeric('time_spent', t('This value must be numeric')), + new Validators\Numeric('time_estimated', t('This value must be numeric')), ); } @@ -189,4 +192,25 @@ class TaskValidator extends Base $v->getErrors() ); } + + /** + * Validate time tracking modification (form) + * + * @access public + * @param array $values Form values + * @return array $valid, $errors [0] = Success or not, [1] = List of errors + */ + public function validateTimeModification(array $values) + { + $rules = array( + new Validators\Required('id', t('The id is required')), + ); + + $v = new Validator($values, array_merge($rules, $this->commonValidationRules())); + + return array( + $v->execute(), + $v->getErrors() + ); + } } |