diff --git a/entity/360Degree_entity/360Degree_entity.aod b/entity/360Degree_entity/360Degree_entity.aod index 39f9fce9ef1c0a110a20ae30c12f28b7935ddc6d..714a76f5bb1475f4394a9a31b22a0c421fc06204 100644 --- a/entity/360Degree_entity/360Degree_entity.aod +++ b/entity/360Degree_entity/360Degree_entity.aod @@ -47,6 +47,10 @@ <valueProcess>%aditoprj%/entity/360Degree_entity/entityfields/organisationobjects/children/objecttype_param/valueProcess.js</valueProcess> <expose v="false" /> </entityParameter> + <entityParameter> + <name>BaseContextId_param</name> + <valueProcess>%aditoprj%/entity/360Degree_entity/entityfields/organisationobjects/children/basecontextid_param/valueProcess.js</valueProcess> + </entityParameter> </children> </entityProvider> <entityField> @@ -86,6 +90,10 @@ <valueProcess>%aditoprj%/entity/360Degree_entity/entityfields/personobjects/children/objecttype_param/valueProcess.js</valueProcess> <expose v="false" /> </entityParameter> + <entityParameter> + <name>BaseContextId_param</name> + <valueProcess>%aditoprj%/entity/360Degree_entity/entityfields/personobjects/children/basecontextid_param/valueProcess.js</valueProcess> + </entityParameter> </children> </entityProvider> <entityField> @@ -156,6 +164,10 @@ <groupable v="true" /> <dropDownProcess>%aditoprj%/entity/360Degree_entity/entityfields/active/dropDownProcess.js</dropDownProcess> </entityField> + <entityParameter> + <name>BaseContextId_param</name> + <expose v="true" /> + </entityParameter> </entityFields> <recordContainers> <jDitoRecordContainer> diff --git a/entity/360Degree_entity/entityfields/newmodule/children/newcampaignparticipant/onActionProcess.js b/entity/360Degree_entity/entityfields/newmodule/children/newcampaignparticipant/onActionProcess.js index 47f9f4bce2f47f8ee80c83e4841ab2be52782260..ab616fd149f4de1a3a4651d4c7d810703510f000 100644 --- a/entity/360Degree_entity/entityfields/newmodule/children/newcampaignparticipant/onActionProcess.js +++ b/entity/360Degree_entity/entityfields/newmodule/children/newcampaignparticipant/onActionProcess.js @@ -5,5 +5,5 @@ if (vars.get("$param.BaseContextId_param") == "Person" || vars.get("$param.BaseC { // Note: this only works if the BaseContextId_param is also the correct Tablename. If not you have to add a context - tablename mapping somewhere... // for person / organisation this should work - CampaignUtils.addParticipantsByRowIds(JSON.stringify([vars.getString("$param.ObjectRowId_param")]), vars.get("$param.BaseContextId_param").toUpperCase()); + CampaignUtils.addParticipantsByRowIds(JSON.stringify([JSON.parse(vars.get("$param.ObjectRowId_param"))[0]]), vars.get("$param.BaseContextId_param").toUpperCase()); } \ No newline at end of file diff --git a/entity/360Degree_entity/entityfields/newmodule/children/newcontract/onActionProcess.js b/entity/360Degree_entity/entityfields/newmodule/children/newcontract/onActionProcess.js index 0593c0ea1d681ac441b346e130c12bfbf7c0564c..64d308882790f8b15662cf4f2cea62d86219b2c9 100644 --- a/entity/360Degree_entity/entityfields/newmodule/children/newcontract/onActionProcess.js +++ b/entity/360Degree_entity/entityfields/newmodule/children/newcontract/onActionProcess.js @@ -1,4 +1,4 @@ import("system.vars"); import("Contract_lib"); -ContractUtils.createNewContract(vars.getString("$param.ObjectRowId_param")); \ No newline at end of file +ContractUtils.createNewContract(JSON.parse(vars.getString("$param.ObjectRowId_param"))[0]); \ No newline at end of file diff --git a/entity/360Degree_entity/entityfields/newmodule/children/newoffer/onActionProcess.js b/entity/360Degree_entity/entityfields/newmodule/children/newoffer/onActionProcess.js index 69da5ef8011ebb9b1aedba6ffe05541816995649..22e21cf460a3e87b0c4ff7b86296b891cc4b9fcb 100644 --- a/entity/360Degree_entity/entityfields/newmodule/children/newoffer/onActionProcess.js +++ b/entity/360Degree_entity/entityfields/newmodule/children/newoffer/onActionProcess.js @@ -1,4 +1,4 @@ import("system.vars"); import("Offer_lib"); -OfferUtils.createNewOffer(null, null, vars.getString("$param.ObjectRowId_param")); \ No newline at end of file +OfferUtils.createNewOffer(null, null, JSON.parse(vars.getString("$param.ObjectRowId_param"))[0]); \ No newline at end of file diff --git a/entity/360Degree_entity/entityfields/newmodule/children/neworder/onActionProcess.js b/entity/360Degree_entity/entityfields/newmodule/children/neworder/onActionProcess.js index 5fa0055caaa5b62913e4a4cf16bfabf5fd542696..5c2ee2f884482cf501dfb07b15cc008fc139bea3 100644 --- a/entity/360Degree_entity/entityfields/newmodule/children/neworder/onActionProcess.js +++ b/entity/360Degree_entity/entityfields/newmodule/children/neworder/onActionProcess.js @@ -1,4 +1,4 @@ import("system.vars"); import("Order_lib"); -OrderUtils.createNewOrder(null, vars.getString("$param.ObjectRowId_param")); \ No newline at end of file +OrderUtils.createNewOrder(null, null, JSON.parse(vars.get("$param.ObjectRowId_param"))[0]); diff --git a/entity/360Degree_entity/entityfields/newmodule/children/newsalesproject/onActionProcess.js b/entity/360Degree_entity/entityfields/newmodule/children/newsalesproject/onActionProcess.js index d7426e72df2caec7058f23a716c698e10a848a54..c7c31969220a3e98c6cba55805316052f4f90668 100644 --- a/entity/360Degree_entity/entityfields/newmodule/children/newsalesproject/onActionProcess.js +++ b/entity/360Degree_entity/entityfields/newmodule/children/newsalesproject/onActionProcess.js @@ -1,4 +1,4 @@ import("system.vars"); import("Salesproject_lib"); -Salesproject.createNewSalesproject(vars.getString("$param.ObjectRowId_param")); \ No newline at end of file +Salesproject.createNewSalesproject(JSON.parse(vars.getString("$param.ObjectRowId_param"))[0]); \ No newline at end of file diff --git a/entity/360Degree_entity/entityfields/newmodule/children/newsupportticket/onActionProcess.js b/entity/360Degree_entity/entityfields/newmodule/children/newsupportticket/onActionProcess.js index 9fa788e332e620073941436097faff4ca5269345..3e5dc8f2a80db46b99a8a8ffe543ff0c4aaeddd4 100644 --- a/entity/360Degree_entity/entityfields/newmodule/children/newsupportticket/onActionProcess.js +++ b/entity/360Degree_entity/entityfields/newmodule/children/newsupportticket/onActionProcess.js @@ -3,4 +3,4 @@ import("ActivityTask_lib"); import("Context_lib"); import("Ticket_lib") -TicketUtils.createNewTicket(undefined, [[vars.get("$param.BaseContextId_param"), vars.get("$param.ObjectRowId_param")]]) \ No newline at end of file +TicketUtils.createNewTicket(undefined, [[vars.get("$param.BaseContextId_param"), JSON.parse(vars.get("$param.ObjectRowId_param"))[0]]]) \ No newline at end of file diff --git a/entity/360Degree_entity/entityfields/organisationobjects/children/basecontextid_param/valueProcess.js b/entity/360Degree_entity/entityfields/organisationobjects/children/basecontextid_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..9e359dfbd05a73d0010c8e90a0a645160e0087e4 --- /dev/null +++ b/entity/360Degree_entity/entityfields/organisationobjects/children/basecontextid_param/valueProcess.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.string("Organisation"); \ No newline at end of file diff --git a/entity/360Degree_entity/entityfields/personobjects/children/basecontextid_param/valueProcess.js b/entity/360Degree_entity/entityfields/personobjects/children/basecontextid_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..8ba819b0b1d3a291ac31d270ec48c009ccf047e0 --- /dev/null +++ b/entity/360Degree_entity/entityfields/personobjects/children/basecontextid_param/valueProcess.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.string("Person"); \ No newline at end of file diff --git a/entity/BulkMail_entity/entityfields/content/contentTypeProcess.js b/entity/BulkMail_entity/entityfields/content/contentTypeProcess.js index 49308df2f63a8fe57518af58217c92ea93baac4f..8f43fce9661f887d40adc8465b2cc2dedfe7209d 100644 --- a/entity/BulkMail_entity/entityfields/content/contentTypeProcess.js +++ b/entity/BulkMail_entity/entityfields/content/contentTypeProcess.js @@ -5,6 +5,6 @@ import("Document_lib"); import("system.vars"); import("DocumentTemplate_lib"); -result.string(vars.get("$context.currentTemplateType") == DocumentTemplate.types.TXT +result.string(vars.exists("$context.currentTemplateType") && vars.get("$context.currentTemplateType") == DocumentTemplate.types.TXT ? "LONG_TEXT" : "HTML"); \ No newline at end of file diff --git a/entity/BulkMail_entity/entityfields/content/displayValueProcess.js b/entity/BulkMail_entity/entityfields/content/displayValueProcess.js index eb9e6ef7f14579906731e58e54c7a667389e92ab..577d092a84b9b39993e248f77556bfce72e91c6d 100644 --- a/entity/BulkMail_entity/entityfields/content/displayValueProcess.js +++ b/entity/BulkMail_entity/entityfields/content/displayValueProcess.js @@ -8,7 +8,7 @@ import("system.neon"); import("DocumentTemplate_lib"); // if this was done for every row, like in a lookup, the performance would be very bad -if (vars.get("$sys.viewmode") == neon.FRAME_VIEWMODE_DATASET) +if (vars.get("$sys.viewmode") == neon.FRAME_VIEWMODE_DATASET && vars.get("$field.content")) { var template = new DocumentTemplate(util.encodeBase64String(vars.get("$field.content")), vars.get("$context.currentTemplateType"), undefined, true) diff --git a/entity/BulkMail_entity/entityfields/content/stateProcess.js b/entity/BulkMail_entity/entityfields/content/stateProcess.js index d48b2b6f0074a0be65f266402613082c57db6f84..1debaa69264cc6c3811a17bee2e16a40f1fe368c 100644 --- a/entity/BulkMail_entity/entityfields/content/stateProcess.js +++ b/entity/BulkMail_entity/entityfields/content/stateProcess.js @@ -4,7 +4,7 @@ import("system.neon"); import("DocumentTemplate_lib"); // in edit mode -if (vars.get("$sys.recordstate") != neon.OPERATINGSTATE_VIEW && +if (vars.get("$sys.recordstate") != neon.OPERATINGSTATE_VIEW && vars.exists("$context.currentTemplateType") && (vars.get("$context.currentTemplateType") == DocumentTemplate.types.EML || vars.get("$context.currentTemplateType") == DocumentTemplate.types.HTML)) // TODO: invisible for html as there are problems with images which are removed by the html-editor { diff --git a/entity/BulkMail_entity/entityfields/content/valueProcess.js b/entity/BulkMail_entity/entityfields/content/valueProcess.js index 90841e809f0b43e8b09c8c0955350da0f7e3a121..a9260df014ba27ceb16face9e6dcb74becc89274 100644 --- a/entity/BulkMail_entity/entityfields/content/valueProcess.js +++ b/entity/BulkMail_entity/entityfields/content/valueProcess.js @@ -9,14 +9,17 @@ import("Bulkmail_lib"); if (vars.get("$sys.viewmode") == neon.FRAME_VIEWMODE_DATASET && vars.get("$this.value") == null) { - var template = BulkMailUtils.getBulkMailTemplate(vars.get("$field.BULKMAILID"), vars.get("$field.DOCUMENTTEMPLATE_ID"), false, new FileUpload(vars.get("$field.bindata"))) - var content = util.decodeBase64String(template.content); - var type = template.type; - vars.set("$context.currentTemplateType", type); - result.string(content); + var template = BulkMailUtils.getBulkMailTemplate(vars.get("$field.BULKMAILID"), vars.get("$field.DOCUMENTTEMPLATE_ID"), false, false, new FileUpload(vars.get("$field.bindata"))); + if (template.type) + { + var content = util.decodeBase64String(template.content); + var type = template.type; + vars.set("$context.currentTemplateType", type); + result.string(content); + } } else if (!vars.get("$field.DOCUMENTTEMPLATE_ID")) { result.string(""); vars.set("$context.currentTemplateType", ""); -} \ No newline at end of file +} diff --git a/entity/BulkMail_entity/entityfields/name/valueProcess.js b/entity/BulkMail_entity/entityfields/name/valueProcess.js index 829431cf9f199070dbd735ea9f6e391d49b59599..adb0f3d6b2fdf8627655ec017e6eba58491048a7 100644 --- a/entity/BulkMail_entity/entityfields/name/valueProcess.js +++ b/entity/BulkMail_entity/entityfields/name/valueProcess.js @@ -12,7 +12,7 @@ if (!vars.get("$this.value") && vars.get("$sys.recordstate") == neon.OPERATINGST var filename = DocumentUtil.getFilenameFromUpload(upload); result.string(filename.split(".")[0]); } - else + else if (vars.get("$field.DOCUMENTTEMPLATE_ID")) { var conf = entities.createConfigForLoadingRows(); conf.entity("DocumentTemplate_entity") diff --git a/entity/BulkMail_entity/recordcontainers/db/onDBInsert.js b/entity/BulkMail_entity/recordcontainers/db/onDBInsert.js index a7026f989684e2ce27c21a14c15bf5bcc7a2a5a0..e8fcb2f9e54fb381889575657f6a15b92d834051 100644 --- a/entity/BulkMail_entity/recordcontainers/db/onDBInsert.js +++ b/entity/BulkMail_entity/recordcontainers/db/onDBInsert.js @@ -20,7 +20,7 @@ var bulkMailName = rowdata["BULKMAIL.NAME"]; var template = DocumentTemplate.getSelectedTemplate(templateId, new FileUpload(bindata), content, DocumentTemplate.types.HTML); -if (template && template.content) +if (template && template.content && BulkMailUtils.isValidTemplateType(template.type)) { if (!template.filename) template.filename = bulkMailName + ".html"; diff --git a/entity/BulkMail_entity/recordcontainers/db/onDBUpdate.js b/entity/BulkMail_entity/recordcontainers/db/onDBUpdate.js index 3d3fb01019622a4e43ae0bcbb5496b5508ae7cf9..258fff593db6fdfa4ccdb6698685066edeef7424 100644 --- a/entity/BulkMail_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/BulkMail_entity/recordcontainers/db/onDBUpdate.js @@ -20,7 +20,7 @@ var bulkMailName = rowdata["BULKMAIL.NAME"]; var template = DocumentTemplate.getSelectedTemplate(templateId, new FileUpload(bindata), content, DocumentTemplate.types.HTML); -if (template && template.content) +if (template && template.content && BulkMailUtils.isValidTemplateType(template.type)) { if (!template.filename) template.filename = bulkMailName + ".html"; diff --git a/entity/DSGVOInfo_entity/DSGVOInfo_entity.aod b/entity/DSGVOInfo_entity/DSGVOInfo_entity.aod index f02d4a258b934aad28c371e8616aece7b3dc9227..08596bfcc41d3f5c3bb5bfef632e612f12812a61 100644 --- a/entity/DSGVOInfo_entity/DSGVOInfo_entity.aod +++ b/entity/DSGVOInfo_entity/DSGVOInfo_entity.aod @@ -23,6 +23,7 @@ <consumer>KeywordGuarantee</consumer> <mandatoryProcess>%aditoprj%/entity/DSGVOInfo_entity/entityfields/guarantee/mandatoryProcess.js</mandatoryProcess> <stateProcess>%aditoprj%/entity/DSGVOInfo_entity/entityfields/guarantee/stateProcess.js</stateProcess> + <displayValueProcess>%aditoprj%/entity/DSGVOInfo_entity/entityfields/guarantee/displayValueProcess.js</displayValueProcess> </entityField> <entityField> <name>DATASOURCE</name> @@ -112,6 +113,7 @@ <title>Transmission</title> <consumer>KeywordTransmission</consumer> <mandatory v="true" /> + <displayValueProcess>%aditoprj%/entity/DSGVOInfo_entity/entityfields/transmission/displayValueProcess.js</displayValueProcess> <onValueChange>%aditoprj%/entity/DSGVOInfo_entity/entityfields/transmission/onValueChange.js</onValueChange> <onValueChangeTypes> <element>MASK</element> diff --git a/entity/DSGVOInfo_entity/entityfields/guarantee/displayValueProcess.js b/entity/DSGVOInfo_entity/entityfields/guarantee/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..a0b1a31ab4187bf910a39eee429d48379d84c430 --- /dev/null +++ b/entity/DSGVOInfo_entity/entityfields/guarantee/displayValueProcess.js @@ -0,0 +1,6 @@ +import("system.result"); +import("system.vars"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +result.string(KeywordUtils.getViewValue($KeywordRegistry.dsgvoGuarantee(), vars.get("$field.GUARANTEE"))); diff --git a/entity/DSGVOInfo_entity/entityfields/transmission/displayValueProcess.js b/entity/DSGVOInfo_entity/entityfields/transmission/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..77d6d54a39f226790b7a161736c1325c093c5085 --- /dev/null +++ b/entity/DSGVOInfo_entity/entityfields/transmission/displayValueProcess.js @@ -0,0 +1,6 @@ +import("system.result"); +import("system.vars"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +result.string(KeywordUtils.getViewValue($KeywordRegistry.dsgvoTransmission(), vars.get("$field.TRANSMISSION"))); diff --git a/entity/DSGVOInfo_entity/recordcontainers/db/recordfieldmappings/guarantee.displayvalue/expression.js b/entity/DSGVOInfo_entity/recordcontainers/db/recordfieldmappings/guarantee.displayvalue/expression.js index b51d9069c3f21fd773d59657203ad8d3f6bd4928..62c4b7fe22d6b2dd218a12fabc77bf9be3658fde 100644 --- a/entity/DSGVOInfo_entity/recordcontainers/db/recordfieldmappings/guarantee.displayvalue/expression.js +++ b/entity/DSGVOInfo_entity/recordcontainers/db/recordfieldmappings/guarantee.displayvalue/expression.js @@ -1,6 +1 @@ -import("system.result"); -import("Keyword_lib"); -import("KeywordRegistry_basic"); - -var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.dsgvoGuarantee(), "DSGVOINFO.GUARANTEE"); -result.string(sql); +//temporarly removed since this process woul'd cause problems when generating an GDPR report //TODO: reenable this process \ No newline at end of file diff --git a/entity/DSGVOInfo_entity/recordcontainers/db/recordfieldmappings/transmission.displayvalue/expression.js b/entity/DSGVOInfo_entity/recordcontainers/db/recordfieldmappings/transmission.displayvalue/expression.js index 1cd3f3f3f243503eed32b959c33a61c46004d277..62c4b7fe22d6b2dd218a12fabc77bf9be3658fde 100644 --- a/entity/DSGVOInfo_entity/recordcontainers/db/recordfieldmappings/transmission.displayvalue/expression.js +++ b/entity/DSGVOInfo_entity/recordcontainers/db/recordfieldmappings/transmission.displayvalue/expression.js @@ -1,6 +1 @@ -import("system.result"); -import("Keyword_lib"); -import("KeywordRegistry_basic"); - -var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.dsgvoTransmission(), "DSGVOINFO.TRANSMISSION"); -result.string(sql); +//temporarly removed since this process woul'd cause problems when generating an GDPR report //TODO: reenable this process \ No newline at end of file diff --git a/entity/DSGVO_entity/recordcontainers/jdito/contentProcess.js b/entity/DSGVO_entity/recordcontainers/jdito/contentProcess.js index be1eae350e9c4115306985baf9d0d7ac6429c534..488dd2cdd887a32c566fd853d2c3ae3cf87a27a9 100644 --- a/entity/DSGVO_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/DSGVO_entity/recordcontainers/jdito/contentProcess.js @@ -16,6 +16,20 @@ var filterCond; if (vars.exists("$local.idvalues") && vars.get("$local.idvalues") && vars.get("$local.idvalues").length > 0) { filterCond = newWhere("DSGVO.DSGVOID", vars.get("$local.idvalues"), SqlBuilder.IN()); + //this is a workaround: when using $local.idvalues the contactId-param may not be set. + //But the DataPrivacyUtils.collectAll function needs a contactId to work properly, and there exists no other function to load the data by uids + //when the upper TODO is done, this workaround can be removed + if (contactId == null) + { + var contactIds = (new SqlBuilder()).selectDistinct("DSGVO.CONTACT_ID") + .from("DSGVO") + .where(filterCond) + .arrayColumn(); + if (contactIds.length > 1) + throw new Error("DSGVO_entity.jdito.contentProcess: tried to load data for more than one contact; this is not implemented"); + + contactId = contactIds[0]; + } } var data = DataPrivacyUtils.collectAll(contactId, filterCond) diff --git a/entity/ObjectTree_entity/recordcontainers/jdito/onUpdate.js b/entity/ObjectTree_entity/recordcontainers/jdito/onUpdate.js index 70af0573d3349eafa495898ff9e7001ed6fc51b4..eeb63ca799b10d70e54f1e522cb2d941942dc8a0 100644 --- a/entity/ObjectTree_entity/recordcontainers/jdito/onUpdate.js +++ b/entity/ObjectTree_entity/recordcontainers/jdito/onUpdate.js @@ -1,7 +1,9 @@ import("system.vars"); import("Sql_lib"); -var objectRelationId = vars.get("$local.rowdata")["OBJECTRELATIONID.value"]; - -newWhereIfSet("AB_OBJECTRELATION.AB_OBJECTRELATIONID", objectRelationId) - .updateFields({"INFO" : rowdata["INFO.value"]}); +if (vars.get("$local.changed").indexOf("INFO.value") !== -1) +{ + var rowdata = vars.get("$local.rowdata"); + newWhereIfSet("AB_OBJECTRELATION.AB_OBJECTRELATIONID", rowdata["OBJECTRELATIONID.value"]) + .updateFields({"INFO" : rowdata["INFO.value"]}); +} diff --git a/entity/Offer_entity/Offer_entity.aod b/entity/Offer_entity/Offer_entity.aod index 75d38c7a6832af67920a926aa3eb1877ef952bde..c8d706ecb621275adc7fd92ac581a8a169b42f16 100644 --- a/entity/Offer_entity/Offer_entity.aod +++ b/entity/Offer_entity/Offer_entity.aod @@ -962,6 +962,7 @@ <title>Start workflow</title> <onActionProcess>%aditoprj%/entity/Offer_entity/entityfields/startworkflow/onActionProcess.js</onActionProcess> <iconId>VAADIN:PLAY</iconId> + <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/startworkflow/stateProcess.js</stateProcess> </entityActionField> </entityFields> <recordContainers> diff --git a/entity/Offer_entity/entityfields/startworkflow/stateProcess.js b/entity/Offer_entity/entityfields/startworkflow/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..ef65dd9cffd2d6d81ae54a6ae35636ae946aff22 --- /dev/null +++ b/entity/Offer_entity/entityfields/startworkflow/stateProcess.js @@ -0,0 +1,8 @@ +import("system.neon"); +import("Workflow_lib"); +import("system.result"); + +result.string(WorkflowUtils.engineIsEnabled() + ? neon.COMPONENTSTATE_EDITABLE + : neon.COMPONENTSTATE_INVISIBLE +); \ No newline at end of file diff --git a/entity/Order_entity/Order_entity.aod b/entity/Order_entity/Order_entity.aod index 3dbd2b7987b396819d6a902708296709cdfad61c..6c5316dbfc6dfb7f6003c07199f9ca77b60be793 100644 --- a/entity/Order_entity/Order_entity.aod +++ b/entity/Order_entity/Order_entity.aod @@ -296,6 +296,7 @@ </entityParameter> <entityParameter> <name>OrderLanguage_param</name> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/orderlanguage_param/valueProcess.js</valueProcess> <expose v="true" /> <mandatory v="false" /> <description>PARAMETER</description> @@ -779,6 +780,7 @@ </entityParameter> <entityParameter> <name>OrderType_param</name> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/ordertype_param/valueProcess.js</valueProcess> <expose v="true" /> <description>PARAMETER</description> </entityParameter> @@ -1008,6 +1010,8 @@ <dbRecordFieldMapping> <name>LANGUAGE.value</name> <recordfield>SALESORDER.ISOLANGUAGE</recordfield> + <isFilterable v="true" /> + <isLookupFilter v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>NET.value</name> diff --git a/entity/Order_entity/entityfields/isolanguage/valueProcess.js b/entity/Order_entity/entityfields/isolanguage/valueProcess.js index b1684b313cd013775775c1711f7b80b88cc13071..77df925266af97e5fbb03d8519355dd73c5b8d53 100644 --- a/entity/Order_entity/entityfields/isolanguage/valueProcess.js +++ b/entity/Order_entity/entityfields/isolanguage/valueProcess.js @@ -1,7 +1,9 @@ +import("system.neon"); import("system.result"); import("system.vars"); +import("KeywordRegistry_basic"); -if (vars.exists("$param.OrderLanguage_param")) +if (vars.exists("$param.OrderLanguage_param") && vars.get("$param.OrderLanguage_param")) { result.string(vars.get("$param.OrderLanguage_param")); -} \ No newline at end of file +} diff --git a/entity/Order_entity/entityfields/object_rowid/valueProcess.js b/entity/Order_entity/entityfields/object_rowid/valueProcess.js index 947890744e193277b6c6e8495a241848c85dd084..ab26d1b15da7bcfbb2e6dab44d71a92b55787328 100644 --- a/entity/Order_entity/entityfields/object_rowid/valueProcess.js +++ b/entity/Order_entity/entityfields/object_rowid/valueProcess.js @@ -1,6 +1,8 @@ +import("system.logging"); import("system.neon"); import("system.vars"); import("system.result"); + if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.ObjectRowId_param") && vars.get("$param.ObjectRowId_param")) result.string(vars.get("$param.ObjectRowId_param")); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/objects/children/contactid_param/valueProcess.js b/entity/Order_entity/entityfields/objects/children/contactid_param/valueProcess.js index c5efd0f6d8a6d05a0f2f5e4585dfbc47fbbfdeb2..0d0a95eccca8e1e727a25fe04a1099d583af6471 100644 --- a/entity/Order_entity/entityfields/objects/children/contactid_param/valueProcess.js +++ b/entity/Order_entity/entityfields/objects/children/contactid_param/valueProcess.js @@ -1,3 +1,4 @@ +import("system.db"); import("system.result"); import("system.vars"); import("Contact_lib"); @@ -5,6 +6,9 @@ import("Contact_lib"); if (vars.get("$field.CONTACT_ID")) { var ids = ContactUtils.getPersOrgIds(vars.getString("$field.CONTACT_ID")); - if (ids.length >= 3 && ids[2]) - result.string(ids[2]); + if (ids.length >= 3 && ids[2]){ + result.string(db.cell("select CONTACTID from CONTACT" ++ " join ORGANISATION on ORGANISATIONID = ORGANISATION_ID" ++ " where ORGANISATION_ID = '" + ids[2] + "'" ++ " and PERSON_ID is null"))} } \ No newline at end of file diff --git a/entity/Order_entity/entityfields/orderlanguage_param/valueProcess.js b/entity/Order_entity/entityfields/orderlanguage_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..28676a75cab4da50168d2e44d2142abf7d8044e2 --- /dev/null +++ b/entity/Order_entity/entityfields/orderlanguage_param/valueProcess.js @@ -0,0 +1,8 @@ +import("system.logging"); +import("system.vars"); +import("system.db"); +import("system.result"); + +var salesorderid = vars.get("$field.SALESORDERID") +if(salesorderid) +result.string(db.cell("select ISOLANGUAGE from SALESORDER where SALESORDERID = '" + salesorderid + "'")) \ No newline at end of file diff --git a/entity/Order_entity/entityfields/ordertype_param/valueProcess.js b/entity/Order_entity/entityfields/ordertype_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/entity/Organisation_entity/Organisation_entity.aod b/entity/Organisation_entity/Organisation_entity.aod index bf3a396fb3289d386327a92f72f3fb29eca482ee..136ad209d51d2aa4aa2062c4f1be559dbd5c2769 100644 --- a/entity/Organisation_entity/Organisation_entity.aod +++ b/entity/Organisation_entity/Organisation_entity.aod @@ -1024,7 +1024,7 @@ <title>Start workflow</title> <onActionProcess>%aditoprj%/entity/Organisation_entity/entityfields/startworkflow/onActionProcess.js</onActionProcess> <iconId>VAADIN:PLAY</iconId> - <state>INVISIBLE</state> + <stateProcess>%aditoprj%/entity/Organisation_entity/entityfields/startworkflow/stateProcess.js</stateProcess> </entityActionField> <entityField> <name>STANDARD_ADDRESS</name> diff --git a/entity/Organisation_entity/entityfields/360degreeobjects/children/objectrowid_param/valueProcess.js b/entity/Organisation_entity/entityfields/360degreeobjects/children/objectrowid_param/valueProcess.js index 62e4d6f219cd56831a27306c7a8259352f7d55e2..fec3c0746a5f73b8b6a4e2e917954aad5e54d24b 100644 --- a/entity/Organisation_entity/entityfields/360degreeobjects/children/objectrowid_param/valueProcess.js +++ b/entity/Organisation_entity/entityfields/360degreeobjects/children/objectrowid_param/valueProcess.js @@ -2,9 +2,10 @@ import("Sql_lib"); import("system.vars"); import("system.result"); -var contactids = newSelect( "CONTACTID" ) +var person_contactids = newSelect( "CONTACTID" ) .from("CONTACT") .where("CONTACT.ORGANISATION_ID", vars.getString("$field.ORGANISATIONID")) + .and("CONTACT.PERSON_ID is null") .arrayColumn(); -result.string( JSON.stringify(contactids) ); \ No newline at end of file +result.string( JSON.stringify([vars.getString("$field.CONTACTID")].concat(person_contactids)) ); \ No newline at end of file diff --git a/entity/Organisation_entity/entityfields/startworkflow/stateProcess.js b/entity/Organisation_entity/entityfields/startworkflow/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..ef65dd9cffd2d6d81ae54a6ae35636ae946aff22 --- /dev/null +++ b/entity/Organisation_entity/entityfields/startworkflow/stateProcess.js @@ -0,0 +1,8 @@ +import("system.neon"); +import("Workflow_lib"); +import("system.result"); + +result.string(WorkflowUtils.engineIsEnabled() + ? neon.COMPONENTSTATE_EDITABLE + : neon.COMPONENTSTATE_INVISIBLE +); \ No newline at end of file diff --git a/entity/Person_entity/Person_entity.aod b/entity/Person_entity/Person_entity.aod index 9c15a53ce05a2a603c85f70aeaedae4e05017e1b..bf4a87910fc9c95a5533dbfd7fec120fa0d71506 100644 --- a/entity/Person_entity/Person_entity.aod +++ b/entity/Person_entity/Person_entity.aod @@ -1035,6 +1035,7 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact <isObjectAction v="false" /> <isSelectionAction v="true" /> <iconId>VAADIN:PLAY</iconId> + <stateProcess>%aditoprj%/entity/Person_entity/entityfields/campaignactiongroup/children/startmultipleworkflows/stateProcess.js</stateProcess> </entityActionField> </children> </entityActionGroup> @@ -1106,6 +1107,7 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact <title>Start workflow</title> <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/startworkflow/onActionProcess.js</onActionProcess> <iconId>VAADIN:PLAY</iconId> + <stateProcess>%aditoprj%/entity/Person_entity/entityfields/startworkflow/stateProcess.js</stateProcess> </entityActionField> <entityActionField> <name>openAdminView</name> diff --git a/entity/Person_entity/entityfields/campaignactiongroup/children/startmultipleworkflows/stateProcess.js b/entity/Person_entity/entityfields/campaignactiongroup/children/startmultipleworkflows/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..ef65dd9cffd2d6d81ae54a6ae35636ae946aff22 --- /dev/null +++ b/entity/Person_entity/entityfields/campaignactiongroup/children/startmultipleworkflows/stateProcess.js @@ -0,0 +1,8 @@ +import("system.neon"); +import("Workflow_lib"); +import("system.result"); + +result.string(WorkflowUtils.engineIsEnabled() + ? neon.COMPONENTSTATE_EDITABLE + : neon.COMPONENTSTATE_INVISIBLE +); \ No newline at end of file diff --git a/entity/Person_entity/entityfields/startworkflow/stateProcess.js b/entity/Person_entity/entityfields/startworkflow/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..ef65dd9cffd2d6d81ae54a6ae35636ae946aff22 --- /dev/null +++ b/entity/Person_entity/entityfields/startworkflow/stateProcess.js @@ -0,0 +1,8 @@ +import("system.neon"); +import("Workflow_lib"); +import("system.result"); + +result.string(WorkflowUtils.engineIsEnabled() + ? neon.COMPONENTSTATE_EDITABLE + : neon.COMPONENTSTATE_INVISIBLE +); \ No newline at end of file diff --git a/entity/Salesproject_entity/Salesproject_entity.aod b/entity/Salesproject_entity/Salesproject_entity.aod index c489c9b5d7b3950899a8aea8798523da302abc6d..6264e47b1343159fd643eb9d52ff7853825c145d 100644 --- a/entity/Salesproject_entity/Salesproject_entity.aod +++ b/entity/Salesproject_entity/Salesproject_entity.aod @@ -735,7 +735,7 @@ <title>Start workflow</title> <onActionProcess>%aditoprj%/entity/Salesproject_entity/entityfields/startworkflow/onActionProcess.js</onActionProcess> <iconId>VAADIN:PLAY</iconId> - <state>INVISIBLE</state> + <stateProcess>%aditoprj%/entity/Salesproject_entity/entityfields/startworkflow/stateProcess.js</stateProcess> </entityActionField> </entityFields> <recordContainers> diff --git a/entity/Salesproject_entity/entityfields/startworkflow/stateProcess.js b/entity/Salesproject_entity/entityfields/startworkflow/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..ef65dd9cffd2d6d81ae54a6ae35636ae946aff22 --- /dev/null +++ b/entity/Salesproject_entity/entityfields/startworkflow/stateProcess.js @@ -0,0 +1,8 @@ +import("system.neon"); +import("Workflow_lib"); +import("system.result"); + +result.string(WorkflowUtils.engineIsEnabled() + ? neon.COMPONENTSTATE_EDITABLE + : neon.COMPONENTSTATE_INVISIBLE +); \ No newline at end of file diff --git a/entity/SerialLetter_entity/onValidation.js b/entity/SerialLetter_entity/onValidation.js index ffb5740ed04599b2851d96fd4ff6aef611f0b05b..d0d694d8f85e0251a0d1ee7ebfd767e45e529ac3 100644 --- a/entity/SerialLetter_entity/onValidation.js +++ b/entity/SerialLetter_entity/onValidation.js @@ -5,4 +5,4 @@ import("DocumentTemplate_lib"); [content, type] = DocumentTemplateUtils.getTemplateContent(vars.get("$field.DOCUMENTTEMPLATE_ID"), new FileUpload(vars.get("$field.bindata"))); if (type != DocumentTemplate.types.ODT && (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT)) - result.string(DocumentTemplate.serialLetterODTOnlyMessage()); \ No newline at end of file + result.string(DocumentTemplate.getSerialLetterODTOnlyMessage()); \ No newline at end of file diff --git a/entity/WorkflowDefinition_entity/WorkflowDefinition_entity.aod b/entity/WorkflowDefinition_entity/WorkflowDefinition_entity.aod index 74998e878cfd0acc8289e3b51af2e46c2f7bd3a3..f7bbe40886f6601c68134ddaefd9114e4861d66d 100644 --- a/entity/WorkflowDefinition_entity/WorkflowDefinition_entity.aod +++ b/entity/WorkflowDefinition_entity/WorkflowDefinition_entity.aod @@ -3,6 +3,7 @@ <name>WorkflowDefinition_entity</name> <majorModelMode>DISTRIBUTED</majorModelMode> <title>Workflow definition</title> + <grantCreateProcess>%aditoprj%/entity/WorkflowDefinition_entity/grantCreateProcess.js</grantCreateProcess> <grantDelete v="false" /> <contentTitleProcess>%aditoprj%/entity/WorkflowDefinition_entity/contentTitleProcess.js</contentTitleProcess> <iconId>VAADIN:DROP</iconId> diff --git a/entity/WorkflowDefinition_entity/grantCreateProcess.js b/entity/WorkflowDefinition_entity/grantCreateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..93bb40efb619d7627f096d88bc8bcc67be15c46f --- /dev/null +++ b/entity/WorkflowDefinition_entity/grantCreateProcess.js @@ -0,0 +1,4 @@ +import("Workflow_lib"); +import("system.result"); + +result.object(WorkflowUtils.engineIsEnabled()); \ No newline at end of file diff --git a/entity/WorkflowDefinition_entity/recordcontainers/jdito/contentProcess.js b/entity/WorkflowDefinition_entity/recordcontainers/jdito/contentProcess.js index 2bd181e87346374beb8b6daffec4362244aaad50..6523e43702e8fd2ac39f3fbc8222069d5abd4eff 100644 --- a/entity/WorkflowDefinition_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/WorkflowDefinition_entity/recordcontainers/jdito/contentProcess.js @@ -5,87 +5,94 @@ import("Workflow_lib"); import("system.workflow"); import("JditoFilter_lib"); -var workflowKey = vars.get("$param.ProcessDefinitionKey_param"); -var excludeVersion = vars.get("$param.CurrentVersion_param"); -var context = vars.get("$param.Context_param"); -var idvalues = vars.get("$local.idvalues"); - -var workflowDefs; - -if (idvalues) +//immediately invoked function is used so that a return statement can be utilized to end the function at any point +result.object((function () { - var loadConfig = workflow.createConfigForLoadingProcessDefinitions() - .processDefinitionIds(idvalues); - workflowDefs = JSON.parse(workflow.getProcessDefinitions(loadConfig)); + if (!WorkflowUtils.engineIsEnabled()) + return []; - //after new-mode, the given uid is not the actual id, but the key, so if - //no workflow definitions were found, try it again with the key - if (workflowDefs.length === 0) - workflowDefs = _getDefinitionsByKey(idvalues[0]); -} -else -{ - workflowDefs = _getDefinitionsByKey(workflowKey); -} + var workflowKey = vars.get("$param.ProcessDefinitionKey_param"); + var excludeVersion = vars.get("$param.CurrentVersion_param"); + var context = vars.get("$param.Context_param"); + var idvalues = vars.get("$local.idvalues"); -//structure = {processDefinitionKey : highest_version} -var newestVersions = {}; + var workflowDefs; -workflowDefs = workflowDefs.map(function (def) -{ - //determine the most recent version of every definition - if (def.version > (newestVersions[def.key] || 0)) - newestVersions[def.key] = def.version; - - return [ - def.id, - def.name, - def.category, - def.key, - def.version, - def.active, - def.description || "" - ]; -}); + if (idvalues) + { + var loadConfig = workflow.createConfigForLoadingProcessDefinitions() + .processDefinitionIds(idvalues); + workflowDefs = JSON.parse(workflow.getProcessDefinitions(loadConfig)); -var possibleKeysMap = null; -if (context) -{ - possibleKeysMap = {}; - WorkflowUtils.getPossibleWorkflowDefinitions(context, $KeywordRegistry.workflowTrigger$manual()).forEach(function (key) + //after new-mode, the given uid is not the actual id, but the key, so if + //no workflow definitions were found, try it again with the key + if (workflowDefs.length === 0) + workflowDefs = _getDefinitionsByKey(idvalues[0]); + } + else { - this[key] = true; - }, possibleKeysMap); -} + workflowDefs = _getDefinitionsByKey(workflowKey); + } -var filterFn; -//if excludeVersion is set -> all definitions versions with a specific key are loaded -//if not -> load just the newest versions of all definitions -if (!excludeVersion) -{ - filterFn = function (currDef) + //structure = {processDefinitionKey : highest_version} + var newestVersions = {}; + + workflowDefs = workflowDefs.map(function (def) { - return newestVersions[currDef[3]] == currDef[4] && (possibleKeysMap ? possibleKeysMap[currDef[3]] : true); - }; -} -else -{ - filterFn = function (currDef) + //determine the most recent version of every definition + if (def.version > (newestVersions[def.key] || 0)) + newestVersions[def.key] = def.version; + + return [ + def.id, + def.name, + def.category, + def.key, + def.version, + def.active, + def.description || "" + ]; + }); + + var possibleKeysMap = null; + if (context) + { + possibleKeysMap = {}; + WorkflowUtils.getPossibleWorkflowDefinitions(context, $KeywordRegistry.workflowTrigger$manual()).forEach(function (key) + { + this[key] = true; + }, possibleKeysMap); + } + + var filterFn; + //if excludeVersion is set -> all definitions versions with a specific key are loaded + //if not -> load just the newest versions of all definitions + if (!excludeVersion) + { + filterFn = function (currDef) + { + return newestVersions[currDef[3]] == currDef[4] && (possibleKeysMap ? possibleKeysMap[currDef[3]] : true); + }; + } + else { - return excludeVersion != currDef[4]; - }; -} + filterFn = function (currDef) + { + return excludeVersion != currDef[4]; + }; + } -workflowDefs = workflowDefs.filter(filterFn); + workflowDefs = workflowDefs.filter(filterFn); -workflowDefs = JditoFilterUtils.filterRecords(["UID", "NAME", "CATEGORY", "KEY", "VERSION", "ISACTIVE"], workflowDefs, vars.get("$local.filter").filter); + workflowDefs = JditoFilterUtils.filterRecords(["UID", "NAME", "CATEGORY", "KEY", "VERSION", "ISACTIVE"], workflowDefs, vars.get("$local.filter").filter); -result.object(workflowDefs); + return workflowDefs; -function _getDefinitionsByKey (pKey) -{ - var config = workflow.createConfigForLoadingProcessDefinitions(); - if (pKey) - config.processDefinitionKey(pKey); - return JSON.parse(workflow.getProcessDefinitions(config)); -} \ No newline at end of file + function _getDefinitionsByKey (pKey) + { + var config = workflow.createConfigForLoadingProcessDefinitions(); + if (pKey) + config.processDefinitionKey(pKey); + return JSON.parse(workflow.getProcessDefinitions(config)); + } +})()); \ No newline at end of file diff --git a/entity/WorkflowTask_entity/recordcontainers/jdito/contentProcess.js b/entity/WorkflowTask_entity/recordcontainers/jdito/contentProcess.js index d5314b2e14b073c5abb246b2659118b73943a428..9005006abf7ec25a907adc49073eac84509848be 100644 --- a/entity/WorkflowTask_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/WorkflowTask_entity/recordcontainers/jdito/contentProcess.js @@ -11,70 +11,74 @@ import("Workflow_lib"); import("system.vars"); import("system.workflow"); -var isOnlyForCurrentUser = vars.exists("$param.OnlyForCurrentUser_param") && vars.get("$param.OnlyForCurrentUser_param") == "true"; +//immediately invoked function is used so that a return statement can be utilized to end the function at any point +result.object((function () +{ + if (!WorkflowUtils.engineIsEnabled()) + return []; + + var isOnlyForCurrentUser = vars.exists("$param.OnlyForCurrentUser_param") && vars.get("$param.OnlyForCurrentUser_param") == "true"; -var loadConfig = workflow.createConfigForLoadingTasks(); -var tasks, dummyTask; + var loadConfig = workflow.createConfigForLoadingTasks(); + var tasks; -if (vars.get("$local.idvalues") && vars.get("$local.idvalues")[0]) -{ - var taskId = vars.get("$local.idvalues")[0]; - loadConfig = workflow.createConfigForLoadingTask() - .taskId(taskId); - - //TODO: there shouldn't be an error - try { - tasks = [JSON.parse(workflow.getTask(loadConfig))]; - } - catch (err) + if (vars.get("$local.idvalues") && vars.get("$local.idvalues")[0]) { - //This can happen if the task is done, then it can't be loaded. If that's the case, return a dummy row - tasks = []; - var taskTitle = vars.exists("$param.TaskTitle_param") && vars.get("$param.TaskTitle_param") || ""; - dummyTask = [taskId, translate.text("Task done"), taskTitle, "", vars.get("$sys.date"), "", "", "", "", "", "", "", "", "", "", "", ""]; + var taskId = vars.get("$local.idvalues")[0]; + loadConfig = workflow.createConfigForLoadingTask() + .taskId(taskId); + + //TODO: there shouldn't be an error + try { + tasks = [JSON.parse(workflow.getTask(loadConfig))]; + } + catch (err) + { + //This can happen if the task is done, then it can't be loaded. If that's the case, return a dummy row + var taskTitle = vars.exists("$param.TaskTitle_param") && vars.get("$param.TaskTitle_param") || ""; + return [[taskId, translate.text("Task done"), taskTitle, "", vars.get("$sys.date"), "", "", "", "", "", "", "", "", "", "", "", ""]]; + } + } + else + { + // if (isOnlyForCurrentUser) + // loadConfig.candidateIdentifier(EmployeeUtils.getCurrentUserId()); + tasks = JSON.parse(workflow.getTasks(loadConfig)); } -} -else -{ -// if (isOnlyForCurrentUser) -// loadConfig.candidateIdentifier(EmployeeUtils.getCurrentUserId()); - tasks = JSON.parse(workflow.getTasks(loadConfig)); -} -tasks = tasks.map(function (task) -{ - var variables = JSON.parse(workflow.getTaskVariables(task.id)); - var targetTitle = ""; - if (variables.targetId && variables.targetContext) - targetTitle = ContextUtils.loadContentTitle(project.getContextStructure(variables.targetContext).entity, variables.targetId); - - var assigneeName = task.assignee ? ContextUtils.loadContentTitle("Employee_entity", task.assignee) : ""; - - return [ - task.id, - task.name, - task.processDefinitionId, - task.processInstanceId, - Date.parse(task.createTime).toString(), - workflow.getFormProperties(task.id), - "", - variables.USER_ID, - task.description || "", - task.category || "", - task.assignee || "", - assigneeName, - task.dueDate ? Date.parse(task.dueDate).toString() : "", - task.owner || "", - variables.targetContext || "", - variables.targetId || "", - targetTitle - ]; -}); + tasks = tasks.map(function (task) + { + var variables = JSON.parse(workflow.getTaskVariables(task.id)); + var targetTitle = ""; + if (variables.targetId && variables.targetContext) + targetTitle = ContextUtils.loadContentTitle(project.getContextStructure(variables.targetContext).entity, variables.targetId); + + var assigneeName = task.assignee ? ContextUtils.loadContentTitle("Employee_entity", task.assignee) : ""; + + return [ + task.id, + task.name, + task.processDefinitionId, + task.processInstanceId, + Date.parse(task.createTime).toString(), + workflow.getFormProperties(task.id), + "", + variables.USER_ID, + task.description || "", + task.category || "", + task.assignee || "", + assigneeName, + task.dueDate ? Date.parse(task.dueDate).toString() : "", + task.owner || "", + variables.targetContext || "", + variables.targetId || "", + targetTitle + ]; + }); -tasks = JditoFilterUtils.filterRecords(["UID", "NAME", "PROCESSDEFINITION_ID", "PROCESSINSTANCE_ID", - "CREATE_TIME", "FORMDEFINITION", "USER", "DESCRIPTION", "CATEGORY", "ASSIGNEE", "", "DUEDATE", "OWNER"], tasks, vars.get("$local.filter").filter); + tasks = JditoFilterUtils.filterRecords(["UID", "NAME", "PROCESSDEFINITION_ID", "PROCESSINSTANCE_ID", + "CREATE_TIME", "FORMDEFINITION", "USER", "DESCRIPTION", "CATEGORY", "ASSIGNEE", "", "DUEDATE", "OWNER"], tasks, vars.get("$local.filter").filter); -if (dummyTask) - tasks = [dummyTask]; -result.object(tasks); \ No newline at end of file + return tasks; +})()); \ No newline at end of file diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod index 1edf6e1f9b29c9e98b178546a3c300068429880b..cb85861453796c00b63d267476abcda4f803c6d1 100644 --- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod +++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod @@ -6068,6 +6068,9 @@ <entry> <key>Weitere Kontakte</key> </entry> + <entry> + <key>Task done</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 2b8594afe57550c4ab9eb71bc1ee765b4ad02287..02cbaeb8e0b3ab789f0842d11e0d8410ad4e9be2 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -1095,7 +1095,7 @@ </entry> <entry> <key>The expiry date must be after the start date!</key> - <value>Das Ende-Datum muss nach dem Beginn-Datum liegen!</value> + <value>Das Fällig-Datum muss nach dem Beginn-Datum liegen!</value> </entry> <entry> <key>Product</key> diff --git a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod index d6f8d786842679949ca39a7713e407a0974f636e..1046ff8c697f07b596951ec0956801e7821eaa8a 100644 --- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod +++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod @@ -6118,6 +6118,9 @@ <entry> <key>Weitere Kontakte</key> </entry> + <entry> + <key>Task done</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> </language> diff --git a/preferences/_____PREFERENCES_PROJECT/_____PREFERENCES_PROJECT.aod b/preferences/_____PREFERENCES_PROJECT/_____PREFERENCES_PROJECT.aod index b0814c5c3d9e16a842db6130cfe6ee8463280e24..7f6a38c783fb6b440b99260f8d2f0c91ef54f27b 100644 --- a/preferences/_____PREFERENCES_PROJECT/_____PREFERENCES_PROJECT.aod +++ b/preferences/_____PREFERENCES_PROJECT/_____PREFERENCES_PROJECT.aod @@ -4,7 +4,7 @@ <majorModelMode>DISTRIBUTED</majorModelMode> <customized /> <mailGlobalUserServerEnabled v="true" /> - <projectName>xRM-Basic2019</projectName> + <projectName>ADITO xRM</projectName> <jditoMaxContentSize v="57671680" /> <mailEnableUserDefault v="true" /> <mailDefaultMailserver>mailServerIMAP</mailDefaultMailserver> diff --git a/process/Bulkmail_lib/process.js b/process/Bulkmail_lib/process.js index 8a8e82712078510a638a31aa75519bcd2bbf1dbd..ed01a6c323b20ac02645adb1d757d883a96db58e 100644 --- a/process/Bulkmail_lib/process.js +++ b/process/Bulkmail_lib/process.js @@ -14,6 +14,7 @@ import("Communication_lib"); import("Email_lib"); import("system.process"); import("system.notification"); +import("Document_lib"); /** * functions for bulk mails @@ -215,11 +216,15 @@ BulkMailUtils.addRecipients = function (pBulkMailId, pContactIds) * @param {String} pDocumentTemplateId documentTemplate id * @param {Boolean} [pResolveSubtemplates=true] if true subtemplates are resolved (if the type is html) * @param {Boolean} [pUseTemplateAttachments=false] if true the attachments from the document template is always used + * @param {FileUpload} [pUpload] the upload value if a custom template is used * * @return {DocumentTemplate} the document template, null if no content was found. */ -BulkMailUtils.getBulkMailTemplate = function (pBulkMailId, pDocumentTemplateId, pResolveSubtemplates, pUseTemplateAttachments) +BulkMailUtils.getBulkMailTemplate = function (pBulkMailId, pDocumentTemplateId, pResolveSubtemplates, pUseTemplateAttachments, pUpload) { + if (pUpload.isFilled() && BulkMailUtils.isValidMimeType(pUpload.mimeType)) + return DocumentTemplate.fromUpload(pUpload); + var bulkTemplate = DocumentTemplate.loadTemplate(pBulkMailId, "BULKMAIL", pResolveSubtemplates); var documentTemplate = DocumentTemplate.loadTemplate(pDocumentTemplateId, undefined, pResolveSubtemplates); diff --git a/process/DocumentTemplate_lib/process.js b/process/DocumentTemplate_lib/process.js index 1ddaeb70fb8130999650d1ac82683507c41cf95c..7630a1c2fea10e5f8a2dc64b6de2fcddda44fd91 100644 --- a/process/DocumentTemplate_lib/process.js +++ b/process/DocumentTemplate_lib/process.js @@ -460,11 +460,11 @@ DocumentTemplate.prototype.getSerialLetterByContactIds = function (pContactIds, return TemplateHelper._getReplacedODT(this, replaceArray, pTableData); } - question.showMessage(DocumentTemplate.serialLetterODTOnlyMessage, question.INFORMATION, translate.text("Action not supported")) + question.showMessage(DocumentTemplate.getSerialLetterODTOnlyMessage(), question.INFORMATION, translate.text("Action not supported")) return null; } -DocumentTemplate.serialLetterODTOnlyMessage = function() +DocumentTemplate.getSerialLetterODTOnlyMessage = function() { return translate.text("Only .odt files are supported for bulkletters."); } diff --git a/process/DocxTemplater_lib/process.js b/process/DocxTemplater_lib/process.js index adf217f2b739980971bd8ccbda0c9530f44043ae..e9cd6c748fa3f8ba17d1c5c13795ee659ab3459d 100644 --- a/process/DocxTemplater_lib/process.js +++ b/process/DocxTemplater_lib/process.js @@ -33,6 +33,7 @@ if (pStartDelimiter) docx.delimiters.start = pStartDelimiter; if (pEndDelimiter) docx.delimiters.end = pEndDelimiter; + docx.attachModule(_getAutoNewLineModule()); docx = docx.loadZip(zip); @@ -66,33 +67,25 @@ function _getAutoNewLineModule() var res = { name: moduleName, parse: function parse(placeHolderContent) { - var type = "placeholder"; - if (placeHolderContent[0] !== "=") - { - return null; - } + if (placeHolderContent[0] === "=") + placeHolderContent = placeHolderContent.substr(1); + return { - type: type, - value: placeHolderContent.substr(1), + type: "placeholder", + value: placeHolderContent, module: moduleName }; - }, render: function render(part, options) { if (part.module !== moduleName) - { return null; - } + var value = options.scopeManager.getValue(part.value); if (value == null) - { value = options.nullGetter(part); - } else - { - value = value.replace(/(\r\n)|(\n)|(\r)/g, "<w:br/>"); - } + value = value.replace(/(\r\n)|(\n)|(\r)/g, "\n<w:br/>"); return { value: value @@ -100,7 +93,6 @@ function _getAutoNewLineModule() } } - return res; } @@ -601,7 +593,7 @@ exports.dosPermissions = null; var utils = require('./utils'); /** - * + * * This function will be removed in a future version without replacement. */ exports.string2binary = function(str) { @@ -609,7 +601,7 @@ exports.string2binary = function(str) { }; /** - * + * * This function will be removed in a future version without replacement. */ exports.string2Uint8Array = function(str) { @@ -617,7 +609,7 @@ exports.string2Uint8Array = function(str) { }; /** - * + * * This function will be removed in a future version without replacement. */ exports.uint8Array2String = function(array) { @@ -625,7 +617,7 @@ exports.uint8Array2String = function(array) { }; /** - * + * * This function will be removed in a future version without replacement. */ exports.string2Blob = function(str) { @@ -634,7 +626,7 @@ exports.string2Blob = function(str) { }; /** - * + * * This function will be removed in a future version without replacement. */ exports.arrayBuffer2Blob = function(buffer) { @@ -642,7 +634,7 @@ exports.arrayBuffer2Blob = function(buffer) { }; /** - * + * * This function will be removed in a future version without replacement. */ exports.transformTo = function(outputType, input) { @@ -650,7 +642,7 @@ exports.transformTo = function(outputType, input) { }; /** - * + * * This function will be removed in a future version without replacement. */ exports.getTypeOf = function(input) { @@ -658,7 +650,7 @@ exports.getTypeOf = function(input) { }; /** - * + * * This function will be removed in a future version without replacement. */ exports.checkSupport = function(type) { @@ -666,20 +658,20 @@ exports.checkSupport = function(type) { }; /** - * + * * This value will be removed in a future version without replacement. */ exports.MAX_VALUE_16BITS = utils.MAX_VALUE_16BITS; /** - * + * * This value will be removed in a future version without replacement. */ exports.MAX_VALUE_32BITS = utils.MAX_VALUE_32BITS; /** - * + * * This function will be removed in a future version without replacement. */ exports.pretty = function(str) { @@ -687,7 +679,7 @@ exports.pretty = function(str) { }; /** - * + * * This function will be removed in a future version without replacement. */ exports.findCompression = function(compressionMethod) { @@ -695,7 +687,7 @@ exports.findCompression = function(compressionMethod) { }; /** - * + * * This function will be removed in a future version without replacement. */ exports.isRegExp = function (object) { @@ -779,21 +771,21 @@ JSZip.support = require('./support'); JSZip.defaults = require('./defaults'); /** - * + * * This namespace will be removed in a future version without replacement. */ JSZip.utils = require('./deprecatedPublicUtils'); JSZip.base64 = { /** - * + * * This method will be removed in a future version without replacement. */ encode : function(input) { return base64.encode(input); }, /** - * + * * This method will be removed in a future version without replacement. */ decode : function(input) { @@ -3294,7 +3286,7 @@ function Deflate(options) { this._dict_set = true; } - + return undefined; } @@ -9771,7 +9763,7 @@ function initTemplater() s(r[o]); return s })({ - 1: [function (require, module, exports) + 1: [function (require, module, exports) { function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } @@ -11970,7 +11962,7 @@ copy(NodeType,Node); copy(NodeType,Node.prototype); /** - * @param node + * @param node * @param callback return true for continue,false for break * @return boolean true: break visit; */ @@ -12543,7 +12535,7 @@ function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){ var prefix; var uri; var ns; - + isHTML = (htmlns === node.namespaceURI) ||isHTML buf.push('<',nodeName); @@ -12888,7 +12880,7 @@ function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){ var closeMap = {}; var start = 0; var end; - + while(true){ try{ var tagStart = source.indexOf('<',start); @@ -13197,7 +13189,7 @@ function appendElement(el,domBuilder,currentNSMap){ var localNSMap = null; var nsp; var prefix; - + //var currentNSMap = parseStack[parseStack.length-1].currentNSMap; var i = el.length; while(i--){ @@ -13632,4 +13624,4 @@ module.exports = Docxtemplater; }); } -} \ No newline at end of file +} diff --git a/process/Order_lib/process.js b/process/Order_lib/process.js index 4e61d24cea2e2dbef6410e514180b0ac951e7894..b4ef3fa6d02ee66e7cd947cfb33db0afaa335cc5 100644 --- a/process/Order_lib/process.js +++ b/process/Order_lib/process.js @@ -93,13 +93,13 @@ OrderUtils.createNewOrder = function(pContextId, pRowId, pRelationId) } //TODO refactor function to minimize the params and only give an object that contains the data -OrderUtils.copyOrder = function (pOfferId, pContactId, pOrderType, pLanguage, pCurrency, pHeader, pFooter, pDeliveryTerm, pPaymentTerm, pPaymentAddress, pDeliveryAddress, pObjectType, pRowId, pDunningDate, pDunningLevel, pCancellation, pOrderStatus) +OrderUtils.copyOrder = function (pSourceOfferId, pContactId, pOrderType, pLanguage, pCurrency, pHeader, pFooter, pDeliveryTerm, pPaymentTerm, pPaymentAddress, pDeliveryAddress, pObjectType, pRowId, pDunningDate, pDunningLevel, pCancellation, pOrderStatus) { var params = { "ContactId_param" : pContactId, "OrderType_param" : pOrderType, "OrderLanguage_param" : pLanguage, - "OfferId_param" : pOfferId, + "OfferId_param" : pSourceOfferId, "OrderCurrency_param" : pCurrency || "", "OrderHeader_param" : pHeader || "", "OrderFooter_param" : pFooter || "", @@ -121,10 +121,10 @@ OrderUtils.copyOrder = function (pOfferId, pContactId, pOrderType, pLanguage, pC /** * copies all offerItems of an offer and creates orderItems for an order * - * @param {String} pOfferId the offer to get the items from - * @param {String} pOrderId the order to create the items for + * @param {String} pSourceOfferId the offer to get the items from + * @param {String} pSourceOfferId the order to create the items for */ -OrderUtils.copyOfferItemsToOrder = function (pOfferId, pOrderId) +OrderUtils.copyOfferItemsToOrder = function (pSourceOfferId, pSourceOfferId) { var InputMapping = { "OFFERITEM": { @@ -146,21 +146,21 @@ OrderUtils.copyOfferItemsToOrder = function (pOfferId, pOrderId) "INFO" : "INFO", "VAT" : "VAT" }, - condition: newWhereIfSet("OFFERITEM.OFFER_ID", pOfferId).orderBy("ITEMSORT").toString("1=2", true), + condition: newWhereIfSet("OFFERITEM.OFFER_ID", pSourceOfferId).orderBy("ITEMSORT").toString("1=2", true), ValueMapping: { - "OFFER_ID" : pOrderId + "OFFER_ID" : pSourceOfferId } } }; CopyModuleUtils.copyModule(InputMapping); - var oiUtils = new OrderItemUtils(pOrderId); + var oiUtils = new OrderItemUtils(pSourceOfferId); //update order price cols = ["NET", "VAT"]; var vals = oiUtils.getNetAndVat(); - newWhere("SALESORDER.SALESORDERID", pOrderId) + newWhere("SALESORDER.SALESORDERID", pSourceOfferId) .updateData(true, "SALESORDER", cols, null, vals); } @@ -435,14 +435,13 @@ OrderUtils.openReminderReport = function (pOrderID) "''" ]; - var orderItemSql = newSelect(orderItemFields) + var itemData = newSelect(orderItemFields) .from("SALESORDERITEM") - .leftJoin("PRODUCT", "PRODUCT.PRODUCTID = SALESORDERITEM.PRODUCT_I") + .leftJoin("PRODUCT", "PRODUCT.PRODUCTID = SALESORDERITEM.PRODUCT_ID") .where("SALESORDERITEM.SALESORDER_ID", pOrderID) .table(); - var itemData = db.table(orderItemSql); - + if (itemData.length == 0) return; @@ -558,9 +557,9 @@ OrderUtils.openReminderReport = function (pOrderID) * * @class */ -function OrderItemUtils(pOrderId) { +function OrderItemUtils(pSourceOfferId) { // extends ItemUtils - ItemUtils.apply(this, [pOrderId, "SALESORDER"]); + ItemUtils.apply(this, [pSourceOfferId, "SALESORDER"]); OrderItemUtils.prototype = Object.create(ItemUtils.prototype); OrderItemUtils.prototype.constructor = OrderItemUtils; } diff --git a/process/Sql_lib/documentation.adoc b/process/Sql_lib/documentation.adoc index f0e32539c1726c632465abe3efc5c8bc1e45a128..c3695fa62fe5bda13b6769f9f8f973f25682e893 100644 --- a/process/Sql_lib/documentation.adoc +++ b/process/Sql_lib/documentation.adoc @@ -274,6 +274,26 @@ var costData = newSelect("CAMPAIGNCOSTID, CAMPAIGNSTEP_ID, CAMPAIGNSTEP.NAME, CA `orderBy(pFields)` adds an order by statement to the SQL code. The parameter can be filled the same way as `.select(pFields)`. +=== building the SQL statement + +==== prepared array + +`.build(pDefaultConditionIfNone)` generates a prepared-statement array from the SqlBuilder in the correct form for several `db.` functions. + +==== string + +`.toString(pDefaultConditionIfNone)` translates the query into a SQL-string. + +==== When to use build and when to use toString + +`.build()` has to be called before the statement is given to a `db.` method, like `db.cell()` or `db.table()`. But SqlBuilder also provides own functions for executing the query, if you use these, you don't need `.build()`. These methods are explained in the next chapter. Because of a more concise syntax and additional checks that are done in these functions, you should prefer them over the default `db.` methods. + +NOTE: Because `.build()` returns an array, you can't use it in combination with `result.string()`. + +`.toString()` is for cases where you need the query as string, but you should prefer `.build()` whenever possible. Processes like the "conditionProcess" in a dbRecordContainer and the "expression" from a dbRecordContainer field require a string as result, so you should use it there. If `result.string()` is used, you can omit the `.toString()`, since it would then be called implicitly. + +TIP: `.toString()` can be useful for logging, as you get an easy to read SQL string. + === db. function wrappers ==== select functions diff --git a/process/Sql_lib/process.js b/process/Sql_lib/process.js index 97d2c25b266af6b9eb7a1139fff5a3f222607dff..baa6677781ccac0bb18627aad1ad4275fbf2062e 100644 --- a/process/Sql_lib/process.js +++ b/process/Sql_lib/process.js @@ -993,7 +993,7 @@ SqlBuilder.prototype.select = function(pFields) */ SqlBuilder.prototype.selectDistinct = function (pFields) { - this._select = this._getClause(pFields, "select distinct", true); + this._select = SqlBuilder._getStatement(pFields, "select distinct", undefined, true, true); return this; } diff --git a/process/Workflow_lib/process.js b/process/Workflow_lib/process.js index b4ada19acc54c6912019448e5ef387cca1519b88..67b4340100ad618ec80c194e934d71b8eccbade7 100644 --- a/process/Workflow_lib/process.js +++ b/process/Workflow_lib/process.js @@ -1,3 +1,4 @@ +import("system.project"); import("Sql_lib"); import("system.neon"); import("Context_lib"); @@ -39,7 +40,7 @@ WorkflowUtils.openNewInstance = function (pVariables, pTargetId, pTargetContext) neon.openContext("WorkflowInstance", null, null, neon.OPERATINGSTATE_NEW, { "ProcessVariables_param" : JSON.stringify(pVariables), - "TargetContext_param" : pTargetContext + "TargetContext_param" : pVariables.targetContext }); } @@ -71,6 +72,14 @@ WorkflowUtils.appendMandatoryVariables = function (pVariables, pTargetId, pTarge return pVariables; } +/** + * @return {boolean} if the workflow engine is enabled + */ +WorkflowUtils.engineIsEnabled = function () +{ + return project.getInstanceConfigValue("workflowEngineEnabled", "false") == "true"; +} + function WorkflowStarter () {} WorkflowStarter.TRIGGER_INSERT = function ()