This commit is contained in:
Yuri Kuznetsov
2020-09-14 11:55:58 +03:00
parent ac8debbb4b
commit 4ab2ee875e
@@ -64,12 +64,15 @@ class Task extends \Espo\Core\Repositories\Event
if ($parentId && $parentType) {
if ($this->getEntityManager()->hasRepository($parentType)) {
$columnList = ['id', 'name'];
if ($this->getEntityManager()->getMetadata()->get($parentType, ['fields', 'accountId'])) {
$columnList[] = 'accountId';
}
if ($this->getEntityManager()->getMetadata()->get($parentType, ['fields', 'contactId'])) {
$columnList[] = 'contactId';
}
if ($parentType === 'Lead') {
$columnList[] = 'status';
$columnList[] = 'createdAccountId';
@@ -77,7 +80,12 @@ class Task extends \Espo\Core\Repositories\Event
$columnList[] = 'createdContactId';
$columnList[] = 'createdContactName';
}
$parent = $this->getEntityManager()->getRepository($parentType)->select($columnList)->get($parentId);
$parent = $this->getEntityManager()
->getRepository($parentType)
->select($columnList)
->where(['id' => $parentId])
->findOne();
}
}