diff --git a/plugins/contact-resources/src/index.ts b/plugins/contact-resources/src/index.ts index 85a8753b40..e21c625418 100644 --- a/plugins/contact-resources/src/index.ts +++ b/plugins/contact-resources/src/index.ts @@ -104,7 +104,8 @@ async function queryContact ( search: string, filter?: { in?: RelatedDocument[], nin?: RelatedDocument[] } ): Promise<ObjectSearchResult[]> { - const q: DocumentQuery<Contact> = { name: { $like: `%${search}%` } } + let q: DocumentQuery<Contact> = { name: { $like: `%${search}%` } } + if (_class === contact.class.Employee) q = { ...q, active: true } if (filter?.in !== undefined || filter?.nin !== undefined) { q._id = {} if (filter.in !== undefined) {