From 6b0b8654b1fd7063034be68c4c5247e28f11d010 Mon Sep 17 00:00:00 2001 From: Johannes Goderbauer <j.goderbauer@adito.de> Date: Fri, 26 Jun 2020 15:00:44 +0200 Subject: [PATCH] =?UTF-8?q?[Projekt:=20Entwicklung=20-=20Neon][TicketNr.:?= =?UTF-8?q?=201059714][neon.open***=20k=C3=B6nnen=20und=20d=C3=BCrfen=20ni?= =?UTF-8?q?cht=20in=20store-Prozessen(insert,=20update,=20delete)=20des=20?= =?UTF-8?q?RecordContainers=20verwendet=20werden]=20Letter=20-=20download?= =?UTF-8?q?=20and=20create=20activity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entity/Letter_entity/Letter_entity.aod | 29 +++++++++++-------- .../onActionProcess.js} | 2 ++ .../stateProcess.js | 8 +++++ .../recordcontainers/jdito/contentProcess.js | 9 ------ .../_____LANGUAGE_EXTRA.aod | 3 ++ .../_____LANGUAGE_de/_____LANGUAGE_de.aod | 4 +++ .../_____LANGUAGE_en/_____LANGUAGE_en.aod | 3 ++ neonView/LetterEdit_view/LetterEdit_view.aod | 9 +++++- process/DocumentTemplate_lib/process.js | 2 +- 9 files changed, 46 insertions(+), 23 deletions(-) rename entity/Letter_entity/{recordcontainers/jdito/onInsert.js => entityfields/downloadletterandcreateactivity/onActionProcess.js} (89%) create mode 100644 entity/Letter_entity/entityfields/downloadletterandcreateactivity/stateProcess.js delete mode 100644 entity/Letter_entity/recordcontainers/jdito/contentProcess.js diff --git a/entity/Letter_entity/Letter_entity.aod b/entity/Letter_entity/Letter_entity.aod index ee8ee1576e..8bab19f92a 100644 --- a/entity/Letter_entity/Letter_entity.aod +++ b/entity/Letter_entity/Letter_entity.aod @@ -4,19 +4,21 @@ <majorModelMode>DISTRIBUTED</majorModelMode> <documentation>%aditoprj%/entity/Letter_entity/documentation.adoc</documentation> <onValidation>%aditoprj%/entity/Letter_entity/onValidation.js</onValidation> - <recordContainer>jdito</recordContainer> + <recordContainer>datalessConfig</recordContainer> <entityFields> <entityProvider> <name>#PROVIDER</name> </entityProvider> <entityField> <name>UID</name> + <state>EDITABLE</state> </entityField> <entityField> <name>DOCUMENT_TEMPLATE</name> <title>Document Template</title> <consumer>DocumentTemplates</consumer> <linkedContext>DocumentTemplate</linkedContext> + <state>EDITABLE</state> </entityField> <entityConsumer> <name>DocumentTemplates</name> @@ -44,6 +46,7 @@ <name>bindata</name> <title>Custom template</title> <contentType>FILE</contentType> + <state>EDITABLE</state> </entityField> <entityActionField> <name>downloadTemplate</name> @@ -54,24 +57,26 @@ </entityActionField> <entityField> <name>comingfrom</name> + <state>EDITABLE</state> <valueProcess>%aditoprj%/entity/Letter_entity/entityfields/comingfrom/valueProcess.js</valueProcess> </entityField> <entityParameter> <name>ComingFrom_param</name> <expose v="true" /> </entityParameter> + <entityActionField> + <name>downloadLetterAndCreateActivity</name> + <title>Download letter and create Activity</title> + <onActionProcess>%aditoprj%/entity/Letter_entity/entityfields/downloadletterandcreateactivity/onActionProcess.js</onActionProcess> + <iconId>VAADIN:DOWNLOAD_ALT</iconId> + <state>DISABLED</state> + <stateProcess>%aditoprj%/entity/Letter_entity/entityfields/downloadletterandcreateactivity/stateProcess.js</stateProcess> + </entityActionField> </entityFields> <recordContainers> - <jDitoRecordContainer> - <name>jdito</name> - <jDitoRecordAlias>Data_alias</jDitoRecordAlias> - <contentProcess>%aditoprj%/entity/Letter_entity/recordcontainers/jdito/contentProcess.js</contentProcess> - <onInsert>%aditoprj%/entity/Letter_entity/recordcontainers/jdito/onInsert.js</onInsert> - <recordFieldMappings> - <jDitoRecordFieldMapping> - <name>UID.value</name> - </jDitoRecordFieldMapping> - </recordFieldMappings> - </jDitoRecordContainer> + <datalessRecordContainer> + <name>datalessConfig</name> + <alias>Data_alias</alias> + </datalessRecordContainer> </recordContainers> </entity> diff --git a/entity/Letter_entity/recordcontainers/jdito/onInsert.js b/entity/Letter_entity/entityfields/downloadletterandcreateactivity/onActionProcess.js similarity index 89% rename from entity/Letter_entity/recordcontainers/jdito/onInsert.js rename to entity/Letter_entity/entityfields/downloadletterandcreateactivity/onActionProcess.js index f82590e6fc..840d399140 100644 --- a/entity/Letter_entity/recordcontainers/jdito/onInsert.js +++ b/entity/Letter_entity/entityfields/downloadletterandcreateactivity/onActionProcess.js @@ -24,3 +24,5 @@ if (template) ActivityUtils.createNewActivity(null, links, null, null, translate.text("Letter"), text.parseDocument(content), $KeywordRegistry.activityDirection$outgoing(), [[template.filename, content, false]]); } +else + throw new Error("Error while using a document template: The provided template does not contain data."); \ No newline at end of file diff --git a/entity/Letter_entity/entityfields/downloadletterandcreateactivity/stateProcess.js b/entity/Letter_entity/entityfields/downloadletterandcreateactivity/stateProcess.js new file mode 100644 index 0000000000..f52d9a4f1a --- /dev/null +++ b/entity/Letter_entity/entityfields/downloadletterandcreateactivity/stateProcess.js @@ -0,0 +1,8 @@ +import("system.neon"); +import("system.result"); +import("system.vars"); + +if (vars.get("$sys.validationerrors") || (!vars.get("$field.bindata") && !vars.get("$field.DOCUMENT_TEMPLATE"))) + result.string(neon.COMPONENTSTATE_DISABLED); +else + result.string(neon.COMPONENTSTATE_EDITABLE); \ No newline at end of file diff --git a/entity/Letter_entity/recordcontainers/jdito/contentProcess.js b/entity/Letter_entity/recordcontainers/jdito/contentProcess.js deleted file mode 100644 index e197aca8b7..0000000000 --- a/entity/Letter_entity/recordcontainers/jdito/contentProcess.js +++ /dev/null @@ -1,9 +0,0 @@ -import("system.result"); -import("system.vars"); - -//TODO: This dummy implementation shouldn't be nescessary here. Remove this process eventually. #1051003 -var rows = []; -if (vars.get("$local.idvalues")) - rows = vars.get("$local.idvalues").map(function (id) {return [id];}); - -result.object(rows); \ No newline at end of file diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod index 527cf895cb..0a01172509 100644 --- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod +++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod @@ -6815,6 +6815,9 @@ <entry> <key>Add Participants</key> </entry> + <entry> + <key>Download letter and create Activity</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> <sqlModels> diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod index fb051c867e..b554704d69 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -8733,6 +8733,10 @@ Bitte Datumseingabe prüfen</value> <key>Add Participants</key> <value>Teilnehmer hinzufügen</value> </entry> + <entry> + <key>Download letter and create Activity</key> + <value>Brief herunterladen und Aktivität erstellen</value> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> </language> diff --git a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod index af79162fb2..654b508f58 100644 --- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod +++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod @@ -6881,6 +6881,9 @@ <entry> <key>Add Participants</key> </entry> + <entry> + <key>Download letter and create Activity</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> </language> diff --git a/neonView/LetterEdit_view/LetterEdit_view.aod b/neonView/LetterEdit_view/LetterEdit_view.aod index 75414b2884..5f77590bb2 100644 --- a/neonView/LetterEdit_view/LetterEdit_view.aod +++ b/neonView/LetterEdit_view/LetterEdit_view.aod @@ -3,7 +3,7 @@ <name>LetterEdit_view</name> <majorModelMode>DISTRIBUTED</majorModelMode> <size>SMALL</size> - <isOverlay v="true" /> + <isOverlay v="false" /> <overlayOrientation>PORTRAIT</overlayOrientation> <layout> <noneLayout> @@ -40,5 +40,12 @@ </entityFieldLink> </fields> </genericViewTemplate> + <actionsViewTemplate> + <name>ContinueActions</name> + <actions> + <element>downloadLetterAndCreateActivity</element> + </actions> + <entityField>#ENTITY</entityField> + </actionsViewTemplate> </children> </neonView> diff --git a/process/DocumentTemplate_lib/process.js b/process/DocumentTemplate_lib/process.js index c302876d0f..486e493fef 100644 --- a/process/DocumentTemplate_lib/process.js +++ b/process/DocumentTemplate_lib/process.js @@ -772,7 +772,7 @@ LetterUtils.openNewLetter = function (pContactId, pComingFrom) "ContactId_param" : pContactId, "ComingFrom_param" : pComingFrom }; - neon.openContext("Letter", "LetterEdit_view", null, neon.OPERATINGSTATE_NEW, params); + neon.openContext("Letter", "LetterEdit_view", null, neon.OPERATINGSTATE_VIEW, params); } /** -- GitLab