From 7b3f940a17f408f92b4aeaf1a64e7af15fa879e8 Mon Sep 17 00:00:00 2001 From: Sascha Schmidt <s.schmidt@adito.de> Date: Wed, 27 Oct 2021 11:51:42 +0200 Subject: [PATCH] =?UTF-8?q?[Projekt:=20xRM-ContactManagement][TicketNr.:?= =?UTF-8?q?=202001171][Serienaktion=20Eigenschaften=20setzen=20in=20Aktivi?= =?UTF-8?q?t=C3=A4t=20fehlerhaft]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AddAttributesToSelection_entity.aod | 1 + .../recordcontainers/jdito/contentProcess.js | 2 +- .../AddAttributesToSelectionEdit_view.aod | 9 ++ process/FilterViewAction_lib/process.js | 129 +++++++++--------- 4 files changed, 75 insertions(+), 66 deletions(-) diff --git a/entity/AddAttributesToSelection_entity/AddAttributesToSelection_entity.aod b/entity/AddAttributesToSelection_entity/AddAttributesToSelection_entity.aod index ba03529bd3e..4fd2c416546 100644 --- a/entity/AddAttributesToSelection_entity/AddAttributesToSelection_entity.aod +++ b/entity/AddAttributesToSelection_entity/AddAttributesToSelection_entity.aod @@ -15,6 +15,7 @@ </entityProvider> <entityField> <name>UID</name> + <state>INVISIBLE</state> </entityField> <entityField> <name>affectedData</name> diff --git a/entity/AddAttributesToSelection_entity/recordcontainers/jdito/contentProcess.js b/entity/AddAttributesToSelection_entity/recordcontainers/jdito/contentProcess.js index fe136ec30bd..8a8b23ca6e4 100644 --- a/entity/AddAttributesToSelection_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/AddAttributesToSelection_entity/recordcontainers/jdito/contentProcess.js @@ -3,5 +3,5 @@ import("system.vars"); if(vars.get("$local.idvalues")) { -result.object([vars.get("$local.idvalues")]); + result.object([vars.get("$local.idvalues")]); } \ No newline at end of file diff --git a/neonView/AddAttributesToSelectionEdit_view/AddAttributesToSelectionEdit_view.aod b/neonView/AddAttributesToSelectionEdit_view/AddAttributesToSelectionEdit_view.aod index edb6682c34d..c77acc54f8a 100644 --- a/neonView/AddAttributesToSelectionEdit_view/AddAttributesToSelectionEdit_view.aod +++ b/neonView/AddAttributesToSelectionEdit_view/AddAttributesToSelectionEdit_view.aod @@ -19,6 +19,15 @@ </entityFieldLink> </fields> </scoreCardViewTemplate> + <genericViewTemplate> + <name>tst</name> + <fields> + <entityFieldLink> + <name>6938d0f4-c4a6-4caf-9fd0-eb082f01d9af</name> + <entityField>UID</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> <neonViewReference> <name>3f715b52-ef4b-4b62-916c-0a23833bc2da</name> <entityField>AddAttributeToSelectionMultiEdit</entityField> diff --git a/process/FilterViewAction_lib/process.js b/process/FilterViewAction_lib/process.js index e5596b6cbfc..f79e4d3d548 100644 --- a/process/FilterViewAction_lib/process.js +++ b/process/FilterViewAction_lib/process.js @@ -1,4 +1,3 @@ -import("system.logging"); import("Util_lib"); import("system.neon"); import("Sql_lib"); @@ -24,70 +23,70 @@ function FilterViewActionUtils() {} FilterViewActionUtils.getUidsByEntityFilter = function (pContext, pFilter, pParameters) { if (Utils.isString(pFilter)) - { - pFilter = JSON.parse(pFilter); - } - if (Utils.isString(pParameters)) - { - pParameters = JSON.parse(pParameters); - } - - //uids from Person and Organisation are loaded with simple sql queries because that's much faster than over the entity' - //TODO: design modular + filter recipe - if (pContext == "Person" && "condition" in pFilter) - { - return new SqlBuilder() - .selectDistinct("CONTACT.CONTACTID") - .from("PERSON") - .join("CONTACT", "CONTACT.PERSON_ID = PERSON.PERSONID") - .join("ORGANISATION", "ORGANISATION.ORGANISATIONID = CONTACT.ORGANISATION_ID") - .leftJoin("ADDRESS", "ADDRESS.ADDRESSID = CONTACT.ADDRESS_ID") - .whereIfSet(pFilter.condition) - .arrayColumn(); - } - if (pContext == "Organisation" && "condition" in pFilter) - { - return new SqlBuilder() - .selectDistinct("CONTACT.CONTACTID") - .from("ORGANISATION") - .join("CONTACT", newWhere("ORGANISATION.ORGANISATIONID = CONTACT.ORGANISATION_ID").and("CONTACT.PERSON_ID is null")) - .leftJoin("ADDRESS", "ADDRESS.ADDRESSID = CONTACT.ADDRESS_ID") - .leftJoin("CLASSIFICATIONSTORAGE", "CLASSIFICATIONSTORAGE.OBJECT_ROWID = CONTACT.CONTACTID") - .whereIfSet(pFilter.condition) - .arrayColumn(); - } - if(pContext == "Activity" && "condition" in pFilter) - { - return new SqlBuilder() - .selectDistinct("ACTIVITY.ACTIVITYID") - .from("ACTIVITY") - .leftJoin("CONTACT", "CONTACT.CONTACTID = ACTIVITY.RESPONSIBLE") - .leftJoin("PERSON", "PERSON.PERSONID = CONTACT.PERSON_ID") - .whereIfSet(pFilter.condition) - .arrayColumn(); - } - - //General solution to get the uids using entities.getRows - var loadRowsConfig = entities.createConfigForLoadingRows() - .entity(ContextUtils.getEntity(pContext)) - .fields(["#UID"]); - - if (Utils.isNullOrEmpty(pFilter.filter)) - { - loadRowsConfig.filter(JSON.stringify(pFilter.filter)); - } - - if(Utils.isNullOrEmpty(pParameters)) - { - Object.keys(pParameters).forEach(function(key){ - loadRowsConfig.addParameter(key, pParameters[key]) - }); - } - - return entities.getRows(loadRowsConfig).map(function (row) - { - return row["#UID"]; - }); + { + pFilter = JSON.parse(pFilter); + } + if (Utils.isString(pParameters)) + { + pParameters = JSON.parse(pParameters); + } + + //uids from Person and Organisation are loaded with simple sql queries because that's much faster than over the entity' + //TODO: design modular + filter recipe + if (pContext == "Person" && "condition" in pFilter) + { + return new SqlBuilder() + .selectDistinct("CONTACT.CONTACTID") + .from("PERSON") + .join("CONTACT", "CONTACT.PERSON_ID = PERSON.PERSONID") + .join("ORGANISATION", "ORGANISATION.ORGANISATIONID = CONTACT.ORGANISATION_ID") + .leftJoin("ADDRESS", "ADDRESS.ADDRESSID = CONTACT.ADDRESS_ID") + .whereIfSet(pFilter.condition) + .arrayColumn(); + } + if (pContext == "Organisation" && "condition" in pFilter) + { + return new SqlBuilder() + .selectDistinct("CONTACT.CONTACTID") + .from("ORGANISATION") + .join("CONTACT", newWhere("ORGANISATION.ORGANISATIONID = CONTACT.ORGANISATION_ID").and("CONTACT.PERSON_ID is null")) + .leftJoin("ADDRESS", "ADDRESS.ADDRESSID = CONTACT.ADDRESS_ID") + .leftJoin("CLASSIFICATIONSTORAGE", "CLASSIFICATIONSTORAGE.OBJECT_ROWID = CONTACT.CONTACTID") + .whereIfSet(pFilter.condition) + .arrayColumn(); + } + if(pContext == "Activity" && "condition" in pFilter) + { + return new SqlBuilder() + .selectDistinct("ACTIVITY.ACTIVITYID") + .from("ACTIVITY") + .leftJoin("CONTACT", "CONTACT.CONTACTID = ACTIVITY.RESPONSIBLE") + .leftJoin("PERSON", "PERSON.PERSONID = CONTACT.PERSON_ID") + .whereIfSet(pFilter.condition) + .arrayColumn(); + } + + //General solution to get the uids using entities.getRows + var loadRowsConfig = entities.createConfigForLoadingRows() + .entity(ContextUtils.getEntity(pContext)) + .fields(["#UID"]); + + if (Utils.isNullOrEmpty(pFilter.filter)) + { + loadRowsConfig.filter(JSON.stringify(pFilter.filter)); + } + + if(Utils.isNullOrEmpty(pParameters)) + { + Object.keys(pParameters).forEach(function(key){ + loadRowsConfig.addParameter(key, pParameters[key]) + }); + } + + return entities.getRows(loadRowsConfig).map(function (row) + { + return row["#UID"]; + }); } /** -- GitLab