From b38516db7defe1cf782e9f92d785f24eedf2c2d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20V=C3=B6gl?= <a.voegl@adito.de> Date: Mon, 30 Nov 2020 16:45:27 +0000 Subject: [PATCH] [Projekt: Entwicklung - xRM][TicketNr.: 1061957][360 Grad: Umbenennung ViewTemplate Treetable -> Tree] [Projekt: Entwicklung - xRM][TicketNr.: 1053175][Erweiterte 360-Grad Ansicht] --- .../translate4log/property.js | 2 +- entity/360Degree_entity/360Degree_entity.aod | 55 +- entity/360Degree_entity/documentation.adoc | 25 +- .../newcampaignparticipant/stateProcess.js | 4 +- .../children/newcontract/stateProcess.js | 4 +- .../children/newoffer/stateProcess.js | 4 +- .../children/neworder/stateProcess.js | 4 +- .../children/newsalesproject/stateProcess.js | 4 +- .../children/objecttype_param/valueProcess.js | 19 +- .../children/objecttype_param/valueProcess.js | 12 +- .../entityfields/year/valueProcess.js | 6 - .../recordcontainers/jdito/contentProcess.js | 162 ++--- .../object_rowid/displayValueProcess.js | 2 +- .../objectid/displayValueProcess.js | 2 +- .../AttributeUsage_entity.aod | 4 - .../getallcontexts_param/valueProcess.js | 2 - entity/Attribute_entity/Attribute_entity.aod | 4 - .../getallcontexts_param/valueProcess.js | 3 - .../CampaignStep_entity.aod | 1 + .../contentDescriptionProcess.js | 5 + entity/Campaign_entity/Campaign_entity.aod | 8 + .../contentDescriptionProcess.js | 5 + .../active.value/expression.js | 6 + .../Competition_entity/Competition_entity.aod | 4 - .../object_rowid/displayValueProcess.js | 2 +- .../object_rowid.displayvalue/expression.js | 4 - entity/Context_entity/Context_entity.aod | 5 - .../recordcontainers/jdito/contentProcess.js | 3 +- entity/Contract_entity/Contract_entity.aod | 15 + .../contentDescriptionProcess.js | 16 + entity/Contract_entity/contentTitleProcess.js | 4 +- .../active.value/expression.js | 6 + .../DocumentTemplatePlaceOfUse_entity.aod | 4 - .../getallcontexts_param/valueProcess.js | 3 - entity/Forecast_entity/Forecast_entity.aod | 4 - .../object_rowid/displayValueProcess.js | 2 +- .../object_rowid.displayvalue/expression.js | 4 - .../Leadimport_entity/Leadimport_entity.aod | 9 + .../contentDescriptionProcess.js | 5 + entity/Member_entity/Member_entity.aod | 4 - .../object_rowid/displayValueProcess.js | 2 +- .../object_rowid.displayvalue/expression.js | 10 - .../target_id/displayValueProcess.js | 2 +- .../recordcontainers/jdito/contentProcess.js | 2 +- entity/Object_entity/Object_entity.aod | 8 + .../recordcontainers/jdito/contentProcess.js | 2 +- entity/Offer_entity/Offer_entity.aod | 12 +- .../Offer_entity/contentDescriptionProcess.js | 12 + entity/Offer_entity/contentTitleProcess.js | 4 +- .../object_rowid/displayValueProcess.js | 2 +- .../active.value/expression.js | 6 + .../object_rowid.displayvalue/expression.js | 4 - entity/Order_entity/Order_entity.aod | 219 +++--- .../Order_entity/contentDescriptionProcess.js | 19 + entity/Order_entity/contentTitleProcess.js | 7 +- .../object_rowid/displayValueProcess.js | 2 +- .../active.value/expression.js | 6 + .../object_rowid.displayvalue/expression.js | 4 - .../offer_id.displayvalue/expression.js | 5 - .../Organisation_entity.aod | 1 + .../contentDescriptionProcess.js | 5 + entity/Product_entity/Product_entity.aod | 1 + .../contentDescriptionProcess.js | 5 + .../contact_id/displayValueProcess.js | 2 +- .../Salesproject_entity.aod | 267 +++---- .../contentDescriptionProcess.js | 14 + .../contentTitleProcess.js | 4 +- .../active.value/expression.js | 6 + .../SupportTicket_entity.aod | 15 + .../contentDescriptionProcess.js | 18 + .../contentTitleProcess.js | 7 +- .../active.value/expression.js | 7 + .../object_rowid/displayValueProcess.js | 2 +- entity/Task_entity/Task_entity.aod | 4 + .../Task_entity/contentDescriptionProcess.js | 5 + .../WorkflowStartConfig_entity.aod | 4 - .../getallcontexts_param/valueProcess.js | 3 - .../_____LANGUAGE_de/_____LANGUAGE_de.aod | 4 + neonContext/SupportTicket/SupportTicket.aod | 1 + .../360DegreeFilter_view.aod | 15 +- process/Context_lib/process.js | 669 +++++------------- process/Order_lib/process.js | 2 +- process/Util_lib/process.js | 135 +++- 83 files changed, 989 insertions(+), 972 deletions(-) delete mode 100644 entity/360Degree_entity/entityfields/year/valueProcess.js delete mode 100644 entity/AttributeUsage_entity/entityfields/context/children/getallcontexts_param/valueProcess.js delete mode 100644 entity/Attribute_entity/entityfields/contexts/children/getallcontexts_param/valueProcess.js create mode 100644 entity/CampaignStep_entity/contentDescriptionProcess.js create mode 100644 entity/Campaign_entity/contentDescriptionProcess.js create mode 100644 entity/Campaign_entity/recordcontainers/db/recordfieldmappings/active.value/expression.js delete mode 100644 entity/Competition_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js create mode 100644 entity/Contract_entity/contentDescriptionProcess.js create mode 100644 entity/Contract_entity/recordcontainers/db/recordfieldmappings/active.value/expression.js delete mode 100644 entity/DocumentTemplatePlaceOfUse_entity/entityfields/contextdocumenttemplateplaceofuse/children/getallcontexts_param/valueProcess.js delete mode 100644 entity/Forecast_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js create mode 100644 entity/Leadimport_entity/contentDescriptionProcess.js delete mode 100644 entity/Member_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js create mode 100644 entity/Offer_entity/contentDescriptionProcess.js create mode 100644 entity/Offer_entity/recordcontainers/db/recordfieldmappings/active.value/expression.js delete mode 100644 entity/Offer_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js create mode 100644 entity/Order_entity/contentDescriptionProcess.js create mode 100644 entity/Order_entity/recordcontainers/db/recordfieldmappings/active.value/expression.js delete mode 100644 entity/Order_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js delete mode 100644 entity/Order_entity/recordcontainers/db/recordfieldmappings/offer_id.displayvalue/expression.js create mode 100644 entity/Organisation_entity/contentDescriptionProcess.js create mode 100644 entity/Product_entity/contentDescriptionProcess.js create mode 100644 entity/Salesproject_entity/contentDescriptionProcess.js create mode 100644 entity/Salesproject_entity/recordcontainers/db/recordfieldmappings/active.value/expression.js create mode 100644 entity/SupportTicket_entity/contentDescriptionProcess.js create mode 100644 entity/SupportTicket_entity/recordcontainers/db/recordfieldmappings/active.value/expression.js create mode 100644 entity/Task_entity/contentDescriptionProcess.js delete mode 100644 entity/WorkflowStartConfig_entity/entityfields/contexts/children/getallcontexts_param/valueProcess.js diff --git a/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/salesorder/entityfields/object_rowid/customproperties/translate4log/property.js b/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/salesorder/entityfields/object_rowid/customproperties/translate4log/property.js index aa7a1fe2a0..7305220193 100644 --- a/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/salesorder/entityfields/object_rowid/customproperties/translate4log/property.js +++ b/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/salesorder/entityfields/object_rowid/customproperties/translate4log/property.js @@ -12,4 +12,4 @@ var type = newSelect("OBJECT_TYPE") .where("SALESORDER.SALESORDERID", params.rowId) .cell(); -result.string(db.cell(ContextUtils.getNameSql(type, params.value))); +result.string(ContextUtils.getTitleByContext(type, params.value)); diff --git a/entity/360Degree_entity/360Degree_entity.aod b/entity/360Degree_entity/360Degree_entity.aod index 62c86300ec..f527d3b4eb 100644 --- a/entity/360Degree_entity/360Degree_entity.aod +++ b/entity/360Degree_entity/360Degree_entity.aod @@ -15,6 +15,7 @@ </siblings> <grantUpdate v="false" /> <grantDelete v="false" /> + <titlePlural>Links</titlePlural> <recordContainer>jdito</recordContainer> <entityFields> <entityProvider> @@ -25,6 +26,7 @@ </entityField> <entityField> <name>TITLE</name> + <title>Title</title> <linkedContextProcess>%aditoprj%/entity/360Degree_entity/entityfields/title/linkedContextProcess.js</linkedContextProcess> </entityField> <entityParameter> @@ -71,11 +73,10 @@ <entityField> <name>ENTITY_NAME</name> <title>Module</title> - <groupable v="true" /> <valueProcess>%aditoprj%/entity/360Degree_entity/entityfields/entity_name/valueProcess.js</valueProcess> </entityField> <entityField> - <name>DATE</name> + <name>DATE_NEW</name> <title>Date</title> <contentType>DATE</contentType> <resolution>DAY</resolution> @@ -105,12 +106,6 @@ </entityParameter> </children> </entityProvider> - <entityField> - <name>YEAR</name> - <title>Year</title> - <groupable v="true" /> - <valueProcess>%aditoprj%/entity/360Degree_entity/entityfields/year/valueProcess.js</valueProcess> - </entityField> <entityActionGroup> <name>newModule</name> <title>New module</title> @@ -166,13 +161,6 @@ <contentType>IMAGE</contentType> <valueProcess>%aditoprj%/entity/360Degree_entity/entityfields/icon/valueProcess.js</valueProcess> </entityField> - <entityField> - <name>ACTIVE</name> - <title>Active</title> - <contentType>TEXT</contentType> - <groupable v="true" /> - <dropDownProcess>%aditoprj%/entity/360Degree_entity/entityfields/active/dropDownProcess.js</dropDownProcess> - </entityField> <entityParameter> <name>BaseContextId_param</name> <expose v="true" /> @@ -185,6 +173,25 @@ <name>#PROVIDER_AGGREGATES</name> <useAggregates v="true" /> </entityProvider> + <entityField> + <name>GROUP</name> + <title>Group</title> + <groupable v="true" /> + </entityField> + <entityField> + <name>DESCRIPTION</name> + <title>Description</title> + </entityField> + <entityField> + <name>YEAR</name> + <title>Year</title> + <groupable v="true" /> + </entityField> + <entityField> + <name>ACTIVE</name> + <title>Active</title> + <dropDownProcess>%aditoprj%/entity/360Degree_entity/entityfields/active/dropDownProcess.js</dropDownProcess> + </entityField> </entityFields> <recordContainers> <jDitoRecordContainer> @@ -203,20 +210,32 @@ <jDitoRecordFieldMapping> <name>TARGET_CONTEXT.value</name> </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>TARGET_CONTEXT.displayValue</name> + </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>TITLE.value</name> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> - <name>DATE.value</name> + <name>DESCRIPTION.value</name> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> - <name>ACTIVE.value</name> + <name>DATE_NEW.value</name> <isFilterable v="true" /> - <isLookupFilter v="true" /> + </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>YEAR.value</name> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>ENTITY_NAME.value</name> </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>GROUP.value</name> + </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>ACTIVE.value</name> + <isFilterable v="true" /> + </jDitoRecordFieldMapping> </recordFieldMappings> </jDitoRecordContainer> </recordContainers> diff --git a/entity/360Degree_entity/documentation.adoc b/entity/360Degree_entity/documentation.adoc index d14c31a7c9..b2ad150c07 100644 --- a/entity/360Degree_entity/documentation.adoc +++ b/entity/360Degree_entity/documentation.adoc @@ -3,9 +3,9 @@ The 360Degree_entity shows the Connection between data models. The entity has two providers for persons and organizations. -The 360Degree_entity shows direct connections, don´t be confused with the ObjectRelation_entity. +The 360Degree_entity shows direct connections, don´t be confused with the ObjectRelation_entity. -== Adding new modules to the 360° view +== Adding new modules to the 360° view You may want to display more modules within the 360degree view (for example after creating and implemeting your own module). .An Example: @@ -14,6 +14,23 @@ display it in the 360degree view. Heres is a list of what you need to do whenever you want to do this: -- Add an entry in the function `ContextUtils.getSelectMap` which is located in the `Context_lib` (check out the documentation there for further details). _Speaking of the example above you need to define there how to retrieve the t-shirt-data for a contact_ +- At first you have to fill/add certain Fields/Processes in your new Context. + - Add (These have to be written exactly like that, if not already existing): + - CONTACT_ID, this Field has to contain a CONTACTID. That will be used to find the Connection to your Person or your Organisation. + - DATE_NEW, this Field has to contain a Date as a Long Value. That will be used as the Date Value you can see in the Timeline View-Template. + - ACTIVE, in this Field you can specify which Datasets are active or not. You have to declare that in the Value Expression as a Case-When due to the Filter + - Fill (these can be filled in the specific Entity as a Process) + - #CONTENTTITLE, this will be the main display Text and the blue Link + - #CONTENTDESCRIPTION, this will be the smaller, mostly longer, Text beneath the #CONTENTTITLE + +- Add an elemnt (with the name of the context you want to add) in the process of the `ObjectType_param` in the *corresponding provider* which is located in the `360Degree_entity`. _We would extend the JSON-Object which is returned in the `PersonObjects`-provider by the name of our t-shirt-context: "TShirt" in our example +- +- In that JSON-Object can also add some Configuration Elements to change the results. + - setGroupBy: here you can declare a DB-Column that will be used as the new group by of that context. A good example is Order. We want to group by the Ordertype so we have to declare ORDERTYPE as our groupBy. + - If your DB-Value is related to a Keyword you also have to use groupByKeyword and add the Container as Value -- Add an entry (with the name of the context you want to add) in the process of the `ObjectType_param` in the *corresponding provider* which is located in the `360Degree_entity`. _We would extend the array which is returned in the `PersonObjects`-provider by the name of our t-shirt-context: "TShirt" in our example_ \ No newline at end of file +- If you have a Connection of 1:N in your Database Schema (like Activity and ActivityLink) you have to add specific Properties in your Context Object. Lets take ActivityLink as a Example. + - subContext: the Name of the "Link"-Context -> ActivityLink + - childField: The Field where the LinkID to your Parent is stored -> ACTIVITY_ID + - parentField: The field in your Parent Context where your Connection to your Child is stored -> ACTIVITYID + - contactIdField: The Field in the Link Context where your Contactid is stored -> OBJECT_ROWID \ No newline at end of file diff --git a/entity/360Degree_entity/entityfields/newmodule/children/newcampaignparticipant/stateProcess.js b/entity/360Degree_entity/entityfields/newmodule/children/newcampaignparticipant/stateProcess.js index 353aa9f367..fbdfd3fd2e 100644 --- a/entity/360Degree_entity/entityfields/newmodule/children/newcampaignparticipant/stateProcess.js +++ b/entity/360Degree_entity/entityfields/newmodule/children/newcampaignparticipant/stateProcess.js @@ -7,11 +7,11 @@ if (contextList) { var found = false; - contextList.forEach(function (context) + for(context in contextList) { if(context == "Campaign") found = true; - }); + } if(found) result.string(neon.COMPONENTSTATE_AUTO); else diff --git a/entity/360Degree_entity/entityfields/newmodule/children/newcontract/stateProcess.js b/entity/360Degree_entity/entityfields/newmodule/children/newcontract/stateProcess.js index f1cfb31058..64c597b2e1 100644 --- a/entity/360Degree_entity/entityfields/newmodule/children/newcontract/stateProcess.js +++ b/entity/360Degree_entity/entityfields/newmodule/children/newcontract/stateProcess.js @@ -6,11 +6,11 @@ var contextList = JSON.parse(vars.getString("$param.ObjectType_param")); if (contextList) { var found = false; - contextList.forEach(function (context) + for(context in contextList) { if(context == "Contract") found = true; - }); + } if(found) result.string(neon.COMPONENTSTATE_AUTO); else diff --git a/entity/360Degree_entity/entityfields/newmodule/children/newoffer/stateProcess.js b/entity/360Degree_entity/entityfields/newmodule/children/newoffer/stateProcess.js index 02a2b07b69..ce3eb11c9b 100644 --- a/entity/360Degree_entity/entityfields/newmodule/children/newoffer/stateProcess.js +++ b/entity/360Degree_entity/entityfields/newmodule/children/newoffer/stateProcess.js @@ -6,11 +6,11 @@ var contextList = JSON.parse(vars.getString("$param.ObjectType_param")); if (contextList) { var found = false; - contextList.forEach(function (context) + for(context in contextList) { if(context == "Offer") found = true; - }); + } if(found) result.string(neon.COMPONENTSTATE_AUTO); else diff --git a/entity/360Degree_entity/entityfields/newmodule/children/neworder/stateProcess.js b/entity/360Degree_entity/entityfields/newmodule/children/neworder/stateProcess.js index 1c2b2b9123..6b9ec81641 100644 --- a/entity/360Degree_entity/entityfields/newmodule/children/neworder/stateProcess.js +++ b/entity/360Degree_entity/entityfields/newmodule/children/neworder/stateProcess.js @@ -6,11 +6,11 @@ var contextList = JSON.parse(vars.getString("$param.ObjectType_param")); if (contextList) { var found = false; - contextList.forEach(function (context) + for(context in contextList) { if(context == "Order") found = true; - }); + } if(found) result.string(neon.COMPONENTSTATE_AUTO); else diff --git a/entity/360Degree_entity/entityfields/newmodule/children/newsalesproject/stateProcess.js b/entity/360Degree_entity/entityfields/newmodule/children/newsalesproject/stateProcess.js index f23023f7d1..6a18dc9adf 100644 --- a/entity/360Degree_entity/entityfields/newmodule/children/newsalesproject/stateProcess.js +++ b/entity/360Degree_entity/entityfields/newmodule/children/newsalesproject/stateProcess.js @@ -7,11 +7,11 @@ if (contextList) { var found = false; - contextList.forEach(function (context) + for(context in contextList) { if(context == "Salesproject") found = true; - }); + } if(found) result.string(neon.COMPONENTSTATE_AUTO); else diff --git a/entity/360Degree_entity/entityfields/organisationobjects/children/objecttype_param/valueProcess.js b/entity/360Degree_entity/entityfields/organisationobjects/children/objecttype_param/valueProcess.js index 86503dcd7f..9b0fe874ba 100644 --- a/entity/360Degree_entity/entityfields/organisationobjects/children/objecttype_param/valueProcess.js +++ b/entity/360Degree_entity/entityfields/organisationobjects/children/objecttype_param/valueProcess.js @@ -3,4 +3,21 @@ import("system.result"); //No campaign, since a campaign can only be linked with a person. //Even when all entries of persons are displayed in the organisation_entity: It's still nonsense to display campaigns per status. -result.object(["Salesproject", "Offer", "Order", "Contract", "SupportTicket"]); \ No newline at end of file + +var res = { + "Salesproject": {}, + "Offer": {}, + "Order": { + "setGroupBy":"ORDERTYPE", + "groupByKeyword":"OrderType" + }, + "Contract": {}, + "SupportTicket": { + "subContext":"TaskLink", + "childField":"TASK_ID", + "parentField":"TASK_TASKID", + "contactIdField":"OBJECT_ROWID" + } +} + +result.string(JSON.stringify(res)) \ No newline at end of file diff --git a/entity/360Degree_entity/entityfields/personobjects/children/objecttype_param/valueProcess.js b/entity/360Degree_entity/entityfields/personobjects/children/objecttype_param/valueProcess.js index 51c40eed05..0764eff7f7 100644 --- a/entity/360Degree_entity/entityfields/personobjects/children/objecttype_param/valueProcess.js +++ b/entity/360Degree_entity/entityfields/personobjects/children/objecttype_param/valueProcess.js @@ -1,4 +1,14 @@ import("system.vars"); import("system.result"); -result.object(["Offer", "Contract", "Campaign", "Order", "SupportTicket"]); \ No newline at end of file +var res = { + "Offer": {}, + "Order": { + "setGroupBy":"ORDERTYPE" + }, + "Contract": {}, + "SupportTicket": {}, + "Campaign": {} +} + +result.string(JSON.stringify(res)) \ No newline at end of file diff --git a/entity/360Degree_entity/entityfields/year/valueProcess.js b/entity/360Degree_entity/entityfields/year/valueProcess.js deleted file mode 100644 index c21dcc8cde..0000000000 --- a/entity/360Degree_entity/entityfields/year/valueProcess.js +++ /dev/null @@ -1,6 +0,0 @@ -import("system.datetime"); -import("system.result"); -import("system.vars"); - -var dateVal = vars.get("$field.DATE"); -result.string(datetime.toDate(dateVal, "yyyy")); \ No newline at end of file diff --git a/entity/360Degree_entity/recordcontainers/jdito/contentProcess.js b/entity/360Degree_entity/recordcontainers/jdito/contentProcess.js index 3014803809..f6417bb26a 100644 --- a/entity/360Degree_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/360Degree_entity/recordcontainers/jdito/contentProcess.js @@ -1,36 +1,20 @@ -import("system.util"); -import("system.db"); -import("system.vars"); +import("system.datetime"); +import("system.logging"); +import("Util_lib"); +import("system.translate"); import("system.result"); +import("system.vars"); import("Context_lib"); -import("system.translate"); +import("Keyword_lib"); -if (vars.exists("$param.ObjectType_param") && vars.get("$param.ObjectType_param") && vars.exists("$param.ObjectRowId_param") && vars.get("$param.ObjectRowId_param")) -{ - var active; - var selectMap = ContextUtils.getSelectMap(); - if(vars.exists("$local.filter") && vars.get("$local.filter") ) - { - var filter = vars.get("$local.filter"); - if (filter.filter) - if(filter.filter.childs != null && filter.filter.childs.length > 0) - { - filter.filter.childs.forEach(function(child) - { - if(child.name === "ACTIVE") - active = child.key == 'true'; - }); - } - } - - var contextList = JSON.parse(vars.getString("$param.ObjectType_param")); - var contactId = vars.get("$param.ObjectRowId_param"); - var idValues; - if (vars.exists("$local.idvalues")) - idValues = vars.get("$local.idvalues"); - - var res = _get360Data(selectMap, contactId, contextList, active, idValues); - result.object(res); + +if (vars.exists("$param.ObjectType_param") && vars.get("$param.ObjectType_param") + && vars.exists("$param.ObjectRowId_param") && vars.get("$param.ObjectRowId_param")) +{ + var contextList = JSON.parse(vars.get("$param.ObjectType_param")); + var contactId = JSON.parse(vars.get("$param.ObjectRowId_param")); + var data = _get360Data(contactId, contextList); + result.object(data); } else { @@ -38,79 +22,65 @@ else } /** - * load all data for the 360Degree tree. - * @param {Object} pSelectMap the select map (result of ContextUtils.getSelectMap()) - * @param {String[]} pContactId the Contactid the 360 Degree tree should be loaded for - * @param {String[]} pContextList list of contexts to load. Note that subcontexts use their own list, defined in ContextUtils - * @param {Boolean} [pActive=undefined] if not undefined: it select only for active / inactive state - * @param {Array} [pUids=undefined] uids of the 360° entity that are used for filtering, each rowId needs the format: - * {id: "«rowid»", type: "«context id»"} + * collects all data for the 360Degree tree. + * @param {String} pContactId, the main Contactid that will be used for the Connections + * @param {String[]} pContextList, a list of Contexts that should be displayed * * @return {String[][]} the resulting data */ -function _get360Data(pSelectMap, pContactId, pContextList, pActive, pUids) +function _get360Data(pContactId, pContextList) { - //if there are uids for filtering, group them per context: - var uidContextMap = new Map();//Map where key is the type (contextname) and value is an array of the rowIds for that type - if (pUids) - { - pUids.forEach(function (uid){ - uid = JSON.parse(uid); - if (uidContextMap.has(uid.type)) - uidContextMap.get(uid.type).push(uid.id); - else - uidContextMap.set(uid.type, [uid.id]); - }); - } - var resultList = []; - pContextList.forEach(function (context) + var filter = vars.get("$sys.filter"); + for(var context in pContextList) { - var rowIds; - if (pUids) - { - //when a Uid-filter exists, but there is no context for filtering we can skip that context, - //otherwise we need to filter for the found row ids of that context - if (!uidContextMap.has(context)) - return; - else - rowIds = uidContextMap.get(context); - } - var data = db.table(ContextUtils.getContextDataSql(context, JSON.parse(pContactId), true, pActive, true, true, rowIds)); - data.forEach(function (row) + var group = context; + if(pContextList[context].hasOwnProperty("setGroupBy") && pContextList[context].hasOwnProperty("groupByKeyword")) + var groupKeyword = Utils.objectFromMap(new Map(KeywordUtils.getEntryNamesAndIdsByContainer(pContextList[context]["groupByKeyword"]))); + + var res = ContextUtils.getContextDataViaReadEntity(context, pContextList[context], filter, pContactId); + if(res.length > 0) { - var active; - if(pActive != undefined) //ACTIVE - active = translate.text(pActive); - else + res.forEach(function (row) { - if(pSelectMap[context].activeStates && pSelectMap[context].activeStates.indexOf(row[3]) > -1) - active = translate.text("true"); - else - active = translate.text("false"); - } - - var groupBy = row[4]; - if(groupBy == "") - groupBy = ContextUtils.getEntityTitle(context, true); - - var uid = JSON.stringify({id: row[0], type: context}); - resultList.push([ - uid, // UID - row[0], // TARGET_ID - context, // TARGET_CONTEXT - row[1], // TITLE - row[2], //DATE - active, - groupBy - ]); - }); - }); - - resultList.sort(function (a,b) { - if (a[4] < b[4]) return 1; - if (a[4] > b[4]) return -1; - return 0; - }) + var uid = JSON.stringify({ + "id": row["#UID"], + "type": context + }); + var targetid = row["#UID"]; + var title = row["#CONTENTTITLE"]; + var description = row["#CONTENTDESCRIPTION"]; + var dataDate = row["DATE_NEW"]; + var active = row["ACTIVE"]; + if(pContextList[context].hasOwnProperty("setGroupBy")) + group = row[pContextList[context]["setGroupBy"]] + + + if(pContextList[context].hasOwnProperty("setGroupBy")) + { + if( pContextList[context].hasOwnProperty("groupByKeyword") && groupKeyword) + group = groupKeyword[row[pContextList[context]["setGroupBy"]]] + else + group = row[pContextList[context]["setGroupBy"]] + } + + resultList.push([ + uid, // UID + targetid, // TARGET_ID + context, // TARGET_CONTEXT + translate.text(pContextList[context]), // TARGET_CONTEXT.displayValue + title, // TITLE + description, // DESCRIPTION + dataDate, // DATE + datetime.toDate(dataDate, "yyyy"), // YEAR + ContextUtils.getEntity(context), // ENTITY_NAME + translate.text(group), // GROUP + active // ACTIVE + ]); + }); + } + } + var sortArr = [9, false] + resultList = ArrayUtils.sortMulti(resultList, sortArr) return resultList; } \ No newline at end of file diff --git a/entity/ActivityLink_entity/entityfields/object_rowid/displayValueProcess.js b/entity/ActivityLink_entity/entityfields/object_rowid/displayValueProcess.js index 8b080bceea..95c4eea536 100644 --- a/entity/ActivityLink_entity/entityfields/object_rowid/displayValueProcess.js +++ b/entity/ActivityLink_entity/entityfields/object_rowid/displayValueProcess.js @@ -7,5 +7,5 @@ import("Context_lib"); if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$field.OBJECT_ROWID")) { result.string(""); } else if (vars.exists("$field.OBJECT_TYPE") && vars.get("$field.OBJECT_TYPE")) { - result.string(db.cell(ContextUtils.getNameSql(vars.get("$field.OBJECT_TYPE"), vars.get("$field.OBJECT_ROWID")))); + result.string(ContextUtils.getTitleByContext(vars.get("$field.OBJECT_TYPE"), vars.get("$field.OBJECT_ROWID"))); } \ No newline at end of file diff --git a/entity/AppointmentLink_entity/entityfields/objectid/displayValueProcess.js b/entity/AppointmentLink_entity/entityfields/objectid/displayValueProcess.js index e95adef18a..a44f299d8a 100644 --- a/entity/AppointmentLink_entity/entityfields/objectid/displayValueProcess.js +++ b/entity/AppointmentLink_entity/entityfields/objectid/displayValueProcess.js @@ -7,5 +7,5 @@ import("Context_lib"); if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$field.OBJECTID")) { result.string(""); } else if (vars.exists("$field.OBJECTTYPE") && vars.get("$field.OBJECTTYPE")) { - result.string(db.cell(ContextUtils.getNameSql(vars.get("$field.OBJECTTYPE"), vars.get("$field.OBJECTID")))); + result.string(ContextUtils.getTitleByContext(vars.get("$field.OBJECTTYPE"), vars.get("$field.OBJECTID"))); } \ No newline at end of file diff --git a/entity/AttributeUsage_entity/AttributeUsage_entity.aod b/entity/AttributeUsage_entity/AttributeUsage_entity.aod index 281daa5f5a..24f5a40c60 100644 --- a/entity/AttributeUsage_entity/AttributeUsage_entity.aod +++ b/entity/AttributeUsage_entity/AttributeUsage_entity.aod @@ -78,10 +78,6 @@ <fieldName>Exclusive</fieldName> </dependency> <children> - <entityParameter> - <name>GetAllContexts_param</name> - <valueProcess>%aditoprj%/entity/AttributeUsage_entity/entityfields/context/children/getallcontexts_param/valueProcess.js</valueProcess> - </entityParameter> <entityParameter> <name>Blacklist_param</name> <valueProcess>%aditoprj%/entity/AttributeUsage_entity/entityfields/context/children/blacklist_param/valueProcess.js</valueProcess> diff --git a/entity/AttributeUsage_entity/entityfields/context/children/getallcontexts_param/valueProcess.js b/entity/AttributeUsage_entity/entityfields/context/children/getallcontexts_param/valueProcess.js deleted file mode 100644 index ed5935fc12..0000000000 --- a/entity/AttributeUsage_entity/entityfields/context/children/getallcontexts_param/valueProcess.js +++ /dev/null @@ -1,2 +0,0 @@ -import("system.result"); -result.string(true); \ No newline at end of file diff --git a/entity/Attribute_entity/Attribute_entity.aod b/entity/Attribute_entity/Attribute_entity.aod index 26e2e934e5..f85aaaa951 100644 --- a/entity/Attribute_entity/Attribute_entity.aod +++ b/entity/Attribute_entity/Attribute_entity.aod @@ -319,10 +319,6 @@ <name>Blacklist_param</name> <valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/contexts/children/blacklist_param/valueProcess.js</valueProcess> </entityParameter> - <entityParameter> - <name>GetAllContexts_param</name> - <valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/contexts/children/getallcontexts_param/valueProcess.js</valueProcess> - </entityParameter> <entityParameter> <name>InvertBlacklist_param</name> <valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/contexts/children/invertblacklist_param/valueProcess.js</valueProcess> diff --git a/entity/Attribute_entity/entityfields/contexts/children/getallcontexts_param/valueProcess.js b/entity/Attribute_entity/entityfields/contexts/children/getallcontexts_param/valueProcess.js deleted file mode 100644 index 40effa0178..0000000000 --- a/entity/Attribute_entity/entityfields/contexts/children/getallcontexts_param/valueProcess.js +++ /dev/null @@ -1,3 +0,0 @@ -import("system.result"); - -result.string(true); \ No newline at end of file diff --git a/entity/CampaignStep_entity/CampaignStep_entity.aod b/entity/CampaignStep_entity/CampaignStep_entity.aod index 38abc14be1..ef3741b8df 100644 --- a/entity/CampaignStep_entity/CampaignStep_entity.aod +++ b/entity/CampaignStep_entity/CampaignStep_entity.aod @@ -11,6 +11,7 @@ </siblings> <grantDeleteProcess>%aditoprj%/entity/CampaignStep_entity/grantDeleteProcess.js</grantDeleteProcess> <contentTitleProcess>%aditoprj%/entity/CampaignStep_entity/contentTitleProcess.js</contentTitleProcess> + <contentDescriptionProcess>%aditoprj%/entity/CampaignStep_entity/contentDescriptionProcess.js</contentDescriptionProcess> <onValidation>%aditoprj%/entity/CampaignStep_entity/onValidation.js</onValidation> <imageProcess>%aditoprj%/entity/CampaignStep_entity/imageProcess.js</imageProcess> <titlePlural>Steps</titlePlural> diff --git a/entity/CampaignStep_entity/contentDescriptionProcess.js b/entity/CampaignStep_entity/contentDescriptionProcess.js new file mode 100644 index 0000000000..b07a72fe7c --- /dev/null +++ b/entity/CampaignStep_entity/contentDescriptionProcess.js @@ -0,0 +1,5 @@ +import("system.translate"); +import("system.datetime"); +import("system.vars"); +import("system.result"); +result.string(datetime.toDate(vars.get("$field.DATE_NEW"), translate.text("dd.MM.yyyy"))); \ No newline at end of file diff --git a/entity/Campaign_entity/Campaign_entity.aod b/entity/Campaign_entity/Campaign_entity.aod index 37416e7b55..571096dc23 100644 --- a/entity/Campaign_entity/Campaign_entity.aod +++ b/entity/Campaign_entity/Campaign_entity.aod @@ -13,6 +13,7 @@ </siblings> <grantDeleteProcess>%aditoprj%/entity/Campaign_entity/grantDeleteProcess.js</grantDeleteProcess> <contentTitleProcess>%aditoprj%/entity/Campaign_entity/contentTitleProcess.js</contentTitleProcess> + <contentDescriptionProcess>%aditoprj%/entity/Campaign_entity/contentDescriptionProcess.js</contentDescriptionProcess> <afterUiInit>%aditoprj%/entity/Campaign_entity/afterUiInit.js</afterUiInit> <useFavorites v="true" /> <iconId>VAADIN:GROUP</iconId> @@ -552,6 +553,9 @@ <name>#PROVIDER_AGGREGATES</name> <useAggregates v="true" /> </entityProvider> + <entityField> + <name>ACTIVE</name> + </entityField> </entityFields> <recordContainers> <dbRecordContainer> @@ -667,6 +671,10 @@ <isFilterable v="true" /> <filtertype>BASIC</filtertype> </consumerMapping> + <dbRecordFieldMapping> + <name>ACTIVE.value</name> + <expression>%aditoprj%/entity/Campaign_entity/recordcontainers/db/recordfieldmappings/active.value/expression.js</expression> + </dbRecordFieldMapping> </recordFieldMappings> <filterExtensions> <filterExtensionSet> diff --git a/entity/Campaign_entity/contentDescriptionProcess.js b/entity/Campaign_entity/contentDescriptionProcess.js new file mode 100644 index 0000000000..b07a72fe7c --- /dev/null +++ b/entity/Campaign_entity/contentDescriptionProcess.js @@ -0,0 +1,5 @@ +import("system.translate"); +import("system.datetime"); +import("system.vars"); +import("system.result"); +result.string(datetime.toDate(vars.get("$field.DATE_NEW"), translate.text("dd.MM.yyyy"))); \ No newline at end of file diff --git a/entity/Campaign_entity/recordcontainers/db/recordfieldmappings/active.value/expression.js b/entity/Campaign_entity/recordcontainers/db/recordfieldmappings/active.value/expression.js new file mode 100644 index 0000000000..0c4da8fb72 --- /dev/null +++ b/entity/Campaign_entity/recordcontainers/db/recordfieldmappings/active.value/expression.js @@ -0,0 +1,6 @@ +import("Context_lib"); +import("system.result"); +import("KeywordRegistry_basic"); + +var activArr = [$KeywordRegistry.campaignState$planning(), $KeywordRegistry.campaignState$approved()]; +result.string(ContextUtils.buildActiveCaseWhen(activArr, "CAMPAIGN.STATUS")); \ No newline at end of file diff --git a/entity/Competition_entity/Competition_entity.aod b/entity/Competition_entity/Competition_entity.aod index ac91f28ee4..7e7298fd9a 100644 --- a/entity/Competition_entity/Competition_entity.aod +++ b/entity/Competition_entity/Competition_entity.aod @@ -374,10 +374,6 @@ <name>PHASE.value</name> <recordfield>COMPETITION.PHASE</recordfield> </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>OBJECT_ROWID.displayValue</name> - <expression>%aditoprj%/entity/Competition_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js</expression> - </dbRecordFieldMapping> <dbRecordFieldMapping> <name>COMPETITIONID.value</name> <recordfield>COMPETITION.COMPETITIONID</recordfield> diff --git a/entity/Competition_entity/entityfields/object_rowid/displayValueProcess.js b/entity/Competition_entity/entityfields/object_rowid/displayValueProcess.js index 8b080bceea..95c4eea536 100644 --- a/entity/Competition_entity/entityfields/object_rowid/displayValueProcess.js +++ b/entity/Competition_entity/entityfields/object_rowid/displayValueProcess.js @@ -7,5 +7,5 @@ import("Context_lib"); if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$field.OBJECT_ROWID")) { result.string(""); } else if (vars.exists("$field.OBJECT_TYPE") && vars.get("$field.OBJECT_TYPE")) { - result.string(db.cell(ContextUtils.getNameSql(vars.get("$field.OBJECT_TYPE"), vars.get("$field.OBJECT_ROWID")))); + result.string(ContextUtils.getTitleByContext(vars.get("$field.OBJECT_TYPE"), vars.get("$field.OBJECT_ROWID"))); } \ No newline at end of file diff --git a/entity/Competition_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js b/entity/Competition_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js deleted file mode 100644 index fb69d484cf..0000000000 --- a/entity/Competition_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.result"); -import("Context_lib"); - -result.string(ContextUtils.getNameSubselectSql("COMPETITION.OBJECT_TYPE", "COMPETITION.OBJECT_ROWID")) \ No newline at end of file diff --git a/entity/Context_entity/Context_entity.aod b/entity/Context_entity/Context_entity.aod index c82aab16b5..a8e3222ec7 100644 --- a/entity/Context_entity/Context_entity.aod +++ b/entity/Context_entity/Context_entity.aod @@ -108,11 +108,6 @@ </entityParameter> </children> </entityProvider> - <entityParameter> - <name>GetAllContexts_param</name> - <expose v="true" /> - <description>PARAMETER</description> - </entityParameter> <entityParameter> <name>InvertBlacklist_param</name> <expose v="true" /> diff --git a/entity/Context_entity/recordcontainers/jdito/contentProcess.js b/entity/Context_entity/recordcontainers/jdito/contentProcess.js index 2568221255..1bdca6e2fa 100644 --- a/entity/Context_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/Context_entity/recordcontainers/jdito/contentProcess.js @@ -4,7 +4,6 @@ import("Context_lib"); var blacklist var invertBlacklist -var filterContexts = vars.get("$param.GetAllContexts_param") != "true"; var whitelist; if (vars.get("$local.idvalues") && vars.get("$local.idvalues").length > 0) @@ -23,4 +22,4 @@ else invertBlacklist = vars.get("$param.InvertBlacklist_param") == "true"; } -result.object(ContextUtils.getContexts(filterContexts, blacklist, invertBlacklist)); \ No newline at end of file +result.object(ContextUtils.getContexts(blacklist, invertBlacklist)); \ No newline at end of file diff --git a/entity/Contract_entity/Contract_entity.aod b/entity/Contract_entity/Contract_entity.aod index 273e731918..a31e274eac 100644 --- a/entity/Contract_entity/Contract_entity.aod +++ b/entity/Contract_entity/Contract_entity.aod @@ -6,6 +6,7 @@ <title>Contract</title> <grantDeleteProcess>%aditoprj%/entity/Contract_entity/grantDeleteProcess.js</grantDeleteProcess> <contentTitleProcess>%aditoprj%/entity/Contract_entity/contentTitleProcess.js</contentTitleProcess> + <contentDescriptionProcess>%aditoprj%/entity/Contract_entity/contentDescriptionProcess.js</contentDescriptionProcess> <afterUiInit>%aditoprj%/entity/Contract_entity/afterUiInit.js</afterUiInit> <onValidation>%aditoprj%/entity/Contract_entity/onValidation.js</onValidation> <useFavorites v="true" /> @@ -402,6 +403,12 @@ <name>#PROVIDER_AGGREGATES</name> <useAggregates v="true" /> </entityProvider> + <entityField> + <name>DATE_NEW</name> + </entityField> + <entityField> + <name>ACTIVE</name> + </entityField> </entityFields> <recordContainers> <dbRecordContainer> @@ -544,6 +551,14 @@ <recordfield>CONTRACT.CONTRACTID</recordfield> <aggregateType>COUNT</aggregateType> </aggregateFieldDbMapping> + <dbRecordFieldMapping> + <name>DATE_NEW.value</name> + <recordfield>CONTRACT.CONTRACTSTART</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>ACTIVE.value</name> + <expression>%aditoprj%/entity/Contract_entity/recordcontainers/db/recordfieldmappings/active.value/expression.js</expression> + </dbRecordFieldMapping> </recordFieldMappings> <filterExtensions> <filterExtensionSet> diff --git a/entity/Contract_entity/contentDescriptionProcess.js b/entity/Contract_entity/contentDescriptionProcess.js new file mode 100644 index 0000000000..03f72c03ff --- /dev/null +++ b/entity/Contract_entity/contentDescriptionProcess.js @@ -0,0 +1,16 @@ +import("system.translate"); +import("system.datetime"); +import("system.vars"); +import("system.result"); + +var res = [translate.text("Payment method") + ": " + vars.get("$field.PAYMENT.displayValue")]; + +if(vars.get("$field.CONTRACTDUE")) + res.push(translate.text("Next due date") + ": " + vars.get("$field.CONTRACTDUE")); + +if(vars.get("$field.CONTRACTEND")) + res.push(translate.text("Contract expiry date") + ": " + vars.get("$field.CONTRACTEND")) + +res.push(translate.text("Creation date") + ": " + datetime.toDate(vars.get("$field.DATE_NEW"), translate.text("dd.MM.yyyy"))); + +result.string(res.join(" | ")); \ No newline at end of file diff --git a/entity/Contract_entity/contentTitleProcess.js b/entity/Contract_entity/contentTitleProcess.js index 302a1d406e..94a08f9ad5 100644 --- a/entity/Contract_entity/contentTitleProcess.js +++ b/entity/Contract_entity/contentTitleProcess.js @@ -1,4 +1,6 @@ import("system.vars"); import("system.result"); -result.string(vars.get("$field.CONTRACTCODE_DISPLAY_fieldGroup")); \ No newline at end of file +var res = [vars.get("$field.CONTRACTCODE_DISPLAY_fieldGroup"), vars.get("$field.CONTRACTSTATUS.displayValue")]; + +result.string(res.join(" | ")); \ No newline at end of file diff --git a/entity/Contract_entity/recordcontainers/db/recordfieldmappings/active.value/expression.js b/entity/Contract_entity/recordcontainers/db/recordfieldmappings/active.value/expression.js new file mode 100644 index 0000000000..d788aeadb9 --- /dev/null +++ b/entity/Contract_entity/recordcontainers/db/recordfieldmappings/active.value/expression.js @@ -0,0 +1,6 @@ +import("Context_lib"); +import("system.result"); +import("KeywordRegistry_basic"); + +var activArr = [$KeywordRegistry.contractState$validLimited(), $KeywordRegistry.contractState$validUnlimited(), $KeywordRegistry.contractState$notSigned()]; +result.string(ContextUtils.buildActiveCaseWhen(activArr, "CONTRACT.CONTRACTSTATUS")); \ No newline at end of file diff --git a/entity/DocumentTemplatePlaceOfUse_entity/DocumentTemplatePlaceOfUse_entity.aod b/entity/DocumentTemplatePlaceOfUse_entity/DocumentTemplatePlaceOfUse_entity.aod index 6db556011a..3e77638a51 100644 --- a/entity/DocumentTemplatePlaceOfUse_entity/DocumentTemplatePlaceOfUse_entity.aod +++ b/entity/DocumentTemplatePlaceOfUse_entity/DocumentTemplatePlaceOfUse_entity.aod @@ -43,10 +43,6 @@ <name>Blacklist_param</name> <valueProcess>%aditoprj%/entity/DocumentTemplatePlaceOfUse_entity/entityfields/contextdocumenttemplateplaceofuse/children/blacklist_param/valueProcess.js</valueProcess> </entityParameter> - <entityParameter> - <name>GetAllContexts_param</name> - <valueProcess>%aditoprj%/entity/DocumentTemplatePlaceOfUse_entity/entityfields/contextdocumenttemplateplaceofuse/children/getallcontexts_param/valueProcess.js</valueProcess> - </entityParameter> </children> </entityConsumer> <entityProvider> diff --git a/entity/DocumentTemplatePlaceOfUse_entity/entityfields/contextdocumenttemplateplaceofuse/children/getallcontexts_param/valueProcess.js b/entity/DocumentTemplatePlaceOfUse_entity/entityfields/contextdocumenttemplateplaceofuse/children/getallcontexts_param/valueProcess.js deleted file mode 100644 index 40effa0178..0000000000 --- a/entity/DocumentTemplatePlaceOfUse_entity/entityfields/contextdocumenttemplateplaceofuse/children/getallcontexts_param/valueProcess.js +++ /dev/null @@ -1,3 +0,0 @@ -import("system.result"); - -result.string(true); \ No newline at end of file diff --git a/entity/Forecast_entity/Forecast_entity.aod b/entity/Forecast_entity/Forecast_entity.aod index f553dde8f4..75fd4c7ae9 100644 --- a/entity/Forecast_entity/Forecast_entity.aod +++ b/entity/Forecast_entity/Forecast_entity.aod @@ -171,10 +171,6 @@ <name>OBJECT_ROWID.value</name> <recordfield>FORECAST.OBJECT_ROWID</recordfield> </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>OBJECT_ROWID.displayValue</name> - <expression>%aditoprj%/entity/Forecast_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js</expression> - </dbRecordFieldMapping> <dbRecordFieldMapping> <name>OBJECT_TYPE.value</name> <recordfield>FORECAST.OBJECT_TYPE</recordfield> diff --git a/entity/Forecast_entity/entityfields/object_rowid/displayValueProcess.js b/entity/Forecast_entity/entityfields/object_rowid/displayValueProcess.js index 8b080bceea..95c4eea536 100644 --- a/entity/Forecast_entity/entityfields/object_rowid/displayValueProcess.js +++ b/entity/Forecast_entity/entityfields/object_rowid/displayValueProcess.js @@ -7,5 +7,5 @@ import("Context_lib"); if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$field.OBJECT_ROWID")) { result.string(""); } else if (vars.exists("$field.OBJECT_TYPE") && vars.get("$field.OBJECT_TYPE")) { - result.string(db.cell(ContextUtils.getNameSql(vars.get("$field.OBJECT_TYPE"), vars.get("$field.OBJECT_ROWID")))); + result.string(ContextUtils.getTitleByContext(vars.get("$field.OBJECT_TYPE"), vars.get("$field.OBJECT_ROWID"))); } \ No newline at end of file diff --git a/entity/Forecast_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js b/entity/Forecast_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js deleted file mode 100644 index 856c1bb3cf..0000000000 --- a/entity/Forecast_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.result"); -import("Context_lib"); - -result.string(ContextUtils.getNameSubselectSql("FORECAST.OBJECT_TYPE", "FORECAST.OBJECT_ROWID")) \ No newline at end of file diff --git a/entity/Leadimport_entity/Leadimport_entity.aod b/entity/Leadimport_entity/Leadimport_entity.aod index e5241d647c..e14d1cf8eb 100644 --- a/entity/Leadimport_entity/Leadimport_entity.aod +++ b/entity/Leadimport_entity/Leadimport_entity.aod @@ -10,6 +10,7 @@ <grantDelete v="true" /> <grantDeleteProcess>%aditoprj%/entity/Leadimport_entity/grantDeleteProcess.js</grantDeleteProcess> <contentTitleProcess>%aditoprj%/entity/Leadimport_entity/contentTitleProcess.js</contentTitleProcess> + <contentDescriptionProcess>%aditoprj%/entity/Leadimport_entity/contentDescriptionProcess.js</contentDescriptionProcess> <iconId>NEON:IMPORT</iconId> <imageProcess>%aditoprj%/entity/Leadimport_entity/imageProcess.js</imageProcess> <titlePlural>Lead Imports</titlePlural> @@ -17,6 +18,14 @@ <entityFields> <entityProvider> <name>#PROVIDER</name> + <dependencies> + <entityDependency> + <name>451f0237-27f9-4018-a165-9bb4857d6565</name> + <entityName>Object_entity</entityName> + <fieldName>Leadimports</fieldName> + <isConsumer v="false" /> + </entityDependency> + </dependencies> </entityProvider> <entityField> <name>NAME</name> diff --git a/entity/Leadimport_entity/contentDescriptionProcess.js b/entity/Leadimport_entity/contentDescriptionProcess.js new file mode 100644 index 0000000000..5fa0cb58bc --- /dev/null +++ b/entity/Leadimport_entity/contentDescriptionProcess.js @@ -0,0 +1,5 @@ +import("system.datetime"); +import("system.vars"); +import("system.result"); +import("system.translate"); +result.string(datetime.toDate(vars.get("$field.DATE_NEW"), translate.text("dd.MM.yyyy"))); \ No newline at end of file diff --git a/entity/Member_entity/Member_entity.aod b/entity/Member_entity/Member_entity.aod index 8706484f0f..a416ef148b 100644 --- a/entity/Member_entity/Member_entity.aod +++ b/entity/Member_entity/Member_entity.aod @@ -412,10 +412,6 @@ <name>OBJECTMEMBERID.value</name> <recordfield>OBJECTMEMBER.OBJECTMEMBERID</recordfield> </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>OBJECT_ROWID.displayValue</name> - <expression>%aditoprj%/entity/Member_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js</expression> - </dbRecordFieldMapping> <dbRecordFieldMapping> <name>MEMBERROLE.displayValue</name> <expression>%aditoprj%/entity/Member_entity/recordcontainers/db/recordfieldmappings/memberrole.displayvalue/expression.js</expression> diff --git a/entity/Member_entity/entityfields/object_rowid/displayValueProcess.js b/entity/Member_entity/entityfields/object_rowid/displayValueProcess.js index 8b080bceea..95c4eea536 100644 --- a/entity/Member_entity/entityfields/object_rowid/displayValueProcess.js +++ b/entity/Member_entity/entityfields/object_rowid/displayValueProcess.js @@ -7,5 +7,5 @@ import("Context_lib"); if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$field.OBJECT_ROWID")) { result.string(""); } else if (vars.exists("$field.OBJECT_TYPE") && vars.get("$field.OBJECT_TYPE")) { - result.string(db.cell(ContextUtils.getNameSql(vars.get("$field.OBJECT_TYPE"), vars.get("$field.OBJECT_ROWID")))); + result.string(ContextUtils.getTitleByContext(vars.get("$field.OBJECT_TYPE"), vars.get("$field.OBJECT_ROWID"))); } \ No newline at end of file diff --git a/entity/Member_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js b/entity/Member_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js deleted file mode 100644 index a5d62617be..0000000000 --- a/entity/Member_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js +++ /dev/null @@ -1,10 +0,0 @@ -import("system.vars"); -import("system.result"); -import("Context_lib"); - -//TODO: refactor: -//whenever we want to shrink data for a single object it's not needed to resolve the objects name where we're from -if (vars.get("$param.ObjectType_param") == null) - result.string(ContextUtils.getNameSubselectSql("OBJECTMEMBER.OBJECT_TYPE", "OBJECTMEMBER.OBJECT_ROWID")); -else - result.string("'OBJECT_ROWID.displayValue not loaded'"); \ No newline at end of file diff --git a/entity/ObjectTree_entity/entityfields/target_id/displayValueProcess.js b/entity/ObjectTree_entity/entityfields/target_id/displayValueProcess.js index d074689525..81438bdcb9 100644 --- a/entity/ObjectTree_entity/entityfields/target_id/displayValueProcess.js +++ b/entity/ObjectTree_entity/entityfields/target_id/displayValueProcess.js @@ -6,5 +6,5 @@ import("Context_lib"); if (vars.get("$field.TARGET_ID") && vars.get("$field.TARGET_CONTEXT")) { - result.string(db.cell(ContextUtils.getNameSql(vars.get("$field.TARGET_CONTEXT"), vars.get("$field.TARGET_ID")))); + result.string(ContextUtils.getTitleByContext(vars.get("$field.TARGET_CONTEXT"), vars.get("$field.TARGET_ID"))); } \ No newline at end of file diff --git a/entity/ObjectTree_entity/recordcontainers/jdito/contentProcess.js b/entity/ObjectTree_entity/recordcontainers/jdito/contentProcess.js index d1d925c81b..7980a2bd43 100644 --- a/entity/ObjectTree_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/ObjectTree_entity/recordcontainers/jdito/contentProcess.js @@ -298,7 +298,7 @@ function _insertEntry(pTree, pEntryData, pNodeId, pLayer, pObjectType, pNewRelat pEntryData.forEach(function ([objectId, objectRelationId, objectType, relationTitle, info, objectRelationTypeId], i) { //TODO: entities.getRow, check if this is possible with fewer queries - var display = db.cell(ContextUtils.getNameSql(pObjectType, objectId)); + var display = ContextUtils.getTitleByContext(pObjectType, objectId); // TODO: Icon var uid = [objectId, i, objectRelationTypeId, pObjectType, pNodeId, objectType, objectRelationId, pHierarchy]; diff --git a/entity/Object_entity/Object_entity.aod b/entity/Object_entity/Object_entity.aod index 1a571fad30..e3633e2483 100644 --- a/entity/Object_entity/Object_entity.aod +++ b/entity/Object_entity/Object_entity.aod @@ -283,6 +283,14 @@ <fieldName>#PROVIDER</fieldName> </dependency> </entityConsumer> + <entityConsumer> + <name>Leadimports</name> + <dependency> + <name>dependency</name> + <entityName>Leadimport_entity</entityName> + <fieldName>#PROVIDER</fieldName> + </dependency> + </entityConsumer> </entityFields> <recordContainers> <jDitoRecordContainer> diff --git a/entity/Object_entity/recordcontainers/jdito/contentProcess.js b/entity/Object_entity/recordcontainers/jdito/contentProcess.js index 27b0b7e83a..bf77eb9a2d 100644 --- a/entity/Object_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/Object_entity/recordcontainers/jdito/contentProcess.js @@ -19,7 +19,7 @@ if (vars.get("$param.ObjectType_param")) if (vars.exists("$param.ContactId") && vars.get("$param.ContactId")) contactId = vars.get("$param.ContactId"); - result.object(db.table(ContextUtils.getContextDataSql(objectType, contactId, false, undefined, false, null, null, excludedIds))) + result.object(ContextUtils.loadContent(ContextUtils.getEntity(objectType), [contactId], ["#UID", "#CONTENTTITLE"], excludedIds)) } else { diff --git a/entity/Offer_entity/Offer_entity.aod b/entity/Offer_entity/Offer_entity.aod index 0491466e0b..e486ce2984 100644 --- a/entity/Offer_entity/Offer_entity.aod +++ b/entity/Offer_entity/Offer_entity.aod @@ -10,6 +10,7 @@ <grantUpdateProcess>%aditoprj%/entity/Offer_entity/grantUpdateProcess.js</grantUpdateProcess> <grantDeleteProcess>%aditoprj%/entity/Offer_entity/grantDeleteProcess.js</grantDeleteProcess> <contentTitleProcess>%aditoprj%/entity/Offer_entity/contentTitleProcess.js</contentTitleProcess> + <contentDescriptionProcess>%aditoprj%/entity/Offer_entity/contentDescriptionProcess.js</contentDescriptionProcess> <afterUiInit>%aditoprj%/entity/Offer_entity/afterUiInit.js</afterUiInit> <useFavorites v="true" /> <iconId>VAADIN:CART</iconId> @@ -1052,6 +1053,9 @@ <name>#PROVIDER_AGGREGATES</name> <useAggregates v="true" /> </entityProvider> + <entityField> + <name>ACTIVE</name> + </entityField> </entityFields> <recordContainers> <dbRecordContainer> @@ -1243,10 +1247,6 @@ <name>OBJECT_TYPE.value</name> <recordfield>OFFER.OBJECT_TYPE</recordfield> </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>OBJECT_ROWID.displayValue</name> - <expression>%aditoprj%/entity/Offer_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js</expression> - </dbRecordFieldMapping> <dbRecordFieldMapping> <name>CONTACT_ID.value</name> <recordfield>OFFER.CONTACT_ID</recordfield> @@ -1304,6 +1304,10 @@ <name>OFFER_ID.value</name> <recordfield>OFFER.OFFER_ID</recordfield> </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>ACTIVE.value</name> + <expression>%aditoprj%/entity/Offer_entity/recordcontainers/db/recordfieldmappings/active.value/expression.js</expression> + </dbRecordFieldMapping> </recordFieldMappings> <filterExtensions> <filterExtensionSet> diff --git a/entity/Offer_entity/contentDescriptionProcess.js b/entity/Offer_entity/contentDescriptionProcess.js new file mode 100644 index 0000000000..f1afab18db --- /dev/null +++ b/entity/Offer_entity/contentDescriptionProcess.js @@ -0,0 +1,12 @@ +import("Util_lib"); +import("system.eMath"); +import("system.translate"); +import("system.datetime"); +import("system.vars"); +import("system.result"); + +var res = [translate.text("Total gross") + ": " + vars.get("$field.TotalGross.displayValue"), + translate.text("Probability") + ": " + vars.get("$field.PROBABILITY.displayValue"), + translate.text("Creation date") + ": " + datetime.toDate(vars.get("$field.DATE_NEW"), translate.text("dd.MM.yyyy"))]; + +result.string(res.join(" | ")); \ No newline at end of file diff --git a/entity/Offer_entity/contentTitleProcess.js b/entity/Offer_entity/contentTitleProcess.js index 98f9e42032..e90d32e0f1 100644 --- a/entity/Offer_entity/contentTitleProcess.js +++ b/entity/Offer_entity/contentTitleProcess.js @@ -1,4 +1,6 @@ import("system.vars"); import("system.result"); -result.string(vars.get("$field.OfferCode_VersNr_fieldgroup")); \ No newline at end of file +var res = [vars.get("$field.OfferCode_VersNr_fieldgroup"), vars.get("$field.STATUS.displayValue")] + +result.string(res.join(" | ")); \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/object_rowid/displayValueProcess.js b/entity/Offer_entity/entityfields/object_rowid/displayValueProcess.js index fe2b7c7250..8074aca46e 100644 --- a/entity/Offer_entity/entityfields/object_rowid/displayValueProcess.js +++ b/entity/Offer_entity/entityfields/object_rowid/displayValueProcess.js @@ -7,5 +7,5 @@ import("Context_lib"); if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$field.OBJECT_ROWID") == null) { result.string(""); } else if (vars.exists("$field.OBJECT_TYPE") && vars.get("$field.OBJECT_TYPE")) { - result.string(db.cell(ContextUtils.getNameSql(vars.get("$field.OBJECT_TYPE"), vars.get("$field.OBJECT_ROWID")))); + result.string(ContextUtils.getTitleByContext(vars.get("$field.OBJECT_TYPE"), vars.get("$field.OBJECT_ROWID"))); } \ No newline at end of file diff --git a/entity/Offer_entity/recordcontainers/db/recordfieldmappings/active.value/expression.js b/entity/Offer_entity/recordcontainers/db/recordfieldmappings/active.value/expression.js new file mode 100644 index 0000000000..6da46407ad --- /dev/null +++ b/entity/Offer_entity/recordcontainers/db/recordfieldmappings/active.value/expression.js @@ -0,0 +1,6 @@ +import("Context_lib"); +import("system.result"); +import("KeywordRegistry_basic"); + +var activArr = [$KeywordRegistry.offerStatus$open(), $KeywordRegistry.offerStatus$checked(), $KeywordRegistry.offerStatus$sent()]; +result.string(ContextUtils.buildActiveCaseWhen(activArr, "OFFER.STATUS")); \ No newline at end of file diff --git a/entity/Offer_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js b/entity/Offer_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js deleted file mode 100644 index c0332af5cb..0000000000 --- a/entity/Offer_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.result"); -import("Context_lib"); - -result.string(ContextUtils.getNameSubselectSql("OFFER.OBJECT_TYPE", "OFFER.OBJECT_ROWID")) \ No newline at end of file diff --git a/entity/Order_entity/Order_entity.aod b/entity/Order_entity/Order_entity.aod index 2d2ea6554b..64b551ee2d 100644 --- a/entity/Order_entity/Order_entity.aod +++ b/entity/Order_entity/Order_entity.aod @@ -6,6 +6,7 @@ <title>Receipt</title> <grantDeleteProcess>%aditoprj%/entity/Order_entity/grantDeleteProcess.js</grantDeleteProcess> <contentTitleProcess>%aditoprj%/entity/Order_entity/contentTitleProcess.js</contentTitleProcess> + <contentDescriptionProcess>%aditoprj%/entity/Order_entity/contentDescriptionProcess.js</contentDescriptionProcess> <afterUiInit>%aditoprj%/entity/Order_entity/afterUiInit.js</afterUiInit> <useFavorites v="true" /> <iconId>VAADIN:DOLLAR</iconId> @@ -106,6 +107,11 @@ <entityConsumer> <name>Orderitems</name> <description></description> + <dependency> + <name>dependency</name> + <entityName>Orderitem_entity</entityName> + <fieldName>Orderitems</fieldName> + </dependency> <children> <entityParameter> <name>OrderId_param</name> @@ -131,11 +137,6 @@ <mandatory v="true" /> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>Orderitem_entity</entityName> - <fieldName>Orderitems</fieldName> - </dependency> </entityConsumer> <entityField> <name>NET</name> @@ -197,6 +198,11 @@ <entityConsumer> <name>Documents</name> <selectionMode>MULTI</selectionMode> + <dependency> + <name>dependency</name> + <entityName>Document_entity</entityName> + <fieldName>Documents</fieldName> + </dependency> <children> <entityParameter> <name>AssignmentRowId_param</name> @@ -207,15 +213,15 @@ <valueProcess>%aditoprj%/entity/Order_entity/entityfields/documents/children/assignmenttable_param/valueProcess.js</valueProcess> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>Document_entity</entityName> - <fieldName>Documents</fieldName> - </dependency> </entityConsumer> <entityConsumer> <name>MainDocuments</name> <stateProcess>%aditoprj%/entity/Order_entity/entityfields/maindocuments/stateProcess.js</stateProcess> + <dependency> + <name>dependency</name> + <entityName>Document_entity</entityName> + <fieldName>MainDocuments</fieldName> + </dependency> <children> <entityParameter> <name>AssignmentRowId_param</name> @@ -226,28 +232,28 @@ <valueProcess>%aditoprj%/entity/Order_entity/entityfields/maindocuments/children/assignmenttable_param/valueProcess.js</valueProcess> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>Document_entity</entityName> - <fieldName>MainDocuments</fieldName> - </dependency> </entityConsumer> <entityConsumer> <name>Salesprojects</name> + <dependency> + <name>dependency</name> + <entityName>Salesproject_entity</entityName> + <fieldName>Salesprojects</fieldName> + </dependency> <children> <entityParameter> <name>ContactId_param</name> <valueProcess>%aditoprj%/entity/Order_entity/entityfields/salesprojects/children/contactid_param/valueProcess.js</valueProcess> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>Salesproject_entity</entityName> - <fieldName>Salesprojects</fieldName> - </dependency> </entityConsumer> <entityConsumer> <name>KeywordCurrencies</name> + <dependency> + <name>dependency</name> + <entityName>KeywordEntry_entity</entityName> + <fieldName>SpecificContainerKeywords</fieldName> + </dependency> <children> <entityParameter> <name>ContainerName_param</name> @@ -255,14 +261,14 @@ <expose v="false" /> </entityParameter> </children> + </entityConsumer> + <entityConsumer> + <name>KeywordStates</name> <dependency> <name>dependency</name> <entityName>KeywordEntry_entity</entityName> <fieldName>SpecificContainerKeywords</fieldName> </dependency> - </entityConsumer> - <entityConsumer> - <name>KeywordStates</name> <children> <entityParameter> <name>ContainerName_param</name> @@ -270,11 +276,6 @@ <expose v="false" /> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>KeywordEntry_entity</entityName> - <fieldName>SpecificContainerKeywords</fieldName> - </dependency> </entityConsumer> <entityConsumer> <name>Languages</name> @@ -293,6 +294,11 @@ </entityParameter> <entityConsumer> <name>Activities</name> + <dependency> + <name>dependency</name> + <entityName>Activity_entity</entityName> + <fieldName>LinkedObjects</fieldName> + </dependency> <children> <entityParameter> <name>RowId_param</name> @@ -307,11 +313,6 @@ <valueProcess>%aditoprj%/entity/Order_entity/entityfields/activities/children/presetlinks_param/valueProcess.js</valueProcess> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>Activity_entity</entityName> - <fieldName>LinkedObjects</fieldName> - </dependency> </entityConsumer> <entityField> <name>OFFER_ID</name> @@ -325,6 +326,11 @@ <entityConsumer> <name>Tasks</name> <stateProcess>%aditoprj%/entity/Order_entity/entityfields/tasks/stateProcess.js</stateProcess> + <dependency> + <name>dependency</name> + <entityName>Task_entity</entityName> + <fieldName>Tasks</fieldName> + </dependency> <children> <entityParameter> <name>RowId_param</name> @@ -339,15 +345,15 @@ <valueProcess>%aditoprj%/entity/Order_entity/entityfields/tasks/children/presetlinks_param/valueProcess.js</valueProcess> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>Task_entity</entityName> - <fieldName>Tasks</fieldName> - </dependency> </entityConsumer> <entityConsumer> <name>Attributes</name> <onValidation>%aditoprj%/entity/Order_entity/entityfields/attributes/onValidation.js</onValidation> + <dependency> + <name>dependency</name> + <entityName>AttributeRelation_entity</entityName> + <fieldName>AttributeRelations</fieldName> + </dependency> <children> <entityParameter> <name>ObjectRowId_param</name> @@ -358,15 +364,15 @@ <valueProcess>%aditoprj%/entity/Order_entity/entityfields/attributes/children/objecttype_param/valueProcess.js</valueProcess> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>AttributeRelation_entity</entityName> - <fieldName>AttributeRelations</fieldName> - </dependency> </entityConsumer> <entityConsumer> <name>AttributeTree</name> <stateProcess>%aditoprj%/entity/Order_entity/entityfields/attributetree/stateProcess.js</stateProcess> + <dependency> + <name>dependency</name> + <entityName>AttributeRelation_entity</entityName> + <fieldName>TreeProvider</fieldName> + </dependency> <children> <entityParameter> <name>ObjectType_param</name> @@ -377,25 +383,20 @@ <valueProcess>%aditoprj%/entity/Order_entity/entityfields/attributetree/children/objectrowid_param/valueProcess.js</valueProcess> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>AttributeRelation_entity</entityName> - <fieldName>TreeProvider</fieldName> - </dependency> </entityConsumer> <entityConsumer> <name>LogHistories</name> + <dependency> + <name>dependency</name> + <entityName>LogHistory_entity</entityName> + <fieldName>LogHistoryProvider</fieldName> + </dependency> <children> <entityParameter> <name>tablenames_param</name> <valueProcess>%aditoprj%/entity/Order_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js</valueProcess> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>LogHistory_entity</entityName> - <fieldName>LogHistoryProvider</fieldName> - </dependency> </entityConsumer> <entityField> <name>ORDERTYPE</name> @@ -473,31 +474,31 @@ </entityField> <entityConsumer> <name>KeywordOrderTypes</name> + <dependency> + <name>dependency</name> + <entityName>KeywordEntry_entity</entityName> + <fieldName>SpecificContainerKeywords</fieldName> + </dependency> <children> <entityParameter> <name>ContainerName_param</name> <valueProcess>%aditoprj%/entity/Order_entity/entityfields/keywordordertypes/children/containername_param/valueProcess.js</valueProcess> </entityParameter> </children> + </entityConsumer> + <entityConsumer> + <name>KeywordDunningLevels</name> <dependency> <name>dependency</name> <entityName>KeywordEntry_entity</entityName> <fieldName>SpecificContainerKeywords</fieldName> </dependency> - </entityConsumer> - <entityConsumer> - <name>KeywordDunningLevels</name> <children> <entityParameter> <name>ContainerName_param</name> <valueProcess>%aditoprj%/entity/Order_entity/entityfields/keyworddunninglevels/children/containername_param/valueProcess.js</valueProcess> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>KeywordEntry_entity</entityName> - <fieldName>SpecificContainerKeywords</fieldName> - </dependency> </entityConsumer> <entityField> <name>OBJECT_ROWID</name> @@ -525,6 +526,11 @@ </entityField> <entityConsumer> <name>Objects</name> + <dependency> + <name>dependency</name> + <entityName>Object_entity</entityName> + <fieldName>FilteredObjects</fieldName> + </dependency> <children> <entityParameter> <name>ContactId_param</name> @@ -535,14 +541,14 @@ <valueProcess>%aditoprj%/entity/Order_entity/entityfields/objects/children/objecttype_param/valueProcess.js</valueProcess> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>Object_entity</entityName> - <fieldName>FilteredObjects</fieldName> - </dependency> </entityConsumer> <entityConsumer> <name>Contexts</name> + <dependency> + <name>dependency</name> + <entityName>Context_entity</entityName> + <fieldName>Exclusive</fieldName> + </dependency> <children> <entityParameter> <name>Blacklist_param</name> @@ -553,11 +559,6 @@ <valueProcess>%aditoprj%/entity/Order_entity/entityfields/contexts/children/invertblacklist_param/valueProcess.js</valueProcess> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>Context_entity</entityName> - <fieldName>Exclusive</fieldName> - </dependency> </entityConsumer> <entityParameter> <name>PossibleConnectionTypes</name> @@ -610,46 +611,46 @@ </entityField> <entityConsumer> <name>KeywordPaymentTerms</name> + <dependency> + <name>dependency</name> + <entityName>KeywordEntry_entity</entityName> + <fieldName>SpecificContainerKeywords</fieldName> + </dependency> <children> <entityParameter> <name>ContainerName_param</name> <valueProcess>%aditoprj%/entity/Order_entity/entityfields/keywordpaymentterms/children/containername_param/valueProcess.js</valueProcess> </entityParameter> </children> + </entityConsumer> + <entityConsumer> + <name>KeywordDeliveryTerms</name> <dependency> <name>dependency</name> <entityName>KeywordEntry_entity</entityName> <fieldName>SpecificContainerKeywords</fieldName> </dependency> - </entityConsumer> - <entityConsumer> - <name>KeywordDeliveryTerms</name> <children> <entityParameter> <name>ContainerName_param</name> <valueProcess>%aditoprj%/entity/Order_entity/entityfields/keyworddeliveryterms/children/containername_param/valueProcess.js</valueProcess> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>KeywordEntry_entity</entityName> - <fieldName>SpecificContainerKeywords</fieldName> - </dependency> </entityConsumer> <entityConsumer> <name>PossibleAddresses</name> <documentation>%aditoprj%/entity/Order_entity/entityfields/possibleaddresses/documentation.adoc</documentation> + <dependency> + <name>dependency</name> + <entityName>Address_entity</entityName> + <fieldName>OrganisationAndContactAddresses</fieldName> + </dependency> <children> <entityParameter> <name>ContactId_param</name> <valueProcess>%aditoprj%/entity/Order_entity/entityfields/possibleaddresses/children/contactid_param/valueProcess.js</valueProcess> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>Address_entity</entityName> - <fieldName>OrganisationAndContactAddresses</fieldName> - </dependency> </entityConsumer> <entityField> <name>NOTICE</name> @@ -666,20 +667,25 @@ </entityField> <entityConsumer> <name>Offers</name> + <dependency> + <name>dependency</name> + <entityName>Offer_entity</entityName> + <fieldName>ContactOffers</fieldName> + </dependency> <children> <entityParameter> <name>ContactId_param</name> <valueProcess>%aditoprj%/entity/Order_entity/entityfields/offers/children/contactid_param/valueProcess.js</valueProcess> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>Offer_entity</entityName> - <fieldName>ContactOffers</fieldName> - </dependency> </entityConsumer> <entityConsumer> <name>DocumentTemplateTexHeader</name> + <dependency> + <name>dependency</name> + <entityName>DocumentTemplate_entity</entityName> + <fieldName>DocumentTemplateProvider</fieldName> + </dependency> <children> <entityParameter> <name>DocumentTemplateType_param</name> @@ -690,14 +696,14 @@ <valueProcess>%aditoprj%/entity/Order_entity/entityfields/documenttemplatetexheader/children/documenttemplatetypeclassification_param/valueProcess.js</valueProcess> </entityParameter> </children> + </entityConsumer> + <entityConsumer> + <name>DocumentTemplateTexFooter</name> <dependency> <name>dependency</name> <entityName>DocumentTemplate_entity</entityName> <fieldName>DocumentTemplateProvider</fieldName> </dependency> - </entityConsumer> - <entityConsumer> - <name>DocumentTemplateTexFooter</name> <children> <entityParameter> <name>DocumentTemplateType_param</name> @@ -708,11 +714,6 @@ <valueProcess>%aditoprj%/entity/Order_entity/entityfields/documenttemplatetexfooter/children/documenttemplatetypeclassification_param/valueProcess.js</valueProcess> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>DocumentTemplate_entity</entityName> - <fieldName>DocumentTemplateProvider</fieldName> - </dependency> </entityConsumer> <entityField> <name>ChosenTexHeader</name> @@ -924,6 +925,14 @@ <expose v="true" /> <description></description> </entityParameter> + <entityField> + <name>DATE_NEW</name> + <contentType>DATE</contentType> + <resolution>DAY</resolution> + </entityField> + <entityField> + <name>ACTIVE</name> + </entityField> </entityFields> <recordContainers> <dbRecordContainer> @@ -1080,14 +1089,6 @@ <name>OBJECT_ROWID.value</name> <recordfield>SALESORDER.OBJECT_ROWID</recordfield> </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>OBJECT_ROWID.displayValue</name> - <expression>%aditoprj%/entity/Order_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js</expression> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>OFFER_ID.displayValue</name> - <expression>%aditoprj%/entity/Order_entity/recordcontainers/db/recordfieldmappings/offer_id.displayvalue/expression.js</expression> - </dbRecordFieldMapping> <dbRecordFieldMapping> <name>OBJECT_TYPE.value</name> <recordfield>SALESORDER.OBJECT_TYPE</recordfield> @@ -1147,6 +1148,14 @@ <recordfield>SALESORDER.SALESORDERID</recordfield> <aggregateType>COUNT</aggregateType> </aggregateFieldDbMapping> + <dbRecordFieldMapping> + <name>DATE_NEW.value</name> + <recordfield>SALESORDER.SALESORDERDATE</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>ACTIVE.value</name> + <expression>%aditoprj%/entity/Order_entity/recordcontainers/db/recordfieldmappings/active.value/expression.js</expression> + </dbRecordFieldMapping> </recordFieldMappings> <filterExtensions> <filterExtension> diff --git a/entity/Order_entity/contentDescriptionProcess.js b/entity/Order_entity/contentDescriptionProcess.js new file mode 100644 index 0000000000..bd351d26e6 --- /dev/null +++ b/entity/Order_entity/contentDescriptionProcess.js @@ -0,0 +1,19 @@ +import("system.logging"); +import("system.translate"); +import("system.datetime"); +import("system.vars"); +import("system.result"); +import("KeywordRegistry_basic"); + +var orderstatus = vars.get("$field.ORDERSTATUS") == "1" ? translate.text("Yes"): translate.text("No") + +var res = [translate.text("Sent") + ": " + orderstatus, + translate.text("Total gross") + ": " + vars.get("$field.TotalGross.displayValue")] + +if(vars.get("$field.PAYDATE")) + res.push(translate.text("Pay date") + ": " + datetime.toDate(vars.get("$field.PAYDATE"), translate.text("dd.MM.yyyy"))) + + +res.push(translate.text("Creation date") + ": " + datetime.toDate(vars.get("$field.DATE_NEW"), translate.text("dd.MM.yyyy"))); + +result.string(res.join(" | ")); \ No newline at end of file diff --git a/entity/Order_entity/contentTitleProcess.js b/entity/Order_entity/contentTitleProcess.js index efca7174f4..376625c494 100644 --- a/entity/Order_entity/contentTitleProcess.js +++ b/entity/Order_entity/contentTitleProcess.js @@ -4,4 +4,9 @@ import("system.translate"); import("system.vars"); import("system.result"); -result.string(KeywordUtils.getViewValue($KeywordRegistry.orderType(), vars.get("$field.ORDERTYPE")) +" - "+ vars.get("$field.SALESORDERCODE")); +var res = [vars.get("$field.SALESORDERCODE")]; + +if(vars.get("$field.CANCELLATION") == "1") + res.push(translate.text("${ORDER_CANCELLED}")); + +result.string(res.join(" | ")); diff --git a/entity/Order_entity/entityfields/object_rowid/displayValueProcess.js b/entity/Order_entity/entityfields/object_rowid/displayValueProcess.js index 8b080bceea..95c4eea536 100644 --- a/entity/Order_entity/entityfields/object_rowid/displayValueProcess.js +++ b/entity/Order_entity/entityfields/object_rowid/displayValueProcess.js @@ -7,5 +7,5 @@ import("Context_lib"); if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$field.OBJECT_ROWID")) { result.string(""); } else if (vars.exists("$field.OBJECT_TYPE") && vars.get("$field.OBJECT_TYPE")) { - result.string(db.cell(ContextUtils.getNameSql(vars.get("$field.OBJECT_TYPE"), vars.get("$field.OBJECT_ROWID")))); + result.string(ContextUtils.getTitleByContext(vars.get("$field.OBJECT_TYPE"), vars.get("$field.OBJECT_ROWID"))); } \ No newline at end of file diff --git a/entity/Order_entity/recordcontainers/db/recordfieldmappings/active.value/expression.js b/entity/Order_entity/recordcontainers/db/recordfieldmappings/active.value/expression.js new file mode 100644 index 0000000000..b623559312 --- /dev/null +++ b/entity/Order_entity/recordcontainers/db/recordfieldmappings/active.value/expression.js @@ -0,0 +1,6 @@ +import("Context_lib"); +import("system.result"); +import("KeywordRegistry_basic"); + +var activArr = [0, 1]; +result.string(ContextUtils.buildActiveCaseWhen(activArr, "SALESORDER.ORDERSTATUS")); \ No newline at end of file diff --git a/entity/Order_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js b/entity/Order_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js deleted file mode 100644 index bbe883a829..0000000000 --- a/entity/Order_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.result"); -import("Context_lib"); - -result.string(ContextUtils.getNameSubselectSql("SALESORDER.OBJECT_TYPE", "SALESORDER.OBJECT_ROWID")) \ No newline at end of file diff --git a/entity/Order_entity/recordcontainers/db/recordfieldmappings/offer_id.displayvalue/expression.js b/entity/Order_entity/recordcontainers/db/recordfieldmappings/offer_id.displayvalue/expression.js deleted file mode 100644 index cb7fa7682e..0000000000 --- a/entity/Order_entity/recordcontainers/db/recordfieldmappings/offer_id.displayvalue/expression.js +++ /dev/null @@ -1,5 +0,0 @@ -import("system.result"); -import("Context_lib"); -import("system.db"); - -result.string(db.translateStatement(ContextUtils.getNameSql("Offer", null, "SALESORDER.OFFER_ID"))); \ No newline at end of file diff --git a/entity/Organisation_entity/Organisation_entity.aod b/entity/Organisation_entity/Organisation_entity.aod index dbf97ba2d2..076fe1f621 100644 --- a/entity/Organisation_entity/Organisation_entity.aod +++ b/entity/Organisation_entity/Organisation_entity.aod @@ -7,6 +7,7 @@ <title>Company</title> <grantDeleteProcess>%aditoprj%/entity/Organisation_entity/grantDeleteProcess.js</grantDeleteProcess> <contentTitleProcess>%aditoprj%/entity/Organisation_entity/contentTitleProcess.js</contentTitleProcess> + <contentDescriptionProcess>%aditoprj%/entity/Organisation_entity/contentDescriptionProcess.js</contentDescriptionProcess> <afterUiInit>%aditoprj%/entity/Organisation_entity/afterUiInit.js</afterUiInit> <initFilterProcess>%aditoprj%/entity/Organisation_entity/initFilterProcess.js</initFilterProcess> <useFavorites v="true" /> diff --git a/entity/Organisation_entity/contentDescriptionProcess.js b/entity/Organisation_entity/contentDescriptionProcess.js new file mode 100644 index 0000000000..b07a72fe7c --- /dev/null +++ b/entity/Organisation_entity/contentDescriptionProcess.js @@ -0,0 +1,5 @@ +import("system.translate"); +import("system.datetime"); +import("system.vars"); +import("system.result"); +result.string(datetime.toDate(vars.get("$field.DATE_NEW"), translate.text("dd.MM.yyyy"))); \ No newline at end of file diff --git a/entity/Product_entity/Product_entity.aod b/entity/Product_entity/Product_entity.aod index 2a6662b6f7..b548703631 100644 --- a/entity/Product_entity/Product_entity.aod +++ b/entity/Product_entity/Product_entity.aod @@ -9,6 +9,7 @@ </siblings> <grantDeleteProcess>%aditoprj%/entity/Product_entity/grantDeleteProcess.js</grantDeleteProcess> <contentTitleProcess>%aditoprj%/entity/Product_entity/contentTitleProcess.js</contentTitleProcess> + <contentDescriptionProcess>%aditoprj%/entity/Product_entity/contentDescriptionProcess.js</contentDescriptionProcess> <afterUiInit>%aditoprj%/entity/Product_entity/afterUiInit.js</afterUiInit> <useFavorites v="true" /> <iconId>VAADIN:HAMMER</iconId> diff --git a/entity/Product_entity/contentDescriptionProcess.js b/entity/Product_entity/contentDescriptionProcess.js new file mode 100644 index 0000000000..b07a72fe7c --- /dev/null +++ b/entity/Product_entity/contentDescriptionProcess.js @@ -0,0 +1,5 @@ +import("system.translate"); +import("system.datetime"); +import("system.vars"); +import("system.result"); +result.string(datetime.toDate(vars.get("$field.DATE_NEW"), translate.text("dd.MM.yyyy"))); \ No newline at end of file diff --git a/entity/Product_entity/entityfields/contact_id/displayValueProcess.js b/entity/Product_entity/entityfields/contact_id/displayValueProcess.js index 660715572a..d29e2e1026 100644 --- a/entity/Product_entity/entityfields/contact_id/displayValueProcess.js +++ b/entity/Product_entity/entityfields/contact_id/displayValueProcess.js @@ -3,4 +3,4 @@ import("system.vars"); import("system.result"); import("Context_lib"); -result.string(db.cell(ContextUtils.getNameSql("Organisation", vars.get("$field.CONTACT_ID")))); \ No newline at end of file +result.string(ContextUtils.getTitleByContext("Organisation", vars.get("$field.CONTACT_ID"))); \ No newline at end of file diff --git a/entity/Salesproject_entity/Salesproject_entity.aod b/entity/Salesproject_entity/Salesproject_entity.aod index 26c7f691c1..bbe19fd7cf 100644 --- a/entity/Salesproject_entity/Salesproject_entity.aod +++ b/entity/Salesproject_entity/Salesproject_entity.aod @@ -12,6 +12,7 @@ </siblings> <grantDeleteProcess>%aditoprj%/entity/Salesproject_entity/grantDeleteProcess.js</grantDeleteProcess> <contentTitleProcess>%aditoprj%/entity/Salesproject_entity/contentTitleProcess.js</contentTitleProcess> + <contentDescriptionProcess>%aditoprj%/entity/Salesproject_entity/contentDescriptionProcess.js</contentDescriptionProcess> <afterUiInit>%aditoprj%/entity/Salesproject_entity/afterUiInit.js</afterUiInit> <onValidation>%aditoprj%/entity/Salesproject_entity/onValidation.js</onValidation> <useFavorites v="true" /> @@ -146,34 +147,39 @@ </entityField> <entityConsumer> <name>SalesprojectSources</name> - <children> - <entityParameter> - <name>SalesprojectId_param</name> - <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/salesprojectsources/children/salesprojectid_param/valueProcess.js</valueProcess> - </entityParameter> - </children> <dependency> <name>dependency</name> <entityName>SalesprojectSource_entity</entityName> <fieldName>SalesprojectSouces</fieldName> </dependency> - </entityConsumer> - <entityConsumer> - <name>SalesprojectPhaseMilestones</name> <children> <entityParameter> <name>SalesprojectId_param</name> - <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/salesprojectphasemilestones/children/salesprojectid_param/valueProcess.js</valueProcess> + <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/salesprojectsources/children/salesprojectid_param/valueProcess.js</valueProcess> </entityParameter> </children> + </entityConsumer> + <entityConsumer> + <name>SalesprojectPhaseMilestones</name> <dependency> <name>dependency</name> <entityName>SalesprojectMilestone_entity</entityName> <fieldName>PhaseMilestones</fieldName> </dependency> + <children> + <entityParameter> + <name>SalesprojectId_param</name> + <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/salesprojectphasemilestones/children/salesprojectid_param/valueProcess.js</valueProcess> + </entityParameter> + </children> </entityConsumer> <entityConsumer> <name>Forecasts</name> + <dependency> + <name>dependency</name> + <entityName>Forecast_entity</entityName> + <fieldName>Links</fieldName> + </dependency> <children> <entityParameter> <name>ObjectType_param</name> @@ -186,15 +192,15 @@ <expose v="true" /> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>Forecast_entity</entityName> - <fieldName>Links</fieldName> - </dependency> </entityConsumer> <entityConsumer> <name>Competitions</name> <selectionMode>MULTI</selectionMode> + <dependency> + <name>dependency</name> + <entityName>Competition_entity</entityName> + <fieldName>Links</fieldName> + </dependency> <children> <entityParameter> <name>ObjectRowId_param</name> @@ -207,14 +213,14 @@ <expose v="true" /> </entityParameter> </children> + </entityConsumer> + <entityConsumer> + <name>Offers</name> <dependency> <name>dependency</name> - <entityName>Competition_entity</entityName> + <entityName>Offer_entity</entityName> <fieldName>Links</fieldName> </dependency> - </entityConsumer> - <entityConsumer> - <name>Offers</name> <children> <entityParameter> <name>ObjectRowId_param</name> @@ -227,14 +233,14 @@ <expose v="true" /> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>Offer_entity</entityName> - <fieldName>Links</fieldName> - </dependency> </entityConsumer> <entityConsumer> <name>Activities</name> + <dependency> + <name>dependency</name> + <entityName>Activity_entity</entityName> + <fieldName>LinkedObjects</fieldName> + </dependency> <children> <entityParameter> <name>PresetLinks_param</name> @@ -249,14 +255,14 @@ <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/activities/children/objectid_param/valueProcess.js</valueProcess> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>Activity_entity</entityName> - <fieldName>LinkedObjects</fieldName> - </dependency> </entityConsumer> <entityConsumer> <name>Members</name> + <dependency> + <name>dependency</name> + <entityName>Member_entity</entityName> + <fieldName>WithDistrictResponsibles</fieldName> + </dependency> <children> <entityParameter> <name>ObjectRowId_param</name> @@ -281,11 +287,6 @@ <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/members/children/salesprojectcode_param/valueProcess.js</valueProcess> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>Member_entity</entityName> - <fieldName>WithDistrictResponsibles</fieldName> - </dependency> </entityConsumer> <entityActionField> <name>newOffer</name> @@ -298,6 +299,11 @@ <entityConsumer> <name>Timetrackings</name> <refreshParent v="true" /> + <dependency> + <name>dependency</name> + <entityName>Timetracking_entity</entityName> + <fieldName>Timetrackings</fieldName> + </dependency> <children> <entityParameter> <name>ObjectId_param</name> @@ -308,11 +314,6 @@ <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/timetrackings/children/rowid_param/valueProcess.js</valueProcess> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>Timetracking_entity</entityName> - <fieldName>Timetrackings</fieldName> - </dependency> </entityConsumer> <entityParameter> <name>ContactId_param</name> @@ -336,6 +337,11 @@ <entityConsumer> <name>Documents</name> <selectionMode>MULTI</selectionMode> + <dependency> + <name>dependency</name> + <entityName>Document_entity</entityName> + <fieldName>Documents</fieldName> + </dependency> <children> <entityParameter> <name>AssignmentRowId_param</name> @@ -350,15 +356,15 @@ <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/documents/children/mstteamid_param/valueProcess.js</valueProcess> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>Document_entity</entityName> - <fieldName>Documents</fieldName> - </dependency> </entityConsumer> <entityConsumer> <name>MainDocuments</name> <stateProcess>%aditoprj%/entity/Salesproject_entity/entityfields/maindocuments/stateProcess.js</stateProcess> + <dependency> + <name>dependency</name> + <entityName>Document_entity</entityName> + <fieldName>MainDocuments</fieldName> + </dependency> <children> <entityParameter> <name>AssignmentRowId_param</name> @@ -369,11 +375,6 @@ <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/maindocuments/children/assignmenttable_param/valueProcess.js</valueProcess> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>Document_entity</entityName> - <fieldName>MainDocuments</fieldName> - </dependency> </entityConsumer> <entityActionField> <name>newTimetracking</name> @@ -384,6 +385,11 @@ </entityActionField> <entityConsumer> <name>KeywordProbabilties</name> + <dependency> + <name>dependency</name> + <entityName>KeywordEntry_entity</entityName> + <fieldName>SpecificContainerKeywords</fieldName> + </dependency> <children> <entityParameter> <name>ContainerName_param</name> @@ -392,14 +398,14 @@ <expose v="false" /> </entityParameter> </children> + </entityConsumer> + <entityConsumer> + <name>KeywordStates</name> <dependency> <name>dependency</name> <entityName>KeywordEntry_entity</entityName> <fieldName>SpecificContainerKeywords</fieldName> </dependency> - </entityConsumer> - <entityConsumer> - <name>KeywordStates</name> <children> <entityParameter> <name>ContainerName_param</name> @@ -407,11 +413,6 @@ <expose v="false" /> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>KeywordEntry_entity</entityName> - <fieldName>SpecificContainerKeywords</fieldName> - </dependency> </entityConsumer> <entityActionField> <name>newActivity</name> @@ -431,17 +432,17 @@ <entityConsumer> <name>KeywordWonLost</name> <selectionMode>MULTI</selectionMode> + <dependency> + <name>dependency</name> + <entityName>KeywordEntry_entity</entityName> + <fieldName>SpecificContainerKeywords</fieldName> + </dependency> <children> <entityParameter> <name>ContainerName_param</name> <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/keywordwonlost/children/containername_param/valueProcess.js</valueProcess> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>KeywordEntry_entity</entityName> - <fieldName>SpecificContainerKeywords</fieldName> - </dependency> </entityConsumer> <entityField> <name>REASONS</name> @@ -458,17 +459,6 @@ </entityField> <entityProvider> <name>Salesprojects</name> - <children> - <entityParameter> - <name>ContactId_param</name> - <expose v="true" /> - <mandatory v="true" /> - </entityParameter> - <entityParameter> - <name>PresetTitle_param</name> - <expose v="false" /> - </entityParameter> - </children> <dependencies> <entityDependency> <name>0925d17f-a26a-4641-aaf4-0f74796fefa7</name> @@ -489,6 +479,17 @@ <isConsumer v="false" /> </entityDependency> </dependencies> + <children> + <entityParameter> + <name>ContactId_param</name> + <expose v="true" /> + <mandatory v="true" /> + </entityParameter> + <entityParameter> + <name>PresetTitle_param</name> + <expose v="false" /> + </entityParameter> + </children> </entityProvider> <entityActionField> <name>newTask</name> @@ -499,6 +500,11 @@ <entityConsumer> <name>Tasks</name> <stateProcess>%aditoprj%/entity/Salesproject_entity/entityfields/tasks/stateProcess.js</stateProcess> + <dependency> + <name>dependency</name> + <entityName>Task_entity</entityName> + <fieldName>Tasks</fieldName> + </dependency> <children> <entityParameter> <name>RowId_param</name> @@ -513,14 +519,17 @@ <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/tasks/children/objectid_param/valueProcess.js</valueProcess> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>Task_entity</entityName> - <fieldName>Tasks</fieldName> - </dependency> </entityConsumer> <entityProvider> <name>OpenSalesprojects</name> + <dependencies> + <entityDependency> + <name>631f55f9-fb0f-4205-bdb8-6e3476268ab4</name> + <entityName>Offer_entity</entityName> + <fieldName>Salesprojects</fieldName> + <isConsumer v="false" /> + </entityDependency> + </dependencies> <children> <entityParameter> <name>Status_param</name> @@ -531,14 +540,6 @@ <expose v="false" /> </entityParameter> </children> - <dependencies> - <entityDependency> - <name>631f55f9-fb0f-4205-bdb8-6e3476268ab4</name> - <entityName>Offer_entity</entityName> - <fieldName>Salesprojects</fieldName> - <isConsumer v="false" /> - </entityDependency> - </dependencies> </entityProvider> <entityParameter> <name>Status_param</name> @@ -547,22 +548,27 @@ </entityParameter> <entityConsumer> <name>SalesprojectStateMilestones</name> + <dependency> + <name>dependency</name> + <entityName>SalesprojectMilestone_entity</entityName> + <fieldName>StateMilestones</fieldName> + </dependency> <children> <entityParameter> <name>SalesprojectId_param</name> <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/salesprojectstatemilestones/children/salesprojectid_param/valueProcess.js</valueProcess> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>SalesprojectMilestone_entity</entityName> - <fieldName>StateMilestones</fieldName> - </dependency> </entityConsumer> <entityConsumer> <name>Attributes</name> <stateProcess>%aditoprj%/entity/Salesproject_entity/entityfields/attributes/stateProcess.js</stateProcess> <onValidation>%aditoprj%/entity/Salesproject_entity/entityfields/attributes/onValidation.js</onValidation> + <dependency> + <name>dependency</name> + <entityName>AttributeRelation_entity</entityName> + <fieldName>AttributeRelations</fieldName> + </dependency> <children> <entityParameter> <name>ObjectType_param</name> @@ -573,15 +579,15 @@ <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/attributes/children/objectrowid_param/valueProcess.js</valueProcess> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>AttributeRelation_entity</entityName> - <fieldName>AttributeRelations</fieldName> - </dependency> </entityConsumer> <entityConsumer> <name>AttributeTree</name> <stateProcess>%aditoprj%/entity/Salesproject_entity/entityfields/attributetree/stateProcess.js</stateProcess> + <dependency> + <name>dependency</name> + <entityName>AttributeRelation_entity</entityName> + <fieldName>TreeProvider</fieldName> + </dependency> <children> <entityParameter> <name>ObjectType_param</name> @@ -592,29 +598,29 @@ <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/attributetree/children/objectrowid_param/valueProcess.js</valueProcess> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>AttributeRelation_entity</entityName> - <fieldName>TreeProvider</fieldName> - </dependency> </entityConsumer> <entityConsumer> <name>LogHistories</name> + <dependency> + <name>dependency</name> + <entityName>LogHistory_entity</entityName> + <fieldName>LogHistoryProvider</fieldName> + </dependency> <children> <entityParameter> <name>tablenames_param</name> <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js</valueProcess> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>LogHistory_entity</entityName> - <fieldName>LogHistoryProvider</fieldName> - </dependency> </entityConsumer> <entityConsumer> <name>Classifications</name> <refreshParent v="true" /> + <dependency> + <name>dependency</name> + <entityName>Classification_entity</entityName> + <fieldName>Classifications</fieldName> + </dependency> <children> <entityParameter> <name>ObjectRowid_param</name> @@ -629,11 +635,6 @@ <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/classifications/children/classificationtype_param/valueProcess.js</valueProcess> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>Classification_entity</entityName> - <fieldName>Classifications</fieldName> - </dependency> </entityConsumer> <entityField> <name>RemainingTime</name> @@ -647,6 +648,11 @@ </entityField> <entityConsumer> <name>SalesprojectForecastCharts</name> + <dependency> + <name>dependency</name> + <entityName>Turnover_entity</entityName> + <fieldName>FilteredTurnovers</fieldName> + </dependency> <children> <entityParameter> <name>SalesprojectId_param</name> @@ -665,25 +671,20 @@ <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/salesprojectforecastcharts/children/yearcounttoshow_param/valueProcess.js</valueProcess> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>Turnover_entity</entityName> - <fieldName>FilteredTurnovers</fieldName> - </dependency> </entityConsumer> <entityConsumer> <name>SalesprojectPhaseStepper</name> + <dependency> + <name>dependency</name> + <entityName>SalesprojectPhase_entity</entityName> + <fieldName>Phases</fieldName> + </dependency> <children> <entityParameter> <name>CurrentPhase_param</name> <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/salesprojectphasestepper/children/currentphase_param/valueProcess.js</valueProcess> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>SalesprojectPhase_entity</entityName> - <fieldName>Phases</fieldName> - </dependency> </entityConsumer> <entityField> <name>PHASEINFO</name> @@ -706,17 +707,17 @@ </entityField> <entityConsumer> <name>ProjectTypeAttribute</name> + <dependency> + <name>dependency</name> + <entityName>Attribute_entity</entityName> + <fieldName>SpecificAttribute</fieldName> + </dependency> <children> <entityParameter> <name>ObjectType_param</name> <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/projecttypeattribute/children/objecttype_param/valueProcess.js</valueProcess> </entityParameter> </children> - <dependency> - <name>dependency</name> - <entityName>Attribute_entity</entityName> - <fieldName>SpecificAttribute</fieldName> - </dependency> </entityConsumer> <entityProvider> <name>QuickEntrySalesprojects</name> @@ -778,6 +779,12 @@ <title>Classification</title> <groupable v="true" /> </entityField> + <entityField> + <name>DATE_NEW</name> + </entityField> + <entityField> + <name>ACTIVE</name> + </entityField> </entityFields> <recordContainers> <dbRecordContainer> @@ -944,6 +951,14 @@ <name>MST_TEAM_ID.displayValue</name> <recordfield>MST_TEAM.TEAMNAME</recordfield> </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>DATE_NEW.value</name> + <recordfield>SALESPROJECT.STARTDATE</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>ACTIVE.value</name> + <expression>%aditoprj%/entity/Salesproject_entity/recordcontainers/db/recordfieldmappings/active.value/expression.js</expression> + </dbRecordFieldMapping> </recordFieldMappings> <filterExtensions> <filterExtensionSet> diff --git a/entity/Salesproject_entity/contentDescriptionProcess.js b/entity/Salesproject_entity/contentDescriptionProcess.js new file mode 100644 index 0000000000..3e00d9c673 --- /dev/null +++ b/entity/Salesproject_entity/contentDescriptionProcess.js @@ -0,0 +1,14 @@ +import("Keyword_lib"); +import("system.translate"); +import("system.datetime"); +import("system.vars"); +import("system.result"); +import("KeywordRegistry_basic"); + +var res = [translate.text("Phase") + ": " + KeywordUtils.getViewValue($KeywordRegistry.salesprojectPhase(), vars.get("$field.PHASE")), + translate.text("Classification: ") + vars.get("$field.CLASSIFICATIONVALUE"), + translate.text("Volume") + ": " + vars.get("$field.VOLUME.displayValue"), + translate.text("Probability") + ": " + vars.get("$field.PROBABILITY.displayValue"), + translate.text("Creation date") + ": " + datetime.toDate(vars.get("$field.DATE_NEW"), translate.text("dd.MM.yyyy"))]; + +result.string(res.join(" | ")); \ No newline at end of file diff --git a/entity/Salesproject_entity/contentTitleProcess.js b/entity/Salesproject_entity/contentTitleProcess.js index 5465ff4efe..dd3706b77c 100644 --- a/entity/Salesproject_entity/contentTitleProcess.js +++ b/entity/Salesproject_entity/contentTitleProcess.js @@ -1,4 +1,6 @@ import("system.vars"); import("system.result"); -result.string(vars.get("$field.PROJECTTITLE")); \ No newline at end of file +var res = [vars.get("$field.PROJECTCODE"), vars.get("$field.PROJECTTITLE"), vars.get("$field.STATUS.displayValue")]; + +result.string(res.join(" | ")); \ No newline at end of file diff --git a/entity/Salesproject_entity/recordcontainers/db/recordfieldmappings/active.value/expression.js b/entity/Salesproject_entity/recordcontainers/db/recordfieldmappings/active.value/expression.js new file mode 100644 index 0000000000..d91a07968d --- /dev/null +++ b/entity/Salesproject_entity/recordcontainers/db/recordfieldmappings/active.value/expression.js @@ -0,0 +1,6 @@ +import("Context_lib"); +import("system.result"); +import("KeywordRegistry_basic"); + +var activArr = [$KeywordRegistry.salesprojectState$open(), $KeywordRegistry.salesprojectState$postponed()]; +result.string(ContextUtils.buildActiveCaseWhen(activArr, "SALESPROJECT.STATUS")); \ No newline at end of file diff --git a/entity/SupportTicket_entity/SupportTicket_entity.aod b/entity/SupportTicket_entity/SupportTicket_entity.aod index a289e1083c..7449b20944 100644 --- a/entity/SupportTicket_entity/SupportTicket_entity.aod +++ b/entity/SupportTicket_entity/SupportTicket_entity.aod @@ -5,6 +5,7 @@ <documentation>%aditoprj%/entity/SupportTicket_entity/documentation.adoc</documentation> <title>Support Ticket</title> <contentTitleProcess>%aditoprj%/entity/SupportTicket_entity/contentTitleProcess.js</contentTitleProcess> + <contentDescriptionProcess>%aditoprj%/entity/SupportTicket_entity/contentDescriptionProcess.js</contentDescriptionProcess> <afterUiInit>%aditoprj%/entity/SupportTicket_entity/afterUiInit.js</afterUiInit> <onValidation>%aditoprj%/entity/SupportTicket_entity/onValidation.js</onValidation> <useFavorites v="true" /> @@ -459,6 +460,12 @@ <name>TASK_ICON_COLOR</name> <valueProcess>%aditoprj%/entity/SupportTicket_entity/entityfields/task_icon_color/valueProcess.js</valueProcess> </entityField> + <entityField> + <name>DATE_NEW</name> + </entityField> + <entityField> + <name>ACTIVE</name> + </entityField> </entityFields> <recordContainers> <dbRecordContainer> @@ -597,6 +604,14 @@ <recordfield>TICKET.TICKETID</recordfield> <aggregateType>COUNT</aggregateType> </aggregateFieldDbMapping> + <dbRecordFieldMapping> + <name>DATE_NEW.value</name> + <recordfield>TASK.START_DATE</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>ACTIVE.value</name> + <expression>%aditoprj%/entity/SupportTicket_entity/recordcontainers/db/recordfieldmappings/active.value/expression.js</expression> + </dbRecordFieldMapping> </recordFieldMappings> <filterExtensions> <filterExtension> diff --git a/entity/SupportTicket_entity/contentDescriptionProcess.js b/entity/SupportTicket_entity/contentDescriptionProcess.js new file mode 100644 index 0000000000..1d91623c4a --- /dev/null +++ b/entity/SupportTicket_entity/contentDescriptionProcess.js @@ -0,0 +1,18 @@ +import("KeywordRegistry_basic"); +import("Keyword_lib"); +import("system.translate"); +import("system.datetime"); +import("system.vars"); +import("system.result"); + +var res = []; + +if(vars.get("$field.TASK_EDITOR_CONTACT_ID")) + res = [translate.text("{$TICKET_EDITOR}") + ": " + vars.get("$field.TASK_EDITOR_CONTACT_ID.displayValue")]; + + res.push(translate.text("Maturity") + ": " + datetime.toDate(vars.get("$field.TASK_MATURITY_DATE"), translate.text("dd.MM.yyyy"))); + res.push(translate.text("Progress") + ": " + KeywordUtils.getViewValue($KeywordRegistry.taskProgress(), vars.get("$field.TASK_PROGRESS"))); + res.push(translate.text("Creation date") + ": " + datetime.toDate(vars.get("$field.DATE_NEW"), translate.text("dd.MM.yyyy"))); + +result.string(res.join(" | ")); + \ No newline at end of file diff --git a/entity/SupportTicket_entity/contentTitleProcess.js b/entity/SupportTicket_entity/contentTitleProcess.js index aae1064b78..626ec76cac 100644 --- a/entity/SupportTicket_entity/contentTitleProcess.js +++ b/entity/SupportTicket_entity/contentTitleProcess.js @@ -1,4 +1,9 @@ +import("KeywordRegistry_basic"); +import("Keyword_lib"); import("system.vars"); import("system.result"); -result.string(vars.get("$field.TASK_SUBJECT")) \ No newline at end of file + +var res = [vars.get("$field.TASK_SUBJECT"), vars.get("$field.TASK_STATUS.displayValue")]; + +result.string(res.join(" | ")) \ No newline at end of file diff --git a/entity/SupportTicket_entity/recordcontainers/db/recordfieldmappings/active.value/expression.js b/entity/SupportTicket_entity/recordcontainers/db/recordfieldmappings/active.value/expression.js new file mode 100644 index 0000000000..26673fbc44 --- /dev/null +++ b/entity/SupportTicket_entity/recordcontainers/db/recordfieldmappings/active.value/expression.js @@ -0,0 +1,7 @@ +import("Context_lib"); +import("system.result"); +import("KeywordRegistry_basic"); + +var activArr = [$KeywordRegistry.taskStatus$new(), $KeywordRegistry.taskStatus$unassigned(), $KeywordRegistry.taskStatus$assigned(), +$KeywordRegistry.taskStatus$inProgress(), $KeywordRegistry.taskStatus$waiting(), $KeywordRegistry.taskStatus$customerChecks()]; +result.string(ContextUtils.buildActiveCaseWhen(activArr, "TASK.STATUS")); \ No newline at end of file diff --git a/entity/TaskLink_entity/entityfields/object_rowid/displayValueProcess.js b/entity/TaskLink_entity/entityfields/object_rowid/displayValueProcess.js index c87f4789fa..23f715a5e9 100644 --- a/entity/TaskLink_entity/entityfields/object_rowid/displayValueProcess.js +++ b/entity/TaskLink_entity/entityfields/object_rowid/displayValueProcess.js @@ -6,5 +6,5 @@ import("Context_lib"); if(vars.get("$field.OBJECT_ROWID") && vars.get("$field.OBJECT_TYPE")) { - result.string(db.cell(ContextUtils.getNameSql(vars.get("$field.OBJECT_TYPE"), vars.get("$field.OBJECT_ROWID")))); + result.string(ContextUtils.getTitleByContext(vars.get("$field.OBJECT_TYPE"), vars.get("$field.OBJECT_ROWID"))); } \ No newline at end of file diff --git a/entity/Task_entity/Task_entity.aod b/entity/Task_entity/Task_entity.aod index f7b03fedd7..45f3ee0f0c 100644 --- a/entity/Task_entity/Task_entity.aod +++ b/entity/Task_entity/Task_entity.aod @@ -6,6 +6,7 @@ <title>Task</title> <grantDeleteProcess>%aditoprj%/entity/Task_entity/grantDeleteProcess.js</grantDeleteProcess> <contentTitleProcess>%aditoprj%/entity/Task_entity/contentTitleProcess.js</contentTitleProcess> + <contentDescriptionProcess>%aditoprj%/entity/Task_entity/contentDescriptionProcess.js</contentDescriptionProcess> <afterUiInit>%aditoprj%/entity/Task_entity/afterUiInit.js</afterUiInit> <onValidation>%aditoprj%/entity/Task_entity/onValidation.js</onValidation> <initFilterProcess>%aditoprj%/entity/Task_entity/initFilterProcess.js</initFilterProcess> @@ -503,6 +504,9 @@ <name>ICON_COLOR</name> <valueProcess>%aditoprj%/entity/Task_entity/entityfields/icon_color/valueProcess.js</valueProcess> </entityField> + <entityField> + <name>DATE_NEW</name> + </entityField> </entityFields> <recordContainers> <dbRecordContainer> diff --git a/entity/Task_entity/contentDescriptionProcess.js b/entity/Task_entity/contentDescriptionProcess.js new file mode 100644 index 0000000000..b07a72fe7c --- /dev/null +++ b/entity/Task_entity/contentDescriptionProcess.js @@ -0,0 +1,5 @@ +import("system.translate"); +import("system.datetime"); +import("system.vars"); +import("system.result"); +result.string(datetime.toDate(vars.get("$field.DATE_NEW"), translate.text("dd.MM.yyyy"))); \ No newline at end of file diff --git a/entity/WorkflowStartConfig_entity/WorkflowStartConfig_entity.aod b/entity/WorkflowStartConfig_entity/WorkflowStartConfig_entity.aod index beafceffdf..e57032a87e 100644 --- a/entity/WorkflowStartConfig_entity/WorkflowStartConfig_entity.aod +++ b/entity/WorkflowStartConfig_entity/WorkflowStartConfig_entity.aod @@ -63,10 +63,6 @@ <name>InvertBlacklist_param</name> <valueProcess>%aditoprj%/entity/WorkflowStartConfig_entity/entityfields/contexts/children/invertblacklist_param/valueProcess.js</valueProcess> </entityParameter> - <entityParameter> - <name>GetAllContexts_param</name> - <valueProcess>%aditoprj%/entity/WorkflowStartConfig_entity/entityfields/contexts/children/getallcontexts_param/valueProcess.js</valueProcess> - </entityParameter> </children> </entityConsumer> <entityConsumer> diff --git a/entity/WorkflowStartConfig_entity/entityfields/contexts/children/getallcontexts_param/valueProcess.js b/entity/WorkflowStartConfig_entity/entityfields/contexts/children/getallcontexts_param/valueProcess.js deleted file mode 100644 index 40effa0178..0000000000 --- a/entity/WorkflowStartConfig_entity/entityfields/contexts/children/getallcontexts_param/valueProcess.js +++ /dev/null @@ -1,3 +0,0 @@ -import("system.result"); - -result.string(true); \ No newline at end of file diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod index 2c2348c9da..2abce19573 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -6,6 +6,10 @@ <country></country> <variant></variant> <keyValueMap> + <entry> + <key>Illegal Parent Operator in buildFilterObj-Function:</key> + <value>Ãœbergebener Operator ungültig in Funktion "buildFilterObj"</value> + </entry> <entry> <key>Probability AI</key> <value>Wahrscheinlichkeit KI</value> diff --git a/neonContext/SupportTicket/SupportTicket.aod b/neonContext/SupportTicket/SupportTicket.aod index 5115f0e09b..b0233b4061 100644 --- a/neonContext/SupportTicket/SupportTicket.aod +++ b/neonContext/SupportTicket/SupportTicket.aod @@ -4,6 +4,7 @@ <title>Support Ticket</title> <majorModelMode>DISTRIBUTED</majorModelMode> <documentation>%aditoprj%/neonContext/SupportTicket/documentation.adoc</documentation> + <icon>VAADIN:CHAT</icon> <mainView>SupportTicketMain_view</mainView> <filterView>SupportTicketFilter_view</filterView> <editView>SupportTicketEdit_view</editView> diff --git a/neonView/360DegreeFilter_view/360DegreeFilter_view.aod b/neonView/360DegreeFilter_view/360DegreeFilter_view.aod index fcb2588703..bf84f6db4d 100644 --- a/neonView/360DegreeFilter_view/360DegreeFilter_view.aod +++ b/neonView/360DegreeFilter_view/360DegreeFilter_view.aod @@ -2,7 +2,7 @@ <neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.6" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.6"> <name>360DegreeFilter_view</name> <majorModelMode>DISTRIBUTED</majorModelMode> - <filterable v="false" /> + <filterable v="true" /> <layout> <groupLayout> <name>layout</name> @@ -10,22 +10,25 @@ </layout> <children> <treeViewTemplate> - <name>Treetable</name> + <name>Tree</name> <favoriteActionGroup2>newModule</favoriteActionGroup2> <titleField>TITLE</titleField> - <descriptionField>DATE</descriptionField> + <descriptionField>DESCRIPTION</descriptionField> <iconField>ICON</iconField> + <hideContentSearch v="false" /> <entityField>#ENTITY</entityField> + <linkedColumns /> <defaultGroupFields> - <element>ENTITY_NAME</element> + <element>GROUP</element> </defaultGroupFields> + <fixedFilterFields /> </treeViewTemplate> <timelineViewTemplate> <name>Timeline</name> <favoriteActionGroup2>newModule</favoriteActionGroup2> - <dateField>DATE</dateField> + <dateField>DATE_NEW</dateField> <titleField>TITLE</titleField> - <descriptionField>ENTITY_NAME</descriptionField> + <descriptionField>GROUP</descriptionField> <iconIdField>ICON</iconIdField> <hideContentSearch v="false" /> <entityField>#ENTITY</entityField> diff --git a/process/Context_lib/process.js b/process/Context_lib/process.js index 7aa6dedab7..b7bf2e8a17 100644 --- a/process/Context_lib/process.js +++ b/process/Context_lib/process.js @@ -1,3 +1,4 @@ +import("system.logging"); import("Util_lib"); import("system.entities"); import("system.tools"); @@ -29,7 +30,7 @@ function ContextUtils() {} */ ContextUtils.getCurrentContextId = function() { - return vars.getString("$sys.currentcontextname"); + return vars.getString("$sys.currentcontextname"); } /** @@ -145,7 +146,7 @@ ContextUtils.getContextConsumer = function(pContextId) case ContextUtils.getContextName("PrivatePerson"): return "PrivatePersons"; case ContextUtils.getContextName("Leadimport"): - return "Leadimport"; + return "Leadimports"; case ContextUtils.getContextName("Task"): return "Tasks"; case ContextUtils.getContextName("SupportTicket"): @@ -171,9 +172,9 @@ ContextUtils.loadContentTitle = function(pEntity, pUid, pProvider) return ""; var conf = entities.createConfigForLoadingRows() - .entity(pEntity) - .uid(pUid) - .fields(["#CONTENTTITLE"]); + .entity(pEntity) + .uid(pUid) + .fields(["#CONTENTTITLE"]); if (pProvider) conf.provider(pProvider); @@ -182,35 +183,107 @@ ContextUtils.loadContentTitle = function(pEntity, pUid, pProvider) return rows.length === 1 ? rows[0]["#CONTENTTITLE"] : ""; } + +/** + * loads the contentdescription by using entities.getRow + * @param {String} pEntity The entity name you want to load the title for + * @param {String} pUid the uid for which to load the title + * @param {String} [pProvider] providername when instead of the default provider another provider shall be used + * + * @return the #CONTENTDESCRIPTION or "" + */ +ContextUtils.loadContentDescription = function(pEntity, pUid, pProvider) +{ + if (!pUid) + return ""; + + var conf = entities.createConfigForLoadingRows() + .entity(pEntity) + .uid(pUid) + .fields(["#CONTENTDESCRIPTION"]); + + if (pProvider) + conf.provider(pProvider); + + var rows = entities.getRows(conf); + return rows.length === 1 ? rows[0]["#CONTENTDESCRIPTION"] : ""; +} + +/** + * loads specified Fields for one Row by using entities.getRow + * @param {String} pEntity The entity name you want to load the title for + * @param {String[]} [pUid] the uids for which to load the content + * @param {String[]} [pFields] fields you want as result + * @param {String[]} [pExcludeIDs] uids you want to exclude from the list + * @param {String} pProvider providername when instead of the default provider another provider shall be used + * + * @return the Values of the Fields + */ +ContextUtils.loadContent = function(pEntity, pUid, pFields, pExcludeIDs, pProvider) +{ + if (!pEntity) + return []; + + var conf = entities.createConfigForLoadingRows() + .entity(pEntity) + .uids(pUid) + .fields(pFields); + + if (pProvider) + conf.provider(pProvider); + + if (pExcludeIDs) + { + var childsArray = [{ + "type":"row", + "name":"#UID", + "operator":"NOT_IN", + "value": JSON.stringify(pExcludeIDs), + "key": JSON.stringify(pExcludeIDs), + "contenttype":"TEXT" + }]; + + + var pFilterParent = { + "type":"group", + "operator":"OR", + "childs": childsArray + }; + + conf.filter(JSON.stringify(pFilterParent)); + } + + var rows = entities.getRows(conf); + return rows && rows.length > 0 ? rows : []; +} + + /** * - * @param {Boolean} [pFilter=false] filter only for contexts which have a mapping in ContextUtils.getSelectMap - * @param {String[]} [pBlacklist] contextIds that shall not be included (so this is a additional filter to the pFilter param) + * @param {String[]} [pBlacklist] contextIds that shall not be included * @param {Boolean} [pInvertBlacklist=false] decides whether the items in pBlacklist are excluded (false) or * everything that is NOT in pBlacklist is excluded (true) * (-> if it is a whitelist or blacklist) * * @return {String[][]} the contexts [[contextId, contextName, contextTitle], [... ], ...] */ -ContextUtils.getContexts = function(pFilter, pBlacklist, pInvertBlacklist) +ContextUtils.getContexts = function(pBlacklist, pInvertBlacklist) { - if (pFilter == undefined) - pFilter = false; if (pInvertBlacklist == undefined) pInvertBlacklist = false; + var contexts = project.getDataModels(project.DATAMODEL_KIND_CONTEXT); + var contextsStandardList = ["Organisation", "Person", "PrivatePerson", "Activity", "Salesproject", "Contract", "Offer", "Order", "Product", "Task", + "Campaign", "CampaignStep", "SupportTicket", "Leadimport"]; - if (pFilter) - { - contexts = contexts.filter(function(pContext) { - if (pBlacklist && pBlacklist.indexOf(pContext[0]) > -1 != pInvertBlacklist) - return false; - // filter only contexts which have defined mappings in Context_lib - return ContextUtils.getSelectMap ()[pContext[0]] != undefined; - }); - } - else if (pBlacklist) + contexts = contexts.filter(function(pContext) { + if (contextsStandardList.indexOf(pContext[0]) > -1) + return true; + return false; + }); + + if (pBlacklist) { contexts = contexts.filter(function(pContext) { if (pBlacklist && pBlacklist.indexOf(pContext[0]) > -1 != pInvertBlacklist) @@ -220,16 +293,16 @@ ContextUtils.getContexts = function(pFilter, pBlacklist, pInvertBlacklist) } return contexts.map(ContextUtils._contextDataMapping).sort(function(pContext1, pContext2) - { - // sort after ContextTitle - if (pContext1[2] > pContext2[2]) - return 1; + { + // sort after ContextTitle + if (pContext1[2] > pContext2[2]) + return 1; - if (pContext1[2] < pContext2[2]) - return -1; + if (pContext1[2] < pContext2[2]) + return -1; - return 0; - }); + return 0; + }); } /** @@ -259,489 +332,131 @@ ContextUtils._contextDataMapping = function(pContext) return [pContext[0], contextName, (pContext[1] ? pContext[1] : contextName)]; } + /** - * represents a single context selection for one context - * this is usefull for objectlinks and 360° definition - * most properties are read only and can only be written with a setter + * gets the Title for a specific Context * - * @param {String} [pTableName] presets the matching property of the object - * @param {String} [pIdField] presets the matching property of the object - * @param {String} [pTitleExpression] presets the matching property of the object + * @param {String} pContextId the name of the context + * @param {String} pRowId Uid of certain Context * - * TODO: mostly temporary function until you can get fields from another Entity - * - * @class + * @return {String} The #CONTENTTITLE */ -function ContextSelector(pTableName, pIdField, pTitleExpression) +ContextUtils.getTitleByContext = function(pContextId, pRowId) { - //the >>this.propertyX = null;<< is for autocomplete in the designer - - /** - * title-definition; db-column or another sql-expression (like concating fields) as long as it returns one field - * read-only property; set it with a matching setter - * @property titleExpression - */ - this.titleExpression = null; ProtoPropertyUtils.makeSemiReadOnly(this, "titleExpression"); - this.setTitleExpression(pTitleExpression); - - /** - * name of the database-table - * read-only property; set it with a matching setter - * @property tableName - */ - this.tableName = null; ProtoPropertyUtils.makeSemiReadOnly(this, "tableName"); - this.setTableName(pTableName); - - /** - * db-field for the ID of one record (UID of matching context) - * read-only property; set it with a matching setter - * @property idField - */ - this.idField = null; ProtoPropertyUtils.makeSemiReadOnly(this, "idField"); - this.setIdField(pIdField); - - /** - * expression for additional joins to be made (addotopmaö pt table-name) - * read-only property; set it with a matching setter - * @property joinExpression - */ - this.joinExpression = null; ProtoPropertyUtils.makeSemiReadOnly(this, "joinExpression"); - /** - * db-field for the ID of the relation to a CONTACT-record - * read-only property; set it with a matching setter - * @property contactIdField - */ - this.contactIdField = null; ProtoPropertyUtils.makeSemiReadOnly(this, "contactIdField"); - /** - * db-field that represents the date of creation - * read-only property; set it with a matching setter - * @property creationDateField - */ - this.creationDateField = null; ProtoPropertyUtils.makeSemiReadOnly(this, "creationDateField"); - /** - * db-field where the STATE-information (active/inactive) is stored (see the activeStates-property) - * read-only property; set it with a matching setter - * @property stateField - */ - this.stateField = null; ProtoPropertyUtils.makeSemiReadOnly(this, "stateField"); - /** - * array that contains IDs of states that represent an "active"-state - * read-only property; set it with a matching setter - * @property activeStates - */ - this.activeStates = null; ProtoPropertyUtils.makeSemiReadOnly(this, "activeStates"); - this.condition = null; ProtoPropertyUtils.makeSemiReadOnly(this, "condition"); - /** - * db-field that will be used as groubBy - * read-only property; set it with a matching setter - * @property groupBy - */ - this.groupBy = null; ProtoPropertyUtils.makeSemiReadOnly(this, "groupBy"); - /** - * an object which contains the subcontexts and the prepared select to get the contactIds of them. - * - * { V-- SqlBuilder with all conditions needed V-IdCollumn name (with Tablename!) V-the contexts to show for this subcontext - * "Person": "Person": [newSelect("CONTACTID").from("CONTACT").where("PERSON_ID is not null"), "CONTACT.ORGANISATION_ID", ["Offer", "Order", "Contract", "SupportTicket"]], - * - * "Offer" ... // you can add as many subcontexts as you wish - * } - * read-only property; set it with a matching setter - * @property subContexts - */ - this.subContexts = null; ProtoPropertyUtils.makeSemiReadOnly(this, "subContexts"); + return ContextUtils.loadContentTitle(ContextUtils.getEntity(pContextId), pRowId); } + + /** - * creates a new instance of a ContextSelector and returns it - * if given it also sets some properties (property names with matching function-parameters) - * @static - */ -ContextSelector.create = function(pTableName, pIdField, pTitleExpression) -{ - return new ContextSelector(pTableName, pIdField, pTitleExpression); -}; -/** - * @param {String} pField the fieldname that shall be returned as full string - * @return {String} full field containing tablename and the column; if the column itself is already a full qualified field that field is returned - */ -ContextSelector.prototype.getFullField = function(pField) -{ - //always keep undefined (and null) just undefined since it's never a fullQualifier and tablename.undefined is useless - if (pField == undefined) - return undefined; - if (SqlUtils.isFullFieldQualifier(pField)) - return pField; - else - return this.tableName + "." + pField; -}; -/** - * @return {String} full id field containing tablename and column; if the column itself is already a full qualified field that field is returned - */ -ContextSelector.prototype.getFullIdField = function() -{ - return this.getFullField(this.idField); -}; -/** - * @return {String} full from-expression with tablename and join-part - */ -ContextSelector.prototype.getFullFromClause = function() -{ - if (this.joinExpression) - return " " + this.tableName + " " + this.joinExpression + " "; - else - return this.tableName; - -}; -/** - * @return {Object} in the following format: - * { - * "{contactid1}": [SqlBuilder, ContextArray], - * ... - * ... - * } + * gets Data from a specific Context with entities. Functions + * + * @param {String} pContextId the title of the context + * @param {String[]} [pContextConfig] Config defined in the Provider Parameter + * @param {Object} [pFilterObj] prepeared Filter Object + * @param {String[]} [pContactId] Array of all the Contactids you want to search through + * + * @return {String[][]} An Array of Fields (["#UID", "#TITLE", "#MAPPING", "#CONTENTDESCRIPTION", "#CONTENTTITLE", "CONTACT_ID", "DATE_NEW"]) for a certain Context */ -ContextSelector.prototype.getSubContexts = function(pParentRowId) -{ - if (this.subContexts) +ContextUtils.getContextDataViaReadEntity = function(pContextId, pContextConfig, pFilterObj, pContactId) +{ + if(pContextConfig.childField && pContextConfig.parentField && pContextConfig.contactIdField && pContextConfig.subContext) { - var sqls = {}; - for (let contextId in this.subContexts) - { - // Copy the builder to prevent modifying the builder in this.subContexts - var select = this.subContexts[contextId][0].copy(); - - // add id-condition - if (select.whereWasCalled()) - { - select.and(this.subContexts[contextId][1], pParentRowId); - } - else - { - select.where(this.subContexts[contextId][1], pParentRowId); - } - - sqls[contextId] = [select, this.subContexts[contextId][2]]; - } + var prefilter = Utils.buildFilterObj({}, pContextConfig.contactIdField, "IN", "TEXT", JSON.stringify(pContactId), JSON.stringify(pContactId), "OR"); + var resObj = []; + + var subConf = entities.createConfigForLoadingRows() + .entity(ContextUtils.getEntity(pContextConfig.subContext)) + .fields([pContextConfig.childField]) + .filter(JSON.stringify(prefilter.filter)) - return sqls; + var subRes = entities.getRows(subConf); + for(var id in subRes) + resObj.push(subRes[id][pContextConfig.childField]); + + pFilterObj = Utils.buildFilterObj(pFilterObj, pContextConfig.parentField, "IN", "TEXT", JSON.stringify(resObj), JSON.stringify(resObj), "AND"); } else - return {}; - -}; -//setters which to nothing special; no need to document them -ContextSelector.prototype.setTitleExpression = function(pValue) -{ - this._titleExpression = pValue; - return this; -}; -ContextSelector.prototype.setTableName = function(pValue) -{ - this._tableName = pValue; - return this; -}; -ContextSelector.prototype.setIdField = function(pValue) -{ - this._idField = pValue; - return this; -}; -ContextSelector.prototype.setJoinExpression = function(pValue) -{ - this._joinExpression = pValue; - return this; -}; -ContextSelector.prototype.setContactIdField = function(pValue) -{ - this._contactIdField = pValue; - return this; -}; -ContextSelector.prototype.setCreationDateField = function(pValue) -{ - this._creationDateField = pValue; - return this; -}; -ContextSelector.prototype.setStateField = function(pValue) -{ - this._stateField = pValue; - return this; -}; -ContextSelector.prototype.setActiveStates = function(pValue) -{ - this._activeStates = pValue; - return this; -}; -/** - * sets the condition property of a ContextSelector-object - * @param {SqlBuilder} pSqlBuilder condition as SqlBuilder-object - */ -ContextSelector.prototype.setCondition = function(pSqlBuilder) -{ - this._condition = pSqlBuilder; - return this; -}; -ContextSelector.prototype.setSubContexts = function(pContexts) -{ - this._subContexts = pContexts; - return this; -}; -ContextSelector.prototype.setGroupBy = function(pValue) -{ - this._groupBy = pValue; - return this; -}; - -/** - * TODO: !!!temporary function until you can get fields from another Entity!!! - */ -ContextUtils.getSelectMap = function() -{ - var maskingUtils = new SqlMaskingUtils(); - var isOracle = maskingUtils.dbType == db.DBTYPE_ORACLE10_CLUSTER - || maskingUtils.dbType == db.DBTYPE_ORACLE10_OCI - || maskingUtils.dbType == db.DBTYPE_ORACLE10_THIN; + { + pFilterObj = Utils.buildFilterObj(pFilterObj, "CONTACT_ID", "IN", "TEXT", JSON.stringify(pContactId), JSON.stringify(pContactId), "AND"); + } + + var fields = ["#UID", "#TITLE", "#MAPPING", "#CONTENTDESCRIPTION", "#CONTENTTITLE", "CONTACT_ID", "DATE_NEW", "ACTIVE"]; + if(pContextConfig.setGroupBy) + fields.push(pContextConfig.setGroupBy); + + + var conf = entities.createConfigForLoadingRows() + .entity(ContextUtils.getEntity(pContextId)) + .fields(fields) - return { - "Organisation": ContextSelector.create("ORGANISATION", "CONTACT.CONTACTID", "ORGANISATION.NAME") - .setJoinExpression("join CONTACT on ORGANISATION.ORGANISATIONID = CONTACT.ORGANISATION_ID and CONTACT.PERSON_ID is null") - .setCondition(newWhere("ORGANISATION.ORGANISATIONID", "0", SqlBuilder.NOT_EQUAL())) - .setSubContexts({ - "Person": [newSelect("CONTACTID").from("CONTACT").where("PERSON_ID is not null"), "CONTACT.ORGANISATION_ID", ["Offer", "Order", "Contract", "SupportTicket"]] - }) - ,"Person": ContextSelector.create("CONTACT", "CONTACTID") - .setTitleExpression(maskingUtils.concatWithSeparator([ - new ContactTitleRenderer(Contact.createWithColumnPreset()).asSql() - ,"' - '"//looks pretty bad; TODO: workaround till Lookups can be loaded over a link-entity; then use displayProc - ,"defaultAddress.ADDRESS", "defaultAddress.BUILDINGNO" - ,"' - '" - ,"defaultAddress.COUNTRY", "defaultAddress.ZIP", "defaultAddress.CITY" - ]," ")) - .setJoinExpression("join PERSON on PERSON.PERSONID = CONTACT.PERSON_ID " - + " join ORGANISATION on ORGANISATION.ORGANISATIONID = CONTACT.ORGANISATION_ID " - + " left join ADDRESS defaultAddress on defaultAddress.ADDRESSID = CONTACT.ADDRESS_ID") - ,"PrivatePerson": ContextSelector.create("PERSON", "PERSONID") - .setTitleExpression(maskingUtils.concatWithSeparator([ - new ContactTitleRenderer(Contact.createWithColumnPresetForPrivatePerson()).asSql() - ,"' - '"//looks pretty bad; TODO: workaround till Lookups can be loaded over a link-entity; then use displayProc - ,"defaultAddress.ADDRESS", "defaultAddress.BUILDINGNO" - ,"' - '" - ,"defaultAddress.COUNTRY", "defaultAddress.ZIP", "defaultAddress.CITY" - ]," ")) - .setJoinExpression("left join CONTACT on PERSON.PERSONID = CONTACT.PERSON_ID and CONTACT.ORGANISATION_ID = '0' left join ADDRESS defaultAddress on defaultAddress.ADDRESSID = CONTACT.ADDRESS_ID") - .setContactIdField("CONTACT.CONTACTID") - ,"Activity": ContextSelector.create("ACTIVITY", "ACTIVITYID", "SUBJECT") - ,"Salesproject": ContextSelector.create("SALESPROJECT", "SALESPROJECTID") - .setTitleExpression(maskingUtils.concatenate([ - "'" + translate.text("Salesproject") + "'", - "' '", - maskingUtils.cast("PROJECTCODE", SQLTYPES.VARCHAR, 10), - "' | '", - "PROJECTTITLE" - ])) - .setContactIdField("CONTACT_ID") - .setCreationDateField("STARTDATE") - .setStateField("STATUS") - .setActiveStates([$KeywordRegistry.salesprojectState$open(), $KeywordRegistry.salesprojectState$postponed()]) - ,"Contract": ContextSelector.create("CONTRACT", "CONTRACTID") - .setTitleExpression(maskingUtils.cast(maskingUtils.concatWithSeparator([ - KeywordUtils.getResolvedTitleSqlPart("ContractType", "CONTRACTTYPE"), - maskingUtils.cast("CONTRACTCODE", SQLTYPES.VARCHAR, 10) - ], " "), isOracle ? SQLTYPES.NVARCHAR : SQLTYPES.VARCHAR, 50)) - .setContactIdField("CONTACT_ID") - .setCreationDateField("CONTRACTSTART") - .setStateField("CONTRACTSTATUS") - .setActiveStates([$KeywordRegistry.contractState$validLimited(), $KeywordRegistry.contractState$validUnlimited(), $KeywordRegistry.contractState$notSigned()]) - ,"Offer": ContextSelector.create("OFFER", "OFFERID") - .setTitleExpression(maskingUtils.cast(maskingUtils.concatenate([ - "'" + translate.text("Offer") + "'", - "' '", - maskingUtils.cast("OFFERCODE", SQLTYPES.VARCHAR, 10), - "'-'", - maskingUtils.cast("VERSNR", SQLTYPES.VARCHAR, 10) - ]), isOracle ? SQLTYPES.NVARCHAR : SQLTYPES.VARCHAR, 50)) - .setContactIdField("CONTACT_ID") - .setCreationDateField("OFFERDATE") - .setStateField("STATUS") - .setActiveStates([$KeywordRegistry.offerStatus$open(), $KeywordRegistry.offerStatus$checked(), $KeywordRegistry.offerStatus$sent()]) - ,"Order": ContextSelector.create("SALESORDER", "SALESORDERID") - .setTitleExpression(maskingUtils.cast(maskingUtils.concatWithSeparator([ - KeywordUtils.getResolvedTitleSqlPart("OrderType", "ORDERTYPE"), - maskingUtils.cast("SALESORDERCODE", SQLTYPES.VARCHAR, 10) - ], " "), isOracle ? SQLTYPES.NVARCHAR : SQLTYPES.VARCHAR, 50)) - .setContactIdField("CONTACT_ID") - .setCreationDateField("SALESORDERDATE") - .setStateField("ORDERSTATUS") - .setActiveStates([0, 1]) - ,"Product": ContextSelector.create("PRODUCT", "PRODUCTID") - .setTitleExpression(maskingUtils.concatenate([ - "PRODUCTCODE", - "' | '", - "PRODUCTNAME" - ])) - ,"Task": ContextSelector.create("TASK", "TASKID", "SUBJECT") - ,"Campaign": ContextSelector.create("CAMPAIGN", "CAMPAIGNID") - .setTitleExpression(maskingUtils.concatWithSeparator(["CAMPAIGN.NAME", "CAMPAIGNSTEP.NAME"], " - ", false)) - .setContactIdField("CAMPAIGNPARTICIPANT.CONTACT_ID") - .setJoinExpression("left join CAMPAIGNPARTICIPANT on CAMPAIGNPARTICIPANT.CAMPAIGN_ID = CAMPAIGN.CAMPAIGNID " + - "left join CAMPAIGNSTEP on CAMPAIGNSTEP.CAMPAIGNSTEPID = CAMPAIGNPARTICIPANT.CAMPAIGNSTEP_ID") - .setCreationDateField("CAMPAIGNSTEP.DATE_START") - .setStateField("CAMPAIGN.STATUS") - .setActiveStates([$KeywordRegistry.campaignState$planning(), $KeywordRegistry.campaignState$approved()]) - ,"CampaignStep" : ContextSelector.create("CAMPAIGNSTEP", "CAMPAIGNSTEPID", "NAME") - ,"SupportTicket": ContextSelector.create("TICKET", "TICKETID", "TASK.SUBJECT") - .setJoinExpression("left join TASK on TASK.TASKID = TICKET.TASK_ID left join TASKLINK on TASKLINK.TASK_ID = TASK.TASKID") - .setCondition(newWhere("TICKET.TICKETTYPE", $KeywordRegistry.ticketType$supportTicket())) - .setContactIdField("TASKLINK.OBJECT_ROWID") - .setStateField("TASK.STATUS") - .setActiveStates([ - $KeywordRegistry.taskStatus$new(), - $KeywordRegistry.taskStatus$unassigned(), - $KeywordRegistry.taskStatus$assigned(), - $KeywordRegistry.taskStatus$inProgress(), - $KeywordRegistry.taskStatus$waiting(), - $KeywordRegistry.taskStatus$customerChecks(), - ]) - .setCreationDateField("TASK.START_DATE") - ,"BulkMail" : ContextSelector.create("BULKMAIL", "BULKMAILID", "NAME") - ,"SerialLetter" : ContextSelector.create("SERIALLETTER", "SERIALLETTERID", "TITLE") - ,"Leadimport": ContextSelector.create("LEADIMPORT", "LEADIMPORTID") - .setTitleExpression("LEADIMPORT.NAME") + if(pFilterObj) + conf.filter(JSON.stringify(pFilterObj.filter)) + + var res = []; + try//if Permissions prevent the user to read data from this context, entites.getRows throws an error. But we still wanna see the other Contexts + { + res = entities.getRows(conf); } -} - -/** - * TODO: !!!temporary function until you can get fields from another Entity!!! - */ -ContextUtils.getNameSubselectSql = function(pContextIdDbField, pRowIdDbField) -{ - var select = SqlBuilder.caseStatement() - - var selectMap = ContextUtils.getSelectMap(); - for (let contextId in selectMap) + catch(ex) { - let titleSelect = newSelect(selectMap[contextId].titleExpression) - .from(selectMap[contextId].getFullFromClause()) - .where(selectMap[contextId].getFullIdField() + " = " + pRowIdDbField); - - select.when(pContextIdDbField, contextId).then(titleSelect); + logging.log(ex) } - - return select.toString(); -} - -/** - * TODO: !!!temporary function until you can get fields from another Entity!!! - */ -ContextUtils.getNameSql = function(pContextId, pRowId, pRowIdField) -{ - var selectMap = ContextUtils.getSelectMap () - if (selectMap[pContextId] != undefined) + if(res.length > 0) { - var sql = newSelect(selectMap[pContextId].titleExpression) - .from(selectMap[pContextId].getFullFromClause()); - if (pRowIdField) - sql.where(selectMap[pContextId].getFullIdField() + " = " + pRowIdField); - else - sql.whereIfSet(selectMap[pContextId].getFullIdField(), pRowId); - return sql.build(SqlBuilder.NORESULT_CONDITION()); + if(pContextConfig.subContext) + { + if(res[0]["#UID"] == undefined || res[0]["#TITLE"] == undefined || res[0]["#MAPPING"] == undefined || res[0]["#CONTENTDESCRIPTION"] == undefined + || res[0]["#CONTENTTITLE"] == undefined || res[0]["DATE_NEW"] == undefined || res[0]["ACTIVE"] == undefined) + throw new Error(translate.text("Some prereserved EntityFields which are necessary fot 360° are not available. Context: "+pContextId + +" Data: "+JSON.stringify(res))); + } + else if(res[0]["CONTACT_ID"] == undefined) + throw new Error(translate.text("CONTACT_ID is not defined! Context: "+pContextId)); } - else - return "select 1 from person where 1=2"; + return res; } /** - * TODO: !!!temporary function until you can get fields from another Entity!!! + * gets the ContactId by using ContextUtils.loadContent() + * @param {String} pContextId The Context name + * @param {String} pRowId the uid for which to get the Contactid + * + * @return the Contactid of certain Context and Uid */ ContextUtils.getContactId = function(pContextId, pRowId) { - var selectMap = ContextUtils.getSelectMap() - if (selectMap[pContextId] != undefined && selectMap[pContextId].contactIdField) - { - return newSelect(selectMap[pContextId].contactIdField) - .from(selectMap[pContextId].tableName) - .where(selectMap[pContextId].getFullIdField(), pRowId) - .cell(); - } - else - return ""; + var res = ContextUtils.loadContent(ContextUtils.getEntity(pContextId), [pRowId], ["CONTACT_ID"])[0]["CONTACT_ID"]; + return res; } + /** - * TODO: !!!temporary function until you can get fields from another Entity!!! - * nur 360 + * gets the Count of Connections by Contactid + * @param {String} pContextId The Context name + * @param {String} pContactId The Contactid * + * @return count of datasets for that specific Context */ -ContextUtils.getContextDataSql = function(pContextId, pContactId, pWithDate, pActive, pWithState, pWithGroupBy, pUidsForFiltering, pExcludeIds) +ContextUtils.getCountByContactId = function(pContextId, pContactId) { - var selectMap = ContextUtils.getSelectMap(); - var ownContextSelector = selectMap[pContextId]; - var columns = [ownContextSelector.getFullIdField(), ownContextSelector.titleExpression]; - - if (pWithDate === true) - columns.push(ownContextSelector.getFullField(ownContextSelector.creationDateField) || "''"); - - if (pWithState === true) - { - if (ownContextSelector.stateField) - columns.push(ownContextSelector.getFullField(ownContextSelector.stateField) || "''"); - else - columns.push("''"); - } - - if (pWithGroupBy === true) - { - if (ownContextSelector.groupBy) - columns.push(ownContextSelector.getFullField(ownContextSelector.groupBy) || "''"); - else - columns.push("''"); - } - - var contextDataSelect = newSelect( columns.join(", ") ) - .from(ownContextSelector.getFullFromClause()) - .where(ownContextSelector.getFullField(ownContextSelector.contactIdField), pContactId, SqlBuilder.IN()) - .andIfSet(ownContextSelector.getFullIdField(), pUidsForFiltering, SqlBuilder.IN()) - .andIfSet(ownContextSelector.getFullIdField(), pExcludeIds, SqlBuilder.NOT_IN()); - - if (pActive != undefined) - { - var activeStates = ownContextSelector.activeStates; - if(activeStates != null && activeStates.length > 0) - { - var condSub = newWhere(); - activeStates.forEach(function (state) - { - if (ownContextSelector.stateField) - { - if(pActive) - condSub.or(ownContextSelector.getFullField(ownContextSelector.stateField), state) - else - condSub.and(ownContextSelector.getFullField(ownContextSelector.stateField), state, SqlBuilder.NOT_EQUAL()) - } - - }); - contextDataSelect.andIfSet(condSub); - } - } - contextDataSelect.andIfSet(ownContextSelector.condition); - return contextDataSelect.build(); + return ContextUtils.getContextDataViaReadEntity(pContextId, pContactId).length; } /** - * TODO: !!!temporary function until you can get fields from another Entity!!! + * decides if a record is activ or not + * @param {String[]} pActiveStates, 1-dimensional Array of Active States + * @param {String} pDBFieldName, a DBField for comparison + * + * @return a case when that resolves the active states to true and everything else to false in that Column */ -ContextUtils.getCountByContactId = function(pContextId, pContactId) +ContextUtils.buildActiveCaseWhen = function(pActiveStates, pDBFieldName) { - var contextObject = ContextUtils.getSelectMap()[pContextId]; - var tableName = contextObject.tableName; - var contactField = contextObject.getFullField(contextObject.contactIdField) - var join = contextObject.joinExpression; - if (tableName && contactField) - { - return newSelect("count(*)") - .from(tableName + (join ? join : "")) - .where(contactField, pContactId) - .cell(true, "0"); - return count; - } - return 0; + var extendedStates = []; + for(var i = 0; i < pActiveStates.length; i++) + extendedStates.push([pActiveStates[i], 'true']); + + //As default value we choose false, so we only have true or false and therefore we can filter more easily + return SqlUtils.translateStatementWithQuotes(SqlUtils.getResolvingCaseWhen(extendedStates, pDBFieldName, false)).replace("else '' end", "else 'false' end"); } function AdminViewUtils () {} @@ -763,7 +478,7 @@ AdminViewUtils.open = function (pUidField, pFields) else pUidField += " (UID)"; var rows = [ - [pUidField, pUidField, uid, "TEXT"] + [pUidField, pUidField, uid, "TEXT"] ]; if (pFields) { diff --git a/process/Order_lib/process.js b/process/Order_lib/process.js index 10c273583a..74651b5982 100644 --- a/process/Order_lib/process.js +++ b/process/Order_lib/process.js @@ -383,7 +383,7 @@ OrderUtils.buildOrderReport = function (pOrderID) "SUMITEMSUM" : sumItemSum, "TOTAL" : text.formatDouble(total, "#,##0.00", true), "printDiscount" : printDiscount ? "1" : "0", - "Person" : db.cell(ContextUtils.getNameSql(vars.get("$field.OBJECT_TYPE"), vars.get("$field.OBJECT_ROWID"))) + "Person" : ContextUtils.getTitleByContext(vars.get("$field.OBJECT_TYPE"), vars.get("$field.OBJECT_ROWID")) }; diff --git a/process/Util_lib/process.js b/process/Util_lib/process.js index b520401112..ca3962c923 100644 --- a/process/Util_lib/process.js +++ b/process/Util_lib/process.js @@ -363,6 +363,95 @@ Utils.objectValues = function (pObject) }); } + +/** + * builds/extends a filter-Object, can be used for e. g. entity.filter(), neon.setFilter, etc... + * Note: If a filter-Objects gets extended the new Filter will be added before the old one. + * @example + * It will look like this: + { + "filter":{ + "type":"group", -| + "operator":"AND", | + "childs":[ | + { | + "type":"row", |- New Condition + "name":"ACTIVE", | + "operator":"EQUAL", | + "value":"Ja", | + "key":"true", | + "contenttype":"TEXT" -| + }, + { + "type":"group", -| + "operator":"AND", | + "childs":[ | + { | + "type":"row", |- Old condition + "name":"DATE_NEW", | + "operator":"TIMEFRAME_EQUAL", | + "value":"Heute", | + "key":"REL=ADJUSTED;UNIT=DAY", | + "contenttype":"DATE" -| + } + ] + } + ] + } + } + * @param {Object} pFilterObj, the existing Filter-Object, for a new Obj use {} or null + * @param {String} pFieldName, all Fields which are filterable in that certain Entity + * @param {String} pOperator, Filteroperators, (look up "_getCondition"-Function in JditoFilter_lib for all available operator) + * @param {String} pContentType, the Contenttype of the Filter, ("TEXT",... etc) + * @param {String} pValue, this will be used as Value in the Frontend + * @param {String} pKey, this will be used as Value in the Backend + * @param {String} pParentOperator, "OR" or "AND" for the Group Operator, null = AND + * + * @return new/extended Filter-Object + */ +Utils.buildFilterObj = function(pFilterObj, pFieldName, pOperator, pContentType, pValue, pKey, pParentOperator) +{ + + if(pParentOperator && pParentOperator != "AND" && pParentOperator != "OR") + throw new Error(translate.text("Illegal Parent Operator in buildFilterObj-Function: "+pParentOperator)); + + + var subFilterObj = { + "type":"row", + "name":pFieldName, + "operator":pOperator, + "value": pValue, + "key": pKey, + "contenttype":pContentType + }; + + var parentFilter = { + "filter" : { + "type":"group", + "operator":pParentOperator, + "childs": [subFilterObj] + } + }; + + + if(pFilterObj && pFilterObj.filters && pFilterObj.filters.childs.length > 0) + { + + var push = true; + for(var i = 0; i < pFilterObj.filters.childs.length; i++) + { + if(JSON.stringify(pFilterObj.filters.childs[i]) == JSON.stringify(subFilterObj)) + push = false; + } + if(push) + { + parentFilter.filter.childs = parentFilter.filter.childs.concat([pFilterObj.filters]); + } + + } + return parentFilter; +} + /** * Class containing static utility functions for regular expression objects (RegExp) * Do not create an instance of this @@ -469,10 +558,10 @@ StringUtils.replaceAll = function(pPlainInputStr, pPlainSearchStr, pReplacement, */ StringUtils.concat = function(pSeparator, pElements) { - var res = pElements.filter(function(e){ - return e != null && e != ""; - }).join(pSeparator); - return res; + var res = pElements.filter(function(e){ + return e != null && e != ""; + }).join(pSeparator); + return res; }; /** @@ -514,18 +603,18 @@ StringUtils.pad36 = function(pValue) */ StringUtils.unescapeSlashes = function(pValue) { - // add another escaped slash if the string ends with an odd - // number of escaped slashes which will crash JSON.parse - let parsedStr = pValue.replace(/(^|[^\\])(\\\\)*\\$/, "$&\\"); - // escape " - parsedStr = parsedStr.replace(/"/, '\\"'); - try { - parsedStr = JSON.parse('"' + parsedStr + '"'); - } catch(e) { - logging.log(e); - return pValue; - } - return parsedStr ; + // add another escaped slash if the string ends with an odd + // number of escaped slashes which will crash JSON.parse + let parsedStr = pValue.replace(/(^|[^\\])(\\\\)*\\$/, "$&\\"); + // escape " + parsedStr = parsedStr.replace(/"/, '\\"'); + try { + parsedStr = JSON.parse('"' + parsedStr + '"'); + } catch(e) { + logging.log(e); + return pValue; + } + return parsedStr ; } /** @@ -1058,9 +1147,9 @@ NumberSequencingUtils.validateUniqueNumber = function(pNumber, pColumn, pTable, NumberSequencingUtils.getMaxUniqueNumber = function(pColumn, pTable, pCondition) { return newSelect(new SqlMaskingUtils().max(pColumn)) - .from(pTable) - .whereIfSet(pCondition) - .cell() || "0"; + .from(pTable) + .whereIfSet(pCondition) + .cell() || "0"; } /** @@ -1090,7 +1179,9 @@ TreeUtils.sortArrayForTree = function (pArray, pUidIndex, pParentIdIndex) var rows = {}; var allIds = {}; - pArray.forEach(function (row) {allIds[row[pUidIndex]] = true;}); + pArray.forEach(function (row) { + allIds[row[pUidIndex]] = true; + }); var index = 0; do { @@ -1104,7 +1195,7 @@ TreeUtils.sortArrayForTree = function (pArray, pUidIndex, pParentIdIndex) }; }, rows); - /* stop if no new items were added, otherwise incorrect data (for instance + /* stop if no new items were added, otherwise incorrect data (for instance an item that is it's own parent) could cause an infinite loop */ } while (oldIndex != index); var sortedArray = new Array(index); @@ -1158,7 +1249,7 @@ ConsecutiveCodeUtils.setCode = function(pId, pTable, pIdCol, pCodeCol) max = -1; newWhereIfSet(pTable + "." + pIdCol, pId) - .updateData(true, pTable, [pCodeCol], null, [parseInt(max)+1]); + .updateData(true, pTable, [pCodeCol], null, [parseInt(max)+1]); } function IdUtils() {} -- GitLab