EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
Ref
Yuriif82811d83f9d
diff --git a/application/Espo/Tools/FieldManager/FieldManager.php b/application/Espo/Tools/FieldManager/FieldManager.phpindex 937e9d8f1f..8f501c6783 100644--- a/application/Espo/Tools/FieldManager/FieldManager.php+++ b/application/Espo/Tools/FieldManager/FieldManager.php@@ -147,13 +147,7 @@ class FieldManager);}- if (- str_ends_with($name, 'Id') && $this->nameUtil->linkExists($scope, substr($name, 0, -2)) ||- str_ends_with($name, 'Name') && $this->nameUtil->linkExists($scope, substr($name, 0, -4)) ||- str_ends_with($name, 'Ids') && $this->nameUtil->linkExists($scope, substr($name, 0, -3)) ||- str_ends_with($name, 'Names') && $this->nameUtil->linkExists($scope, substr($name, 0, -5)) ||- str_ends_with($name, 'Type') && $this->nameUtil->linkExists($scope, substr($name, 0, -4))- ) {+ if ($this->checkLinkAttributeConflict($scope, $name)) {throw Conflict::createWithBody("namingFieldLinkConflict",Error\Body::create()@@ -830,7 +824,7 @@ class FieldManager*/private function normalizeDefs(string $scope, string $fieldName, array $fieldDefs): stdClass{- $defs = new stdClass();+ $defs = (object) [];$normalizedFieldDefs = $this->prepareFieldDefs($scope, $fieldName, $fieldDefs);@@ -956,4 +950,15 @@ class FieldManagerreturn true;}+++ private function checkLinkAttributeConflict(string $scope, string $name): bool+ {+ return+ str_ends_with($name, 'Id') && $this->nameUtil->linkExists($scope, substr($name, 0, - 2)) ||+ str_ends_with($name, 'Name') && $this->nameUtil->linkExists($scope, substr($name, 0, - 4)) ||+ str_ends_with($name, 'Ids') && $this->nameUtil->linkExists($scope, substr($name, 0, - 3)) ||+ str_ends_with($name, 'Names') && $this->nameUtil->linkExists($scope, substr($name, 0, - 5)) ||+ str_ends_with($name, 'Type') && $this->nameUtil->linkExists($scope, substr($name, 0, - 4));+ }}