From 542d78425cac2818ea053c52ffd57e6d3f4e69fc Mon Sep 17 00:00:00 2001 From: yuri Date: Wed, 16 Oct 2019 15:39:23 +0300 Subject: [PATCH] fix email address lookup --- application/Espo/Services/EmailAddress.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/application/Espo/Services/EmailAddress.php b/application/Espo/Services/EmailAddress.php index fddd247c38..08a126ae50 100644 --- a/application/Espo/Services/EmailAddress.php +++ b/application/Espo/Services/EmailAddress.php @@ -67,8 +67,15 @@ class EmailAddress extends Record $selectManager = $this->getSelectManagerFactory()->create($entityType); $selectManager->applyAccess($selectParams); + $select = ['id', 'emailAddress', 'name']; + + if ($this->getMetadata()->get(['entityDefs', $entityType, 'fields', 'name', 'type']) === 'personName') { + $select[] = 'firstName'; + $select[] = 'lastName'; + } + $collection = $this->getEntityManager()->getRepository($entityType) - ->select(['id', 'emailAddress', 'name']) + ->select($select) ->find($selectParams); foreach ($collection as $entity) {