opensupports/server/libs/validations/validDepartmentName.php
Guillermo Giuliana 0df57af11e
[DEV-187] Fix duplicated-department-names bug (#1083)
* fix apidoc

* add new custom validation

* add ruby tests

* add frontend error

* take out the ternary
2021-11-24 14:21:16 -03:00

14 lines
278 B
PHP

<?php
namespace CustomValidations;
use Respect\Validation\Rules\AbstractRule;
class ValidDepartmentName extends AbstractRule {
public function validate($name) {
$department = \Department::getDataStore($name, 'name');
return $department->isNull();
}
}