diff --git a/entity/Attribute_entity/titleProcess.js b/entity/Attribute_entity/titleProcess.js index e55588aa4fb9dea4ee26b065951ab47b1ad43256..0eb44535e0b26ca7b387f2ba0cd5634f519ce0c1 100644 --- a/entity/Attribute_entity/titleProcess.js +++ b/entity/Attribute_entity/titleProcess.js @@ -1,4 +1,5 @@ +import("Context_lib"); import("system.vars"); import("system.result"); -result.string(vars.get("$field.FULL_ATTRIBUTE_NAME")); \ No newline at end of file +result.string(ContextUtils.prefixWithCurrentContextTitle(vars.get("$field.FULL_ATTRIBUTE_NAME"))); \ No newline at end of file diff --git a/entity/Contact_entity/Contact_entity.aod b/entity/Contact_entity/Contact_entity.aod index 47279e3e9047039685e03cb35436713de26e56ef..d70d8d0861ddb402b8eb3e22bedb8a9045f04bdf 100644 --- a/entity/Contact_entity/Contact_entity.aod +++ b/entity/Contact_entity/Contact_entity.aod @@ -2,6 +2,7 @@ <entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.2"> <name>Contact_entity</name> <title>Contact</title> + <description></description> <majorModelMode>DISTRIBUTED</majorModelMode> <documentation>%aditoprj%/entity/Contact_entity/documentation.adoc</documentation> <onValidation>%aditoprj%/entity/Contact_entity/onValidation.js</onValidation> @@ -27,7 +28,6 @@ <title>Company</title> <consumer>Organisations</consumer> <mandatory v="false" /> - <displayValueProcess>%aditoprj%/entity/Contact_entity/entityfields/organisation_id/displayValueProcess.js</displayValueProcess> <onValidation>%aditoprj%/entity/Contact_entity/entityfields/organisation_id/onValidation.js</onValidation> </entityField> <entityField> @@ -299,10 +299,6 @@ <name>DATE_EDIT.value</name> <recordfield>CONTACT.DATE_EDIT</recordfield> </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>ORGANISATION_ID.displayValue</name> - <recordfield>ORGANISATION.NAME</recordfield> - </dbRecordFieldMapping> </recordFieldMappings> </dbRecordContainer> </recordContainers> diff --git a/entity/Contact_entity/entityfields/organisation_id/displayValueProcess.js b/entity/Contact_entity/entityfields/organisation_id/displayValueProcess.js deleted file mode 100644 index 460b39849d5d34bac95e4b987d28a665b732e860..0000000000000000000000000000000000000000 --- a/entity/Contact_entity/entityfields/organisation_id/displayValueProcess.js +++ /dev/null @@ -1,9 +0,0 @@ -import("system.result"); -import("system.db"); -import("system.vars"); -import("Contact_lib"); - -var organisationId = vars.get("$field.ORGANISATION_ID"); -var res = OrganisationUtils.getNameByOrganisationId(organisationId); - -result.string(res); \ No newline at end of file diff --git a/entity/Contract_entity/titleProcess.js b/entity/Contract_entity/titleProcess.js index 46f60176775fe07563734ff5f62aa714afa71e45..3432c05f4a705f9e680c966699b8250a10f8fe53 100644 --- a/entity/Contract_entity/titleProcess.js +++ b/entity/Contract_entity/titleProcess.js @@ -1,4 +1,5 @@ +import("Context_lib"); import("system.vars"); import("system.result"); -result.string(vars.get("$field.CONTRACTCODE_DISPLAY_fieldGroup")); \ No newline at end of file +result.string(ContextUtils.prefixWithCurrentContextTitle(vars.get("$field.CONTRACTCODE_DISPLAY_fieldGroup"))); \ No newline at end of file diff --git a/entity/Countries_Entity/titleProcess.js b/entity/Countries_Entity/titleProcess.js index 6a1357835421f5c8fe5231388b03ee15dd29f58b..27c78a47f571add3d25469cb7eaa9b3662cb62b3 100644 --- a/entity/Countries_Entity/titleProcess.js +++ b/entity/Countries_Entity/titleProcess.js @@ -1,3 +1,4 @@ +import("Context_lib"); import("system.result"); import("system.vars"); -result.string(vars.get("$field.NAME_TRANSLATED")); \ No newline at end of file +result.string(ContextUtils.prefixWithCurrentContextTitle(vars.get("$field.NAME_TRANSLATED"))); \ No newline at end of file diff --git a/entity/Employee_entity/titleProcess.js b/entity/Employee_entity/titleProcess.js index cfe8dbda0147ed4ce85bc5394e118459edb315d1..2c946bc446bdc882880d688ae373ebdf8561a225 100644 --- a/entity/Employee_entity/titleProcess.js +++ b/entity/Employee_entity/titleProcess.js @@ -1,4 +1,5 @@ +import("Context_lib"); import("system.vars"); import("system.result"); -result.string((vars.get("$field.FIRSTNAME") + " " + vars.get("$field.LASTNAME")).trim()); \ No newline at end of file +result.string(ContextUtils.prefixWithCurrentContextTitle((vars.get("$field.FIRSTNAME") + " " + vars.get("$field.LASTNAME")).trim())); \ No newline at end of file diff --git a/entity/KeywordAttribute_entity/titleProcess.js b/entity/KeywordAttribute_entity/titleProcess.js index 28fd67de270b497ba718dd4e91766bd22936f67e..53fee4be6adf0706c04c01952405a9792b65feb5 100644 --- a/entity/KeywordAttribute_entity/titleProcess.js +++ b/entity/KeywordAttribute_entity/titleProcess.js @@ -1,4 +1,5 @@ +import("Context_lib"); import("system.vars"); import("system.result"); -result.string(vars.get("$field.NAME")); \ No newline at end of file +result.string(ContextUtils.prefixWithCurrentContextTitle(vars.get("$field.NAME"))); \ No newline at end of file diff --git a/entity/KeywordEntry_entity/titleProcess.js b/entity/KeywordEntry_entity/titleProcess.js index a907335e8d11cf3ec8c18651257f5ab8d96a29b9..3a9950b109a01757e0892bf8cbbd3c8205514385 100644 --- a/entity/KeywordEntry_entity/titleProcess.js +++ b/entity/KeywordEntry_entity/titleProcess.js @@ -1,4 +1,5 @@ +import("Context_lib"); import("system.vars"); import("system.result"); -result.string(vars.get("$field.TITLE_TRANSLATED")); \ No newline at end of file +result.string(ContextUtils.prefixWithCurrentContextTitle(vars.get("$field.TITLE_TRANSLATED"))); \ No newline at end of file diff --git a/entity/ObjectRelationType_entity/titleProcess.js b/entity/ObjectRelationType_entity/titleProcess.js index dbc0c500302fcbb7dfe706e35445f9f01952daa5..5f55a99abcb8803e2573f23cf9027f7da40370a6 100644 --- a/entity/ObjectRelationType_entity/titleProcess.js +++ b/entity/ObjectRelationType_entity/titleProcess.js @@ -1,12 +1,13 @@ +import("Context_lib"); import("system.translate"); import("system.vars"); import("system.result"); if (vars.exists("$param.OnlyFirstSide_param") && vars.get("$param.OnlyFirstSide_param") == "1" && vars.get("$field.DIRECTION") != "same") { - result.string(translate.text(vars.get("$field.SOURCE_RELATION_TITLE")) + " -> " + translate.text(vars.get("$field.DEST_RELATION_TITLE"))); + result.string(ContextUtils.prefixWithCurrentContextTitle(translate.text(vars.get("$field.SOURCE_RELATION_TITLE")) + " -> " + translate.text(vars.get("$field.DEST_RELATION_TITLE")))); } else { - result.string(translate.text(vars.get("$field.SOURCE_RELATION_TITLE"))); + result.string(ContextUtils.prefixWithCurrentContextTitle(translate.text(vars.get("$field.SOURCE_RELATION_TITLE")))); } \ No newline at end of file diff --git a/entity/Offer_entity/Offer_entity.aod b/entity/Offer_entity/Offer_entity.aod index 91ae54bf765710fac211ecd00690ecd194fcfd90..32bcd06f2db48d231004a1dd344f8ce5cc85144b 100644 --- a/entity/Offer_entity/Offer_entity.aod +++ b/entity/Offer_entity/Offer_entity.aod @@ -240,17 +240,6 @@ <element>VERSNR</element> </fields> </entityFieldGroup> - <entityFieldGroup> - <name>Offer_OfferCode_VersNr_fieldgroup</name> - <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/offer_offercode_versnr_fieldgroup/valueProcess.js</valueProcess> - <title>Offer number</title> - <description>"Offer " + OfferCode + VersNr</description> - <state>READONLY</state> - <fields> - <element>OFFERCODE</element> - <element>VERSNR</element> - </fields> - </entityFieldGroup> <entityParameter> <name>ContactId_param</name> <expose v="true" /> diff --git a/entity/Offer_entity/entityfields/offer_offercode_versnr_fieldgroup/valueProcess.js b/entity/Offer_entity/entityfields/offer_offercode_versnr_fieldgroup/valueProcess.js deleted file mode 100644 index 6b1c8c5befc8421b5acd2fb8a5a3265d71202e4c..0000000000000000000000000000000000000000 --- a/entity/Offer_entity/entityfields/offer_offercode_versnr_fieldgroup/valueProcess.js +++ /dev/null @@ -1,8 +0,0 @@ -import("system.translate"); -import("system.result"); -import("system.vars"); - -// TODO: Kern-Fix, VersNr wird bei indirektem Aufruf nicht geladen, wenn kein "$field.VERSNR" hier ist: -"$field.VERSNR" - -result.string(translate.text("Offer") + " " + vars.get("$field.OfferCode_VersNr_fieldgroup")); diff --git a/entity/Offer_entity/titleProcess.js b/entity/Offer_entity/titleProcess.js index b5301f43f0d44e22f8ee928719b999098e446a51..7baf0cfba8e76a9744e1b9a3253f7f4f8ee97e86 100644 --- a/entity/Offer_entity/titleProcess.js +++ b/entity/Offer_entity/titleProcess.js @@ -1,4 +1,5 @@ +import("Context_lib"); import("system.vars"); import("system.result"); -result.string(vars.get("$field.Offer_OfferCode_VersNr_fieldgroup")); \ No newline at end of file +result.string(ContextUtils.prefixWithCurrentContextTitle(vars.get("$field.OfferCode_VersNr_fieldgroup"))); \ No newline at end of file diff --git a/entity/Order_entity/Order_entity.aod b/entity/Order_entity/Order_entity.aod index 0afa28adacc332d4fabaca6ccb890838a0b1cd89..5276e8dd948989609f2ee8a23c7aedc95013c5ed 100644 --- a/entity/Order_entity/Order_entity.aod +++ b/entity/Order_entity/Order_entity.aod @@ -203,17 +203,6 @@ <element>VERSNR</element> </fields> </entityFieldGroup> - <entityFieldGroup> - <name>Order_OrderCode_VersNr_fieldgroup</name> - <valueProcess>%aditoprj%/entity/Order_entity/entityfields/order_ordercode_versnr_fieldgroup/valueProcess.js</valueProcess> - <title>Receipt number</title> - <description>"Receipt " + ReceiptCode + VersNr</description> - <state>READONLY</state> - <fields> - <element>SALESORDERCODE</element> - <element>VERSNR</element> - </fields> - </entityFieldGroup> <entityParameter> <name>ContactId_param</name> <expose v="true" /> diff --git a/entity/Order_entity/entityfields/order_ordercode_versnr_fieldgroup/valueProcess.js b/entity/Order_entity/entityfields/order_ordercode_versnr_fieldgroup/valueProcess.js deleted file mode 100644 index 777196873cb611d0ad72ee486c0ff35c964a3da8..0000000000000000000000000000000000000000 --- a/entity/Order_entity/entityfields/order_ordercode_versnr_fieldgroup/valueProcess.js +++ /dev/null @@ -1,8 +0,0 @@ -import("system.translate"); -import("system.result"); -import("system.vars"); - -// TODO: Kern-Fix, VersNr wird bei indirektem Aufruf nicht geladen, wenn kein "$field.VERSNR" hier ist: -"$field.VERSNR" - -result.string(translate.text("Order") + " " + vars.get("$field.OrderCode_VersNr_fieldgroup")); diff --git a/entity/Order_entity/titleProcess.js b/entity/Order_entity/titleProcess.js index f9b8aea4a9a3b5f300dde8fc9cbf5863a59ec3e5..37977fc62e9742a3d34b3cea24de1cbabe06cfa1 100644 --- a/entity/Order_entity/titleProcess.js +++ b/entity/Order_entity/titleProcess.js @@ -1,5 +1,6 @@ +import("Context_lib"); import("system.translate"); import("system.vars"); import("system.result"); -result.string(translate.text("Receipt") + " " + vars.get("$field.OrderCode_VersNr_fieldgroup")); +result.string(ContextUtils.prefixWithCurrentContextTitle(vars.get("$field.OrderCode_VersNr_fieldgroup"))); diff --git a/entity/Organisation_entity/titleProcess.js b/entity/Organisation_entity/titleProcess.js index dffd0bd73b994f31efe37f60430ab35fe4150c02..5f2cd996da8492d6c6ce7a7df50a7a14e47c5796 100644 --- a/entity/Organisation_entity/titleProcess.js +++ b/entity/Organisation_entity/titleProcess.js @@ -1,4 +1,5 @@ +import("Context_lib"); import("system.vars"); import("system.result"); -result.string(vars.get("$field.NAME")) \ No newline at end of file +result.string(ContextUtils.prefixWithCurrentContextTitle(vars.get("$field.NAME"))) \ No newline at end of file diff --git a/entity/Person_entity/titleProcess.js b/entity/Person_entity/titleProcess.js index abaa3df1566528e8dc3e5aad91ac26ab26fe5418..5f2140b1f8870c878bfc8b06a633618471df0aa5 100644 --- a/entity/Person_entity/titleProcess.js +++ b/entity/Person_entity/titleProcess.js @@ -1,3 +1,4 @@ +import("Context_lib"); import("system.vars"); import("system.result"); import("Util_lib"); @@ -13,4 +14,4 @@ contact.lastname = vars.get("$field.LASTNAME"); contact.organisationName = vars.get("$field.ORGANISATION_NAME"); var renderer = new ContactTitleRenderer(contact, null); -result.string(renderer.asString()); \ No newline at end of file +result.string(ContextUtils.prefixWithCurrentContextTitle(renderer.asString())); \ No newline at end of file diff --git a/entity/Product_entity/titleProcess.js b/entity/Product_entity/titleProcess.js index 4f684f8c2a25b7c72fb953b045428c87e7271751..1df7a714a4dde816d9dded4520659233e3282e80 100644 --- a/entity/Product_entity/titleProcess.js +++ b/entity/Product_entity/titleProcess.js @@ -1,4 +1,5 @@ +import("Context_lib"); import("system.vars"); import("system.result"); -result.string(vars.get("$field.PRODUCTNAME")); \ No newline at end of file +result.string(ContextUtils.prefixWithCurrentContextTitle(vars.get("$field.PRODUCTNAME"))); \ No newline at end of file diff --git a/entity/SalesprojectMilestone_entity/titleProcess.js b/entity/SalesprojectMilestone_entity/titleProcess.js index 658e8105ef136f6e374f80363f1c1d0ace5fba7e..a5a099447859455db9fc077639edf59dc58e2105 100644 --- a/entity/SalesprojectMilestone_entity/titleProcess.js +++ b/entity/SalesprojectMilestone_entity/titleProcess.js @@ -1,10 +1,11 @@ +import("Context_lib"); import("system.vars"); import("system.translate"); import("system.result"); if (vars.exists("$field.TYPE") && vars.get("$field.TYPE")) { - result.string(translate.text("Milestones") + " " + translate.text(vars.get("$field.TYPE"))); + result.string(ContextUtils.prefixWithCurrentContextTitle(translate.text("Milestones") + " " + translate.text(vars.get("$field.TYPE")))); } else - result.string(translate.text("Milestones")); \ No newline at end of file + result.string(ContextUtils.prefixWithCurrentContextTitle(translate.text("Milestones"))); \ No newline at end of file diff --git a/entity/Salesproject_entity/titleProcess.js b/entity/Salesproject_entity/titleProcess.js index 96a0a030e216f22364464faa38814240f086e885..bcc2474490ec5415d723b0620ebb1458081b6b17 100644 --- a/entity/Salesproject_entity/titleProcess.js +++ b/entity/Salesproject_entity/titleProcess.js @@ -1,4 +1,5 @@ +import("Context_lib"); import("system.vars"); import("system.result"); -result.string(vars.get("$field.PROJECTTITLE")); \ No newline at end of file +result.string(ContextUtils.prefixWithCurrentContextTitle(vars.get("$field.PROJECTTITLE"))); \ No newline at end of file diff --git a/neonView/OfferPreview_view/OfferPreview_view.aod b/neonView/OfferPreview_view/OfferPreview_view.aod index 9b73e6cfe911f0906c5aed7bc0eb83f034975aca..a28c644d44eab76093e06b9f42354d5dfc181606 100644 --- a/neonView/OfferPreview_view/OfferPreview_view.aod +++ b/neonView/OfferPreview_view/OfferPreview_view.aod @@ -12,7 +12,7 @@ <cardViewTemplate> <name>Header</name> <iconField>IMAGE</iconField> - <titleField>Offer_OfferCode_VersNr_fieldgroup</titleField> + <titleField>OfferCode_VersNr_fieldgroup</titleField> <descriptionField>CONTACT_ID</descriptionField> <favoriteAction1>newActivity</favoriteAction1> <entityField>#ENTITY</entityField> diff --git a/neonView/OrderPreview_view/OrderPreview_view.aod b/neonView/OrderPreview_view/OrderPreview_view.aod index d9aa97ac59cc3bec65c625d8cc72bcb3fa7f37dd..224df4dc3dffd9d2668c7e5453be2c7dfb69507e 100644 --- a/neonView/OrderPreview_view/OrderPreview_view.aod +++ b/neonView/OrderPreview_view/OrderPreview_view.aod @@ -12,7 +12,7 @@ <cardViewTemplate> <name>Header</name> <iconField>IMAGE</iconField> - <titleField>Order_OrderCode_VersNr_fieldgroup</titleField> + <titleField>OrderCode_VersNr_fieldgroup</titleField> <descriptionField>CONTACT_ID</descriptionField> <favoriteAction1>newActivity</favoriteAction1> <entityField>#ENTITY</entityField> diff --git a/process/Context_lib/process.js b/process/Context_lib/process.js index ee1242dde2f44628e793fdf78919a49c5a1b9e69..e8fd86b075a729a1c54c3ccc32625025e2e07f8d 100644 --- a/process/Context_lib/process.js +++ b/process/Context_lib/process.js @@ -26,6 +26,21 @@ ContextUtils.getCurrentContextId = function() return vars.getString("$sys.currentcontextname"); } +/** + * Get the title of the current context + * Note: The variable contexttitle is not always available. + * In this case this function returns "" + * + * @return {String} Title of the current context + */ +ContextUtils.getCurrentContextTitle = function() +{ + if (vars.exists("$sys.currentcontexttitle") && vars.get("$sys.currentcontexttitle")) + return vars.get("$sys.currentcontexttitle"); + + return ""; +} + /** * TODO: use System function. Currently the Name is also the id. * Returns the Name of a context by the Id @@ -100,6 +115,21 @@ ContextUtils.getContext = function(pContextId) return ContextUtils._contextDataMapping(project.getDataModel(project.DATAMODEL_KIND_CONTEXT, pContextId)); } +/** + * Prefix the given title with the current context title. (only if the title is available) + * @param {String} pTitle + * + * @return {String} e.g.: Kontakt - Herr Tim Admin + */ +ContextUtils.prefixWithCurrentContextTitle = function(pTitle) +{ + var titlePrefix = ContextUtils.getCurrentContextTitle(); + if (titlePrefix) + return titlePrefix + " - " + pTitle; + + return pTitle; +} + /** * map the contextData from the system.project-lib to [contextId, contextName, contextTitle] *