From 61e4ffd56f9a80d14c6ae910b0bcaa063dfab941 Mon Sep 17 00:00:00 2001 From: Johannes Hoermann <j.hoermann@adito.de> Date: Mon, 11 Feb 2019 14:15:13 +0100 Subject: [PATCH] Object relation fixes --- entity/Context_entity/Context_entity.aod | 1 + .../recordcontainers/jdito/contentProcess.js | 1 - entity/Context_entity/titleProcess.js | 4 ++++ .../ObjectRelation_entity.aod | 5 +++++ .../object1_rowid/stateProcess.js | 14 ++++++++++++++ .../object1_rowid/valueProcess.js | 16 ++++++++++++++++ .../object1_type/displayValueProcess.js | 18 ++++++++++++++++++ .../entityfields/object1_type/stateProcess.js | 13 +++++++++++++ .../entityfields/object1_type/valueProcess.js | 18 ++++++++++++++++++ .../object2_rowid/stateProcess.js | 12 ++++++++++++ .../object2_rowid/valueProcess.js | 12 ++++++++++++ .../object2_type/displayValueProcess.js | 19 +++++++++++++++++++ .../entityfields/object2_type/stateProcess.js | 10 ++++++++++ .../entityfields/object2_type/valueProcess.js | 12 ++++++++++++ process/Context_lib/process.js | 14 +++++++------- 15 files changed, 161 insertions(+), 8 deletions(-) create mode 100644 entity/Context_entity/titleProcess.js create mode 100644 entity/ObjectRelation_entity/entityfields/object1_rowid/stateProcess.js create mode 100644 entity/ObjectRelation_entity/entityfields/object1_rowid/valueProcess.js create mode 100644 entity/ObjectRelation_entity/entityfields/object1_type/displayValueProcess.js create mode 100644 entity/ObjectRelation_entity/entityfields/object1_type/stateProcess.js create mode 100644 entity/ObjectRelation_entity/entityfields/object1_type/valueProcess.js create mode 100644 entity/ObjectRelation_entity/entityfields/object2_rowid/stateProcess.js create mode 100644 entity/ObjectRelation_entity/entityfields/object2_rowid/valueProcess.js create mode 100644 entity/ObjectRelation_entity/entityfields/object2_type/displayValueProcess.js create mode 100644 entity/ObjectRelation_entity/entityfields/object2_type/stateProcess.js create mode 100644 entity/ObjectRelation_entity/entityfields/object2_type/valueProcess.js diff --git a/entity/Context_entity/Context_entity.aod b/entity/Context_entity/Context_entity.aod index 5348326bb6..c147151db5 100644 --- a/entity/Context_entity/Context_entity.aod +++ b/entity/Context_entity/Context_entity.aod @@ -44,6 +44,7 @@ <entityParameter> <name>ContextId_param</name> <expose v="true" /> + <triggerRecalculation v="true" /> <mandatory v="true" /> </entityParameter> </children> diff --git a/entity/Context_entity/recordcontainers/jdito/contentProcess.js b/entity/Context_entity/recordcontainers/jdito/contentProcess.js index 62ea331949..e0eac16606 100644 --- a/entity/Context_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/Context_entity/recordcontainers/jdito/contentProcess.js @@ -1,7 +1,6 @@ import("system.vars"); import("system.result"); import("system.project"); -import("system.logging"); import("Context_lib"); if (vars.exists("$param.ContextId_param") && vars.get("$param.ContextId_param")) diff --git a/entity/Context_entity/titleProcess.js b/entity/Context_entity/titleProcess.js new file mode 100644 index 0000000000..1733703a2a --- /dev/null +++ b/entity/Context_entity/titleProcess.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string(vars.get("$field.CONTEXT_NAME")) \ No newline at end of file diff --git a/entity/ObjectRelation_entity/ObjectRelation_entity.aod b/entity/ObjectRelation_entity/ObjectRelation_entity.aod index bd8dca518e..92c31b34c5 100644 --- a/entity/ObjectRelation_entity/ObjectRelation_entity.aod +++ b/entity/ObjectRelation_entity/ObjectRelation_entity.aod @@ -23,6 +23,8 @@ <title>Object 1</title> <consumer>Objects1</consumer> <linkedContextProcess>%aditoprj%/entity/ObjectRelation_entity/entityfields/object1_rowid/linkedContextProcess.js</linkedContextProcess> + <stateProcess>%aditoprj%/entity/ObjectRelation_entity/entityfields/object1_rowid/stateProcess.js</stateProcess> + <valueProcess>%aditoprj%/entity/ObjectRelation_entity/entityfields/object1_rowid/valueProcess.js</valueProcess> </entityField> <entityField> <name>AB_OBJECTRELATIONID</name> @@ -32,6 +34,8 @@ <title>Object 2</title> <consumer>Objects2</consumer> <linkedContextProcess>%aditoprj%/entity/ObjectRelation_entity/entityfields/object2_rowid/linkedContextProcess.js</linkedContextProcess> + <stateProcess>%aditoprj%/entity/ObjectRelation_entity/entityfields/object2_rowid/stateProcess.js</stateProcess> + <valueProcess>%aditoprj%/entity/ObjectRelation_entity/entityfields/object2_rowid/valueProcess.js</valueProcess> </entityField> <entityField> <name>OBJECT2_TYPE</name> @@ -40,6 +44,7 @@ <linkedContext>Context_context</linkedContext> <stateProcess>%aditoprj%/entity/ObjectRelation_entity/entityfields/object2_type/stateProcess.js</stateProcess> <valueProcess>%aditoprj%/entity/ObjectRelation_entity/entityfields/object2_type/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/ObjectRelation_entity/entityfields/object2_type/displayValueProcess.js</displayValueProcess> </entityField> <entityParameter> <name>Object1Type_param</name> diff --git a/entity/ObjectRelation_entity/entityfields/object1_rowid/stateProcess.js b/entity/ObjectRelation_entity/entityfields/object1_rowid/stateProcess.js new file mode 100644 index 0000000000..5f470da0cc --- /dev/null +++ b/entity/ObjectRelation_entity/entityfields/object1_rowid/stateProcess.js @@ -0,0 +1,14 @@ +import("system.result"); +import("system.neon"); +import("system.vars"); + +var recordstate = vars.get("$sys.recordstate"); +if (recordstate == neon.OPERATINGSTATE_NEW || recordstate == neon.OPERATINGSTATE_EDIT) +{ + + if ((vars.exists("$param.AnyObjectRowid_param") && vars.get("$param.AnyObjectRowid_param")) + || (vars.exists("$param.Object1Rowid_param") && vars.get("$param.Object1Rowid_param"))) + { + result.string(neon.COMPONENTSTATE_READONLY); + } +} \ No newline at end of file diff --git a/entity/ObjectRelation_entity/entityfields/object1_rowid/valueProcess.js b/entity/ObjectRelation_entity/entityfields/object1_rowid/valueProcess.js new file mode 100644 index 0000000000..d189f026bb --- /dev/null +++ b/entity/ObjectRelation_entity/entityfields/object1_rowid/valueProcess.js @@ -0,0 +1,16 @@ +import("system.result"); +import("system.neon"); +import("system.vars"); + +var recordstate = vars.get("$sys.recordstate"); +if (recordstate == neon.OPERATINGSTATE_NEW || recordstate == neon.OPERATINGSTATE_EDIT) +{ + if (vars.exists("$param.AnyObjectRowid_param") && vars.get("$param.AnyObjectRowid_param")) + { + result.string(vars.get("$param.AnyObjectRowid_param")); + } + else if (vars.exists("$param.Object1Rowid_param") && vars.get("$param.Object1Rowid_param")) + { + result.string(vars.get("$param.Object1Rowid_param")); + } +} \ No newline at end of file diff --git a/entity/ObjectRelation_entity/entityfields/object1_type/displayValueProcess.js b/entity/ObjectRelation_entity/entityfields/object1_type/displayValueProcess.js new file mode 100644 index 0000000000..8a80d4be7e --- /dev/null +++ b/entity/ObjectRelation_entity/entityfields/object1_type/displayValueProcess.js @@ -0,0 +1,18 @@ +import("system.logging"); +import("system.result"); +import("system.neon"); +import("system.vars"); + +var recordstate = vars.get("$sys.recordstate"); +if (recordstate == neon.OPERATINGSTATE_NEW || recordstate == neon.OPERATINGSTATE_EDIT) +{ + if (vars.exists("$param.AnyObjectType_param") && vars.get("$param.AnyObjectType_param")) + { + logging.log(vars.get("$param.AnyObjectType_param")); + result.string("disp: " + vars.get("$param.AnyObjectType_param")); + } + else if (vars.exists("$param.Object1Type_param") && vars.get("$param.Object1Type_param")) + { + result.string("disp: " + vars.get("$param.Object1Type_param")); + } +} \ No newline at end of file diff --git a/entity/ObjectRelation_entity/entityfields/object1_type/stateProcess.js b/entity/ObjectRelation_entity/entityfields/object1_type/stateProcess.js new file mode 100644 index 0000000000..2160ef62ef --- /dev/null +++ b/entity/ObjectRelation_entity/entityfields/object1_type/stateProcess.js @@ -0,0 +1,13 @@ +import("system.result"); +import("system.neon"); +import("system.vars"); + +var recordstate = vars.get("$sys.recordstate"); +if (recordstate == neon.OPERATINGSTATE_NEW || recordstate == neon.OPERATINGSTATE_EDIT) +{ + if ((vars.exists("$param.AnyObjectType_param") && vars.get("$param.AnyObjectType_param")) + || (vars.exists("$param.Object1Type_param") && vars.get("$param.Object1Type_param"))) + { + result.string(neon.COMPONENTSTATE_READONLY); + } +} \ No newline at end of file diff --git a/entity/ObjectRelation_entity/entityfields/object1_type/valueProcess.js b/entity/ObjectRelation_entity/entityfields/object1_type/valueProcess.js new file mode 100644 index 0000000000..4ad606ce75 --- /dev/null +++ b/entity/ObjectRelation_entity/entityfields/object1_type/valueProcess.js @@ -0,0 +1,18 @@ +import("system.logging"); +import("system.result"); +import("system.neon"); +import("system.vars"); + +var recordstate = vars.get("$sys.recordstate"); +if (recordstate == neon.OPERATINGSTATE_NEW || recordstate == neon.OPERATINGSTATE_EDIT) +{ + if (vars.exists("$param.AnyObjectType_param") && vars.get("$param.AnyObjectType_param")) + { + logging.log(vars.get("$param.AnyObjectType_param")); + result.string(vars.get("$param.AnyObjectType_param")); + } + else if (vars.exists("$param.Object1Type_param") && vars.get("$param.Object1Type_param")) + { + result.string(vars.get("$param.Object1Type_param")); + } +} \ No newline at end of file diff --git a/entity/ObjectRelation_entity/entityfields/object2_rowid/stateProcess.js b/entity/ObjectRelation_entity/entityfields/object2_rowid/stateProcess.js new file mode 100644 index 0000000000..b78d71076c --- /dev/null +++ b/entity/ObjectRelation_entity/entityfields/object2_rowid/stateProcess.js @@ -0,0 +1,12 @@ +import("system.logging"); +import("system.result"); +import("system.neon"); +import("system.vars"); + +var recordstate = vars.get("$sys.recordstate"); +if (recordstate == neon.OPERATINGSTATE_NEW || recordstate == neon.OPERATINGSTATE_EDIT) +{ + logging.log(vars.exists("$param.Object2Rowid_param") && vars.get("$param.Object2Rowid_param")) + if (vars.exists("$param.Object2Rowid_param") && vars.get("$param.Object2Rowid_param")) + result.string(neon.COMPONENTSTATE_READONLY); +} \ No newline at end of file diff --git a/entity/ObjectRelation_entity/entityfields/object2_rowid/valueProcess.js b/entity/ObjectRelation_entity/entityfields/object2_rowid/valueProcess.js new file mode 100644 index 0000000000..710c40de47 --- /dev/null +++ b/entity/ObjectRelation_entity/entityfields/object2_rowid/valueProcess.js @@ -0,0 +1,12 @@ +import("system.result"); +import("system.neon"); +import("system.vars"); + +var recordstate = vars.get("$sys.recordstate"); +if (recordstate == neon.OPERATINGSTATE_NEW || recordstate == neon.OPERATINGSTATE_EDIT) +{ + if (vars.exists("$param.Object2Rowid_param") && vars.get("$param.Object2Rowid_param")) + { + result.string(vars.get("$param.Object2Rowid_param")); + } +} \ No newline at end of file diff --git a/entity/ObjectRelation_entity/entityfields/object2_type/displayValueProcess.js b/entity/ObjectRelation_entity/entityfields/object2_type/displayValueProcess.js new file mode 100644 index 0000000000..e53f4ab610 --- /dev/null +++ b/entity/ObjectRelation_entity/entityfields/object2_type/displayValueProcess.js @@ -0,0 +1,19 @@ +import("system.project"); +import("system.result"); +import("system.neon"); +import("system.vars"); + +var recordstate = vars.get("$sys.recordstate"); +if (recordstate == neon.OPERATINGSTATE_NEW || recordstate == neon.OPERATINGSTATE_EDIT) +{ + if (vars.exists("$param.Object1Type_param") && vars.get("$param.Object1Type_param")) + { + // TODO: maybe use the Context_entity when jdito can call other entities over consumers. + result.string(project.getDataModel(project.DATAMODEL_KIND_CONTEXT, vars.get("$param.Object1Type_param"))[1]); + } +} +else +{ + if (vars.get("$field.OBJECT1_TYPE")) + result.string(project.getDataModel(project.DATAMODEL_KIND_CONTEXT, vars.get("$field.OBJECT1_TYPE"))[1]); +} \ No newline at end of file diff --git a/entity/ObjectRelation_entity/entityfields/object2_type/stateProcess.js b/entity/ObjectRelation_entity/entityfields/object2_type/stateProcess.js new file mode 100644 index 0000000000..7d99ab991e --- /dev/null +++ b/entity/ObjectRelation_entity/entityfields/object2_type/stateProcess.js @@ -0,0 +1,10 @@ +import("system.result"); +import("system.neon"); +import("system.vars"); + +var recordstate = vars.get("$sys.recordstate"); +if (recordstate == neon.OPERATINGSTATE_NEW || recordstate == neon.OPERATINGSTATE_EDIT) +{ + if (vars.exists("$param.Object2Type_param") && vars.get("$param.Object2Type_param")) + result.string(neon.COMPONENTSTATE_READONLY); +} \ No newline at end of file diff --git a/entity/ObjectRelation_entity/entityfields/object2_type/valueProcess.js b/entity/ObjectRelation_entity/entityfields/object2_type/valueProcess.js new file mode 100644 index 0000000000..57711c82d2 --- /dev/null +++ b/entity/ObjectRelation_entity/entityfields/object2_type/valueProcess.js @@ -0,0 +1,12 @@ +import("system.result"); +import("system.neon"); +import("system.vars"); + +var recordstate = vars.get("$sys.recordstate"); +if (recordstate == neon.OPERATINGSTATE_NEW || recordstate == neon.OPERATINGSTATE_EDIT) +{ + if (vars.exists("$param.Object2Type_param") && vars.get("$param.Object2Type_param")) + { + result.string(vars.get("$param.Object2Type_param")); + } +} \ No newline at end of file diff --git a/process/Context_lib/process.js b/process/Context_lib/process.js index 1cbfa06eae..e174274981 100644 --- a/process/Context_lib/process.js +++ b/process/Context_lib/process.js @@ -56,15 +56,15 @@ ContextUtils._getSelectMap = function() { var maskingUtils = new SqlMaskingUtils(); return { - // contextId nameField Tablename, IDField - "Organisation_context": ["\"NAME\"", "ORG", "ORGID"], - "Contact_context": [maskingUtils.concat(["FIRSTNAME", "LASTNAME"]), "PERS", "PERSID"], - "Activity_context": ["SUBJECT", "ACTIVITY", "ACTIVITYID"], - "Salesproject_context": [maskingUtils.concat([maskingUtils.cast("PROJECTCODE", SQLTYPES.VARCHAR, 10), "':'", "PROJECTTITLE"]), "SALESPROJECT", "SALESPROJECTID"], + // contextId nameField Tablename, IDField, isSystemAlias + "Organisation_context": ["\"NAME\"", "ORG", "ORGID", false], + "Contact_context": [maskingUtils.concat(["FIRSTNAME", "LASTNAME"]), "PERS", "PERSID", false], + "Activity_context": ["SUBJECT", "ACTIVITY", "ACTIVITYID", false], + "Salesproject_context": [maskingUtils.concat([maskingUtils.cast("PROJECTCODE", SQLTYPES.VARCHAR, 10), "':'", "PROJECTTITLE"]), "SALESPROJECT", "SALESPROJECTID", false], // TODO: keywords sind noch nicht in der DB somit gibt es nichts ähnliches zu getKeySQL. // maskingUtils.concat([SqlMaskingUtils.cast("CONTRACTCODE", "varchar", 10), getKeySQL("CONTRACTTYPE", "CONTRACTTYPE" )]) - "Contract_context": [maskingUtils.cast("CONTRACTCODE", SQLTYPES.VARCHAR, 10), "CONTRACT", "CONTRACTID"], - "Appointment_context": ["SUMMARY", "ASYS_CALENDARBACKEND", "UID"] + "Contract_context": [maskingUtils.cast("CONTRACTCODE", SQLTYPES.VARCHAR, 10), "CONTRACT", "CONTRACTID", false] +// "Appointment_context": ["SUMMARY", "ASYS_CALENDARBACKEND", "UID", true] } } -- GitLab