diff options
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() + ); + } } |