mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 06:56:05 +00:00
Merge branch 'master' of ssh://172.20.0.1/var/git/espo/backend
This commit is contained in:
@@ -258,6 +258,7 @@ class FieldManager
|
||||
}
|
||||
|
||||
$entityDefs = $this->normalizeDefs($scope, $name, $fieldDefs);
|
||||
|
||||
if (!empty($entityDefs)) {
|
||||
$this->getMetadata()->set('entityDefs', $scope, $entityDefs);
|
||||
$metadataToBeSaved = true;
|
||||
@@ -321,7 +322,6 @@ class FieldManager
|
||||
'dynamicLogic.options.' . $name
|
||||
]);
|
||||
|
||||
|
||||
$res = $this->getMetadata()->save();
|
||||
$this->deleteLabel($scope, $name);
|
||||
|
||||
@@ -487,10 +487,11 @@ class FieldManager
|
||||
$defs = array();
|
||||
|
||||
$currentFieldDefs = (array) $this->getFieldDefs($scope, $fieldName);
|
||||
$normalizedFieldDefs = Util::arrayDiff($currentFieldDefs, $fieldDefs);
|
||||
if (!empty($normalizedFieldDefs)) {
|
||||
|
||||
$diffFieldDefs = $this->getDiffDefs($currentFieldDefs, $fieldDefs);
|
||||
if (!empty($diffFieldDefs)) {
|
||||
$defs['fields'] = array(
|
||||
$fieldName => $normalizedFieldDefs,
|
||||
$fieldName => $diffFieldDefs,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -512,6 +513,32 @@ class FieldManager
|
||||
return $defs;
|
||||
}
|
||||
|
||||
protected function getDiffDefs($defs, $newDefs)
|
||||
{
|
||||
$diff = array();
|
||||
|
||||
foreach ($newDefs as $optionName => $data) {
|
||||
if (!array_key_exists($optionName, $defs)) {
|
||||
$diff[$optionName] = $data;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (is_object($data) || is_array($data)) {
|
||||
$value = $this->getDiffDefs($defs[$optionName], $data);
|
||||
if (!empty($value)) {
|
||||
$diff[$optionName] = $value;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($data !== $defs[$optionName]) {
|
||||
$diff[$optionName] = $data;
|
||||
}
|
||||
}
|
||||
|
||||
return $diff;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if changed metadata defenition for a field except 'label'
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user