diff --git a/entity/AddAttributesToSelection_entity/AddAttributesToSelection_entity.aod b/entity/AddAttributesToSelection_entity/AddAttributesToSelection_entity.aod index ba03529bd3ea2f1eb5a4ee098d6f97f5bd49c91f..4fd2c4165465a670f1653122fd639795f087df9f 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 fe136ec30bdf4885bfb0c7160cdde9abccb011de..8a8b23ca6e41d5f262b6e6e9d5d47ddb8f0d2c56 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 edb6682c34d50bd2d6e6bd64005b73bba56dabf9..c77acc54f8a1222a0784227ce9bc040e0eee7d06 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 e5596b6cbfc0ef48d5d008c33b233cf78b84a4f6..f79e4d3d548b181bf63dd9098ca8584d5db05c81 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"]; + }); } /**