diff --git a/entity/Letter_entity/Letter_entity.aod b/entity/Letter_entity/Letter_entity.aod index ee8ee1576e79872ea9f0366716643c7afd04106a..8bab19f92a2debbaf0ff15063e43609467f98db8 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 f82590e6fcb0df7f693a219f05579bddae213eda..840d399140a26629f7d42a2dce81995ac1758d39 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 0000000000000000000000000000000000000000..f52d9a4f1aaef64c96319e83b2f5dae4da376fcd --- /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 e197aca8b7760073849e21fb581b065c47215654..0000000000000000000000000000000000000000 --- 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 527cf895cbe9db6e2792cb90f6f33ec423f29b87..0a011725096744c96a29c0d3e6260912efa7b66b 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 fb051c867e7261966840c95b518dc9af4771f9c2..b554704d6947b22e5f42c051079bc361a142d84c 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 af79162fb2e409108cda9faec1cb926b7979a292..654b508f583ab1ae9f20e14621cc4e7a9b0753f6 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 75414b28840228546be585959fe75d65779eead5..5f77590bb269118a0a01ecfdee2b6b0f8f969432 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 c302876d0f8ad58c9262a23d9c596095bb9d9372..486e493fefb492ead224c144e88f270af6d84634 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); } /**