From 8fb6b1a5a99d2b8933b5d3fbbdcd214e1b4e2277 Mon Sep 17 00:00:00 2001 From: yuri Date: Tue, 27 Feb 2018 14:12:48 +0200 Subject: [PATCH] fix parent name load --- application/Espo/Core/ORM/Entity.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/application/Espo/Core/ORM/Entity.php b/application/Espo/Core/ORM/Entity.php index f9b289912f..0786fac195 100644 --- a/application/Espo/Core/ORM/Entity.php +++ b/application/Espo/Core/ORM/Entity.php @@ -52,7 +52,13 @@ class Entity extends \Espo\ORM\Entity if (!$this->entityManager->hasRepository($parentType)) return; $repository = $this->entityManager->getRepository($parentType); - $foreignEntity = $repository->select(['id', 'name'])->where(['id' => $parentId])->findOne(); + $select = ['id', 'name']; + if ($parentType === 'Lead') { + $select[] = 'accountName'; + $select[] = 'emailAddress'; + $select[] = 'phoneNumber'; + } + $foreignEntity = $repository->select($select)->where(['id' => $parentId])->findOne(); if ($foreignEntity) { $this->set($field . 'Name', $foreignEntity->get('name')); }