diff --git a/entity/Employee_entity/grantDeleteProcess.js b/entity/Employee_entity/grantDeleteProcess.js index e1d6c3c3c66520301af7fcc8215b6c040af0b123..d817b2a09effbf52d467ced477cffc4f62d4e29d 100644 --- a/entity/Employee_entity/grantDeleteProcess.js +++ b/entity/Employee_entity/grantDeleteProcess.js @@ -2,5 +2,16 @@ import("Employee_lib"); import("Document_lib"); import("system.vars"); import("system.result"); -// TODO: Commented because of performance problems: in Filter view this Process is called for every row. Waiting for bugfix -//result.string(!DocumentUtil.hasDocuments("EMPLOYEE", null, EmployeeUtils.sliceUserId(vars.get("$field.UID")))); \ No newline at end of file + +var res = false; + +//the current user should not delete himself +if (EmployeeUtils.getCurrentUserName() != vars.get("$field.TITLE") + && !EmployeeUtils.hasRelations(vars.get("$field.CONTACT_ID")) + && !DocumentUtil.hasDocuments("EMPLOYEE", null, EmployeeUtils.sliceUserId(vars.get("$field.UID"))) + ) +{ + res = true; +} + +result.string(res); \ No newline at end of file diff --git a/entity/Employee_entity/recordcontainers/jdito/onDelete.js b/entity/Employee_entity/recordcontainers/jdito/onDelete.js index 212b6d23132d934d2e7169624a2607b58d99a2e0..ab759edc01f99d49bbc901935e5d0805b54cfe10 100644 --- a/entity/Employee_entity/recordcontainers/jdito/onDelete.js +++ b/entity/Employee_entity/recordcontainers/jdito/onDelete.js @@ -3,6 +3,6 @@ import("system.vars"); import("system.tools"); import("Employee_lib"); -//TODO: the current user should not delete himself, put this condition in grantDelete when available +//the current user should not delete himself if (EmployeeUtils.getCurrentUserName() != vars.get("$field.TITLE") && !EmployeeUtils.hasRelations(vars.get("$field.CONTACT_ID"))) tools.deleteUser(vars.get("$field.TITLE")); \ No newline at end of file diff --git a/process/IncomingCallExecutor_lib/process.js b/process/IncomingCallExecutor_lib/process.js index 7348d5e682d51bc1c48a206e105595fc80514d40..307f4e456b1fb0fbb1d493dc15db8b9c86acdce5 100644 --- a/process/IncomingCallExecutor_lib/process.js +++ b/process/IncomingCallExecutor_lib/process.js @@ -288,7 +288,7 @@ IncomingCallExecutor._getContactsFromNumber = function(pNumber, pContactIds) .join("ORGANISATION", "ORGANISATION.ORGANISATIONID = CONTACT.ORGANISATION_ID") .leftJoin("PERSON", "CONTACT.PERSON_ID = PERSON.PERSONID") .where("CONTACT.STATUS", $KeywordRegistry.contactStatus$active()) - .and("CONTACT.CONTACTID", pContactIds, SqlBuilder.IN()) + .and("CONTACT.CONTACTID", contactIds, SqlBuilder.IN()) .table(); //map to the result how the entities-methods would return it to have less effort later when the mentioned ticket is done