From e044d34abd72c2f86ed37d6622e117dfd7dafd98 Mon Sep 17 00:00:00 2001 From: yuri Date: Thu, 12 Nov 2015 10:37:20 +0200 Subject: [PATCH] entity manager: dont allow to change linkMultipleField if not custom --- application/Espo/Core/Utils/EntityManager.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/application/Espo/Core/Utils/EntityManager.php b/application/Espo/Core/Utils/EntityManager.php index bbd897d872..34c16b19fb 100644 --- a/application/Espo/Core/Utils/EntityManager.php +++ b/application/Espo/Core/Utils/EntityManager.php @@ -475,7 +475,11 @@ class EntityManager throw new Error(); } - if ($this->getMetadata()->get("entityDefs.{$entity}.links.{$link}.type") == 'hasMany') { + if ( + $this->getMetadata()->get("entityDefs.{$entity}.links.{$link}.type") == 'hasMany' + && + $this->getMetadata()->get("entityDefs.{$entity}.links.{$link}.isCustom") + ) { if (array_key_exists('linkMultipleField', $params)) { $linkMultipleField = $params['linkMultipleField']; $dataLeft = array( @@ -496,7 +500,11 @@ class EntityManager } } - if ($this->getMetadata()->get("entityDefs.{$entityForeign}.links.{$linkForeign}.type") == 'hasMany') { + if ( + $this->getMetadata()->get("entityDefs.{$entityForeign}.links.{$linkForeign}.type") == 'hasMany' + && + $this->getMetadata()->get("entityDefs.{$entityForeign}.links.{$linkForeign}.isCustom") + ) { if (array_key_exists('linkMultipleFieldForeign', $params)) { $linkMultipleFieldForeign = $params['linkMultipleFieldForeign']; $dataRight = array(