From fb872084b633bd91799e42f83612e784b70a3968 Mon Sep 17 00:00:00 2001 From: "S.Leierseder" <S.Leierseder@SLeierseder.aditosoftware.local> Date: Fri, 26 Apr 2019 10:44:37 +0200 Subject: [PATCH] Attachments complete --- .../2019.2/data/init_DocumentTemplateType.xml | 4 ++-- entity/Activity_entity/Activity_entity.aod | 7 +++++++ .../entityfields/newmail/onActionProcess.js | 12 +++++++++++ .../DocumentTemplateLink_entity.aod | 11 +++++++++- .../valueProcess.js | 4 ++++ .../documenttemplate_id_child/stateProcess.js | 10 +++++----- .../recordcontainers/db/conditionProcess.js | 18 +++-------------- .../recordcontainers/db/fromClauseProcess.js | 3 +++ .../DocumentTemplate_entity.aod | 1 + .../entityfields/links/stateProcess.js | 9 +++++++++ .../recordcontainers/db/conditionProcess.js | 20 ++++--------------- process/KeywordRegistry_basic/process.js | 2 ++ 12 files changed, 62 insertions(+), 39 deletions(-) create mode 100644 entity/Activity_entity/entityfields/newmail/onActionProcess.js create mode 100644 entity/DocumentTemplateLink_entity/recordcontainers/db/fromClauseProcess.js create mode 100644 entity/DocumentTemplate_entity/entityfields/links/stateProcess.js diff --git a/.liquibase/Data_alias/basic/2019.2/data/init_DocumentTemplateType.xml b/.liquibase/Data_alias/basic/2019.2/data/init_DocumentTemplateType.xml index 04d8759177..fda245a0ac 100644 --- a/.liquibase/Data_alias/basic/2019.2/data/init_DocumentTemplateType.xml +++ b/.liquibase/Data_alias/basic/2019.2/data/init_DocumentTemplateType.xml @@ -17,7 +17,7 @@ <column name="CONTAINER" value="DocumentTemplateType"/> <column name="SORTING" valueNumeric="1"/> <column name="ISACTIVE" valueNumeric="1"/> - <column name="ISESSENTIAL" valueNumeric="0"/> + <column name="ISESSENTIAL" valueNumeric="1"/> </insert> <insert tableName="AB_KEYWORD_ENTRY"> <column name="AB_KEYWORD_ENTRYID" value="bb386131-ee36-9771-b458-6751f137a941"/> @@ -26,7 +26,7 @@ <column name="CONTAINER" value="DocumentTemplateType"/> <column name="SORTING" valueNumeric="2"/> <column name="ISACTIVE" valueNumeric="1"/> - <column name="ISESSENTIAL" valueNumeric="0"/> + <column name="ISESSENTIAL" valueNumeric="1"/> </insert> <insert tableName="AB_KEYWORD_ENTRY"> <column name="AB_KEYWORD_ENTRYID" value="bb38aa51-ee36-9771-b458-6751f137a941"/> diff --git a/entity/Activity_entity/Activity_entity.aod b/entity/Activity_entity/Activity_entity.aod index 4feb132bdf..481e276315 100644 --- a/entity/Activity_entity/Activity_entity.aod +++ b/entity/Activity_entity/Activity_entity.aod @@ -433,6 +433,13 @@ <name>DATE_EDIT</name> <valueProcess>%aditoprj%/entity/Activity_entity/entityfields/date_edit/valueProcess.js</valueProcess> </entityField> + <entityActionField> + <name>newMail</name> + <fieldType>ACTION</fieldType> + <title>Mail</title> + <onActionProcess>%aditoprj%/entity/Activity_entity/entityfields/newmail/onActionProcess.js</onActionProcess> + <iconId>VAADIN:PAPERPLANE_O</iconId> + </entityActionField> </entityFields> <recordContainers> <dbRecordContainer> diff --git a/entity/Activity_entity/entityfields/newmail/onActionProcess.js b/entity/Activity_entity/entityfields/newmail/onActionProcess.js new file mode 100644 index 0000000000..d1dda2c181 --- /dev/null +++ b/entity/Activity_entity/entityfields/newmail/onActionProcess.js @@ -0,0 +1,12 @@ +import("system.logging"); +import("system.db"); +import("system.vars"); +import("system.neon"); + +var params = {}; +//var doctempIds = db.table("select DOCUMENTTEMPLATEID from DOCUMENTTEMPLATE"); +//logging.log(vars.getString(doctempIds)); +//params["XY_param"] = "Mail"; + +neon.openContext("DocumentTemplate_context", "DocumentTemplateFilter_view", null, neon.OPERATINGSTATE_VIEW, null); + diff --git a/entity/DocumentTemplateLink_entity/DocumentTemplateLink_entity.aod b/entity/DocumentTemplateLink_entity/DocumentTemplateLink_entity.aod index 8f3f448246..51c8902f8e 100644 --- a/entity/DocumentTemplateLink_entity/DocumentTemplateLink_entity.aod +++ b/entity/DocumentTemplateLink_entity/DocumentTemplateLink_entity.aod @@ -59,6 +59,7 @@ <children> <entityParameter> <name>DocumentTemplateType_param</name> + <title></title> <valueProcess>%aditoprj%/entity/DocumentTemplateLink_entity/entityfields/attachments/children/documenttemplatetype_param/valueProcess.js</valueProcess> </entityParameter> </children> @@ -98,15 +99,23 @@ <dbRecordContainer> <name>db</name> <alias>Data_alias</alias> + <fromClauseProcess>%aditoprj%/entity/DocumentTemplateLink_entity/recordcontainers/db/fromClauseProcess.js</fromClauseProcess> <conditionProcess>%aditoprj%/entity/DocumentTemplateLink_entity/recordcontainers/db/conditionProcess.js</conditionProcess> <linkInformation> <linkInformation> - <name>99ab2840-c45e-4901-8383-91fbb8d82075</name> + <name>05d25e85-1cd8-4897-be48-ecf699322b1f</name> <tableName>DOCUMENTTEMPLATELINK</tableName> <primaryKey>DOCUMENTTEMPLATELINKID</primaryKey> <isUIDTable v="true" /> <readonly v="false" /> </linkInformation> + <linkInformation> + <name>34ca9c71-3de5-48ce-ade2-fa203360ebbd</name> + <tableName>DOCUMENTTEMPLATE</tableName> + <primaryKey>DOCUMENTTEMPLATEID</primaryKey> + <isUIDTable v="false" /> + <readonly v="true" /> + </linkInformation> </linkInformation> <recordFieldMappings> <dbRecordFieldMapping> diff --git a/entity/DocumentTemplateLink_entity/entityfields/attachments/children/documenttemplatetype_param/valueProcess.js b/entity/DocumentTemplateLink_entity/entityfields/attachments/children/documenttemplatetype_param/valueProcess.js index e69de29bb2..bc450eb560 100644 --- a/entity/DocumentTemplateLink_entity/entityfields/attachments/children/documenttemplatetype_param/valueProcess.js +++ b/entity/DocumentTemplateLink_entity/entityfields/attachments/children/documenttemplatetype_param/valueProcess.js @@ -0,0 +1,4 @@ +import("KeywordRegistry_basic"); +import("system.result"); + +result.string($KeywordRegistry.documentTemplateType$attachment()); \ No newline at end of file diff --git a/entity/DocumentTemplateLink_entity/entityfields/documenttemplate_id_child/stateProcess.js b/entity/DocumentTemplateLink_entity/entityfields/documenttemplate_id_child/stateProcess.js index e2ebc8de0a..bab14e8a9c 100644 --- a/entity/DocumentTemplateLink_entity/entityfields/documenttemplate_id_child/stateProcess.js +++ b/entity/DocumentTemplateLink_entity/entityfields/documenttemplate_id_child/stateProcess.js @@ -5,9 +5,9 @@ import("system.vars"); import("system.db"); var parenttype = vars.get("$param.Type_param"); -logging.log(parenttype); +//logging.log(parenttype); -if(vars.exists(parenttype) && paraenttype != null && parenttype != "MAI"){ - result.object(neon.COMPONENTSTATE_DISABLED); -} - \ No newline at end of file +//if(vars.exists(parenttype) && paraenttype != null && parenttype != "MAI"){ +// result.object(neon.COMPONENTSTATE_DISABLED); +//} +// \ No newline at end of file diff --git a/entity/DocumentTemplateLink_entity/recordcontainers/db/conditionProcess.js b/entity/DocumentTemplateLink_entity/recordcontainers/db/conditionProcess.js index ae6a038872..71ea6e3b74 100644 --- a/entity/DocumentTemplateLink_entity/recordcontainers/db/conditionProcess.js +++ b/entity/DocumentTemplateLink_entity/recordcontainers/db/conditionProcess.js @@ -1,20 +1,8 @@ -import("system.vars"); -import("system.db"); import("system.result"); +import("system.db"); import("Sql_lib"); var cond = SqlCondition.begin() - .andPrepareVars("DOCUMENTTEMPLATELINK.DOCUMENTTEMPLATE_ID_PARENT", "$param.DocumentId_param"); - -//TODO: use a preparedCondition when available #1030812 #1034026 -result.string(db.translateCondition(cond.build("1 = 0"))); + .andPrepareVars("DOCUMENTTEMPLATELINK.DOCUMENTTEMPLATE_ID_PARENT", "$param.DocumentId_param") -//if(vars.exists("$param.Type_param") && vars.get("$param.Type_param") != null && vars.get("$param.Type_param") == "ATT"){ -// -// var cond = SqlCondition.begin() -// .andPrepare("DOCUMENTTEMPLATELINK.ATTACHMENT_TYPE", type) -// .andPrepareVars("DOCUMENTTEMPLATELINK.DOCUMENTTEMPLATE_ID_PARENT", docId) -// .build(); -// -// result.string(db.translateCondition(cond)); -//} \ No newline at end of file +result.string(db.translateCondition(cond.build("1=2"))); \ No newline at end of file diff --git a/entity/DocumentTemplateLink_entity/recordcontainers/db/fromClauseProcess.js b/entity/DocumentTemplateLink_entity/recordcontainers/db/fromClauseProcess.js new file mode 100644 index 0000000000..52d46e62a6 --- /dev/null +++ b/entity/DocumentTemplateLink_entity/recordcontainers/db/fromClauseProcess.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.string("DOCUMENTTEMPLATELINK join DOCUMENTTEMPLATE on DOCUMENTTEMPLATE.DOCUMENTTEMPLATEID = DOCUMENTTEMPLATELINK.DOCUMENTTEMPLATE_ID_PARENT"); \ No newline at end of file diff --git a/entity/DocumentTemplate_entity/DocumentTemplate_entity.aod b/entity/DocumentTemplate_entity/DocumentTemplate_entity.aod index 3fb259e5a8..a3509daefc 100644 --- a/entity/DocumentTemplate_entity/DocumentTemplate_entity.aod +++ b/entity/DocumentTemplate_entity/DocumentTemplate_entity.aod @@ -199,6 +199,7 @@ <name>Links</name> <title>Attachment</title> <fieldType>DEPENDENCY_OUT</fieldType> + <stateProcess>%aditoprj%/entity/DocumentTemplate_entity/entityfields/links/stateProcess.js</stateProcess> <dependency> <name>dependency</name> <entityName>DocumentTemplateLink_entity</entityName> diff --git a/entity/DocumentTemplate_entity/entityfields/links/stateProcess.js b/entity/DocumentTemplate_entity/entityfields/links/stateProcess.js new file mode 100644 index 0000000000..957a413f1d --- /dev/null +++ b/entity/DocumentTemplate_entity/entityfields/links/stateProcess.js @@ -0,0 +1,9 @@ +import("system.result"); +import("KeywordRegistry_basic"); +import("system.vars"); +import("system.neon"); + +if(vars.get("$field.TYPE") != $KeywordRegistry.documentTemplateType$mail()) +{ + result.string(neon.COMPONENTSTATE_INVISIBLE); +} \ No newline at end of file diff --git a/entity/DocumentTemplate_entity/recordcontainers/db/conditionProcess.js b/entity/DocumentTemplate_entity/recordcontainers/db/conditionProcess.js index 2478d8b4cf..98f1298fa3 100644 --- a/entity/DocumentTemplate_entity/recordcontainers/db/conditionProcess.js +++ b/entity/DocumentTemplate_entity/recordcontainers/db/conditionProcess.js @@ -1,22 +1,10 @@ -import("system.logging"); import("system.result"); import("system.vars"); import("system.db"); import("Sql_lib"); -var docTemplateType = vars.get("$param.DocumentTemplateType_param"); -var docTemplateTypeClassification = vars.get("$param.DocumentTemplateTypeClassification_param"); +var cond = SqlCondition.begin() + .andPrepareVars("DOCUMENTTEMPLATE.TYPE", "$param.DocumentTemplateType_param") + .andPrepareVars("DOCUMENTTEMPLATE.CLASSIFICATION", "$param.DocumentTemplateTypeClassification_param"); - -if(docTemplateType != null && docTemplateType != "" && docTemplateTypeClassification != null && docTemplateTypeClassification != "") -{ - docTemplateType = docTemplateType.trim(); - docTemplateTypeClassification = docTemplateTypeClassification.trim(); - - var cond = SqlCondition.begin() - .andPrepare("DOCUMENTTEMPLATE.TYPE", docTemplateType) - .andPrepare("DOCUMENTTEMPLATE.CLASSIFICATION", docTemplateTypeClassification) - .build(); - - result.string(db.translateStatement(cond)); -} \ No newline at end of file +result.string(db.translateStatement(cond.build("1=1"))); \ No newline at end of file diff --git a/process/KeywordRegistry_basic/process.js b/process/KeywordRegistry_basic/process.js index c55adc815f..82fadaadc5 100644 --- a/process/KeywordRegistry_basic/process.js +++ b/process/KeywordRegistry_basic/process.js @@ -71,4 +71,6 @@ $KeywordRegistry.contactDepartment = function(){return "ContactDepartment";}; $KeywordRegistry.contactPosition = function(){return "ContactPosition";}; $KeywordRegistry.contactContactrole = function(){return "ContactContactrole";}; $KeywordRegistry.documentTemplateType = function(){return "DocumentTemplateType";}; +$KeywordRegistry.documentTemplateType$mail = function(){return "MAI ";}; +$KeywordRegistry.documentTemplateType$attachment = function(){return "ATT ";}; $KeywordRegistry.documentTemplateTypeCategory = function(){return "DocumentTemplateTypeCategory";}; \ No newline at end of file -- GitLab