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 } })