From 1b4a574a1cbf0c99ae1b80b5684d3e137b74c393 Mon Sep 17 00:00:00 2001 From: Denis Bykhov Date: Mon, 5 Feb 2024 20:36:50 +0600 Subject: [PATCH] Fix automation (#4531) Signed-off-by: Denis Bykhov --- server-plugins/contact-resources/src/index.ts | 15 +++++++-------- server-plugins/setting-resources/src/index.ts | 4 ++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/server-plugins/contact-resources/src/index.ts b/server-plugins/contact-resources/src/index.ts index 34c0dc682f..9ace28decf 100644 --- a/server-plugins/contact-resources/src/index.ts +++ b/server-plugins/contact-resources/src/index.ts @@ -19,16 +19,15 @@ import contact, { Contact, Organization, Person, - contactId, - getName, - formatContactName, PersonAccount, + contactId, + formatContactName, formatName, - getLastName, getFirstName, - Employee + getLastName, + getName } from '@hcengineering/contact' -import { Ref, Class, Doc, Tx, TxRemoveDoc, TxUpdateDoc, concatLink, Hierarchy } from '@hcengineering/core' +import { Class, Doc, Hierarchy, Ref, Tx, TxRemoveDoc, TxUpdateDoc, concatLink } from '@hcengineering/core' import notification, { Collaborators } from '@hcengineering/notification' import { getMetadata } from '@hcengineering/platform' import serverCore, { TriggerControl } from '@hcengineering/server-core' @@ -204,9 +203,9 @@ export async function getCurrentEmployeePosition ( _id: control.txFactory.account as Ref }) if (account === undefined) return '' - const employee = (await control.findAll(contact.mixin.Employee, { _id: account.person as Ref }))[0] + const employee = (await control.findAll(contact.class.Person, { _id: account.person }))[0] if (employee !== undefined) { - return employee.position ?? '' + return control.hierarchy.as(employee, contact.mixin.Employee)?.position ?? '' } } diff --git a/server-plugins/setting-resources/src/index.ts b/server-plugins/setting-resources/src/index.ts index 614dc309a8..c747ea2123 100644 --- a/server-plugins/setting-resources/src/index.ts +++ b/server-plugins/setting-resources/src/index.ts @@ -97,8 +97,8 @@ export default async () => ({ IntegrationHTMLPresenter: integrationHTMLPresenter, IntegrationTextPresenter: integrationTextPresenter, GetValue: getValue, - GetFirstName: getFirstName, - GetLastName: getLastName, + GetFirstName: getOwnerFirstName, + GetLastName: getOwnerLastName, GetOwnerPosition: getOwnerPosition } })