summaryrefslogtreecommitdiff
path: root/app/Validator
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-01-02 17:01:27 -0500
committerFrederic Guillot <fred@kanboard.net>2017-01-02 17:01:27 -0500
commit3833c12ccce59bcc49c4cfa892401973558f604d (patch)
treeb67b0e10cdc3d42e5626f728206138a444a40ed0 /app/Validator
parentd49ce63e51f596ad3bf0d02b689aea673cf544f8 (diff)
Refactoring/rewrite of modal boxes handling
Diffstat (limited to 'app/Validator')
-rw-r--r--app/Validator/ProjectValidator.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/app/Validator/ProjectValidator.php b/app/Validator/ProjectValidator.php
index 8c6117a4..5b10026c 100644
--- a/app/Validator/ProjectValidator.php
+++ b/app/Validator/ProjectValidator.php
@@ -28,7 +28,6 @@ class ProjectValidator extends BaseValidator
new Validators\Integer('priority_start', t('This value must be an integer')),
new Validators\Integer('priority_end', t('This value must be an integer')),
new Validators\Integer('is_active', t('This value must be an integer')),
- new Validators\NotEmpty('name', t('This field cannot be empty')),
new Validators\MaxLength('name', t('The maximum length is %d characters', 50), 50),
new Validators\MaxLength('identifier', t('The maximum length is %d characters', 50), 50),
new Validators\MaxLength('start_date', t('The maximum length is %d characters', 10), 10),
@@ -47,15 +46,15 @@ class ProjectValidator extends BaseValidator
*/
public function validateCreation(array $values)
{
- $rules = array(
- new Validators\Required('name', t('The project name is required')),
- );
-
if (! empty($values['identifier'])) {
$values['identifier'] = strtoupper($values['identifier']);
}
- $v = new Validator($values, array_merge($this->commonValidationRules(), $rules));
+ $rules = array(
+ new Validators\Required('name', t('The project name is required')),
+ );
+
+ $v = new Validator($values, array_merge($rules, $this->commonValidationRules()));
return array(
$v->execute(),
@@ -77,6 +76,7 @@ class ProjectValidator extends BaseValidator
}
$rules = array(
+ new Validators\NotEmpty('name', t('This field cannot be empty')),
new Validators\Required('id', t('This value is required')),
);