mirror of
https://github.com/espocrm/espocrm.git
synced 2026-03-03 02:27:01 +00:00
overridden typed validator honor validation value
This commit is contained in:
@@ -196,12 +196,6 @@ class FieldValidationManager
|
||||
$data ??= (object) [];
|
||||
$entityType = $entity->getEntityType();
|
||||
|
||||
$result = $this->processValidator($entity, $field, $type, new Data($data));
|
||||
|
||||
if (!$result) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$validationValue = $value ?? $this->fieldUtil->getEntityTypeFieldParam($entityType, $field, $type);
|
||||
$isMandatory = in_array($type, $this->getMandatoryValidationList($entityType, $field));
|
||||
|
||||
@@ -213,12 +207,19 @@ class FieldValidationManager
|
||||
$validationValue = true;
|
||||
}
|
||||
|
||||
$skip = !$isMandatory && (is_null($validationValue) || $validationValue === false);
|
||||
|
||||
if ($skip) {
|
||||
if (
|
||||
!$isMandatory &&
|
||||
($validationValue === null || $validationValue === false)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$result = $this->processTypeValidator($entity, $field, $type, new Data($data));
|
||||
|
||||
if (!$result) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$result1 = $this->processFieldCheck($entityType, $type, $entity, $field, $validationValue);
|
||||
|
||||
if (!$result1) {
|
||||
@@ -234,7 +235,7 @@ class FieldValidationManager
|
||||
return true;
|
||||
}
|
||||
|
||||
private function processValidator(Entity $entity, string $field, string $type, Data $data): bool
|
||||
private function processTypeValidator(Entity $entity, string $field, string $type, Data $data): bool
|
||||
{
|
||||
$validator = $this->getValidator($entity->getEntityType(), $field, $type);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user