EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
overridden typed validator honor validation value
Yuri Kuznetsov575a63b22c67
diff --git a/application/Espo/Core/FieldValidation/FieldValidationManager.php b/application/Espo/Core/FieldValidation/FieldValidationManager.phpindex 45042d58c2..f60722bbe4 100644--- a/application/Espo/Core/FieldValidation/FieldValidationManager.php+++ b/application/Espo/Core/FieldValidation/FieldValidationManager.php@@ -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 FieldValidationManagerreturn 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);