From 8132ae195fe9dfb87f2c444ff82033bc985a5ce2 Mon Sep 17 00:00:00 2001 From: "j.goderbauer" <j.goderbauer@adito.de> Date: Wed, 8 May 2019 13:30:49 +0200 Subject: [PATCH] Loghistory: preview --- .../LogHistory_entity/LogHistory_entity.aod | 4 +- .../recordcontainers/jdito/contentProcess.js | 38 +++-- neonContext/LogHistory/LogHistory.aod | 5 + .../AppointmentPreview_view.aod | 67 ++++---- .../LogHistoryPreview_view.aod | 30 ++++ .../PersonPreview_view/PersonPreview_view.aod | 150 +++++++++--------- process/Loghistory_lib/process.js | 6 +- 7 files changed, 165 insertions(+), 135 deletions(-) create mode 100644 neonView/LogHistoryPreview_view/LogHistoryPreview_view.aod diff --git a/entity/LogHistory_entity/LogHistory_entity.aod b/entity/LogHistory_entity/LogHistory_entity.aod index 74b2488650f..30cec857a2e 100644 --- a/entity/LogHistory_entity/LogHistory_entity.aod +++ b/entity/LogHistory_entity/LogHistory_entity.aod @@ -2,7 +2,7 @@ <entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.4" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.4"> <name>LogHistory_entity</name> <majorModelMode>DISTRIBUTED</majorModelMode> - <title>LogHistory</title> + <title>Log</title> <iconId>NEON:HISTORY</iconId> <imageProcess>%aditoprj%/entity/LogHistory_entity/imageProcess.js</imageProcess> <titlePlural>Logs</titlePlural> @@ -29,7 +29,7 @@ <entityField> <name>DESCRIPTION</name> <title>Description</title> - <contentType>TEXT</contentType> + <contentType>LONG_TEXT</contentType> <mandatory v="true" /> </entityField> <entityProvider> diff --git a/entity/LogHistory_entity/recordcontainers/jdito/contentProcess.js b/entity/LogHistory_entity/recordcontainers/jdito/contentProcess.js index 089be1779e5..8c430b5b8c7 100644 --- a/entity/LogHistory_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/LogHistory_entity/recordcontainers/jdito/contentProcess.js @@ -1,3 +1,4 @@ +import("system.eMath"); import("Util_lib"); import("system.datetime"); import("system.result"); @@ -10,26 +11,32 @@ import("system.db"); var recordCond = SqlCondition.begin(); -//condition for only one/some selected records (maybe needed later for preview, etc.) -//since this a unique ID it's perfectly fine to filter only for the IDs and ignore other filters -if (vars.exists("$local.idvalues") && vars.get("$local.idvalues")) +//condition for only one/some selected records +//since this NOT (!) a unique ID we need to filter with all the other filters (via params) too +if (vars.exists("$local.idvalues")) { - recordCond.and(" AB_LOGHISTORY.AB_LOGHISTORYID in ('" + vars.get("$local.idvalues").join("','") + "')"); -} -else -{ - //condition for restricting the loghistory to some specific tables (e.g. only contact-related tables) and a specific ID - var tableNameCond = _getTableNameCondition(); - recordCond.andSqlCondition(tableNameCond); - - //user defined filter - if (vars.exists("$local.filter") && vars.get("$local.filter")) + var semiId = vars.get("$local.idvalues");//this not really an ID, it's an object that contain the grouped content fields + if (semiId) { - var filter = vars.get("$local.filter"); - recordCond.andSqlCondition((JditoFilterUtils.getSqlCondition(filter, "AB_LOGHISTORY"))); + var groupingInfo = JSON.parse(semiId); + recordCond.andPrepare("AB_LOGHISTORY.USER_NEW", groupingInfo.u); + var dateFilterValue = datetime.toLong(groupingInfo.d, "yyyy-MM-dd HH:mm"); + recordCond.andPrepare("AB_LOGHISTORY.DATE_NEW", dateFilterValue, "# >= ?"); + recordCond.andPrepare("AB_LOGHISTORY.DATE_NEW", eMath.addInt(dateFilterValue, datetime.ONE_MINUTE), "# < ?"); } } +//condition for restricting the loghistory to some specific tables (e.g. only contact-related tables) and a specific ID +var tableNameCond = _getTableNameCondition(); +recordCond.andSqlCondition(tableNameCond); + +//user defined filter +if (vars.exists("$local.filter") && vars.get("$local.filter")) +{ + var filter = vars.get("$local.filter"); + recordCond.andSqlCondition((JditoFilterUtils.getSqlCondition(filter, "AB_LOGHISTORY"))); +} + var dataQuery = recordCond.buildSql("select AB_LOGHISTORY.DATE_NEW, AB_LOGHISTORY.USER_NEW, AB_LOGHISTORY.DESCRIPTION \n\ from AB_LOGHISTORY ", "1 = 2", "order by DATE_NEW desc, USER_NEW asc"); @@ -44,6 +51,7 @@ result.object(resultData); function _makeGroupingIdentifier(pDatetime, pUser) { //no need to translate the datepattern since this is only used for internal checks and is never displayed to the user + //since this is also [part of] the ID keep it very short return JSON.stringify({d: datetime.toDate(pDatetime, "yyyy-MM-dd HH:mm"), u: pUser}); } diff --git a/neonContext/LogHistory/LogHistory.aod b/neonContext/LogHistory/LogHistory.aod index c7adae89f77..179d44bff14 100644 --- a/neonContext/LogHistory/LogHistory.aod +++ b/neonContext/LogHistory/LogHistory.aod @@ -4,11 +4,16 @@ <title>LogHistory</title> <majorModelMode>DISTRIBUTED</majorModelMode> <filterview>LogHistoryFilter_view</filterview> + <preview>LogHistoryPreview_view</preview> <entity>LogHistory_entity</entity> <references> <neonViewReference> <name>76df2f61-4176-4648-81c7-33da90b76967</name> <view>LogHistoryFilter_view</view> </neonViewReference> + <neonViewReference> + <name>32181ad2-2766-4d52-a04b-4b74bcbd2453</name> + <view>LogHistoryPreview_view</view> + </neonViewReference> </references> </neonContext> diff --git a/neonView/AppointmentPreview_view/AppointmentPreview_view.aod b/neonView/AppointmentPreview_view/AppointmentPreview_view.aod index 11cbc98b67e..be8a19a301f 100644 --- a/neonView/AppointmentPreview_view/AppointmentPreview_view.aod +++ b/neonView/AppointmentPreview_view/AppointmentPreview_view.aod @@ -1,36 +1,31 @@ -<?xml version="1.0" encoding="UTF-8"?> -<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.1"> - <name>AppointmentPreview_view</name> - <majorModelMode>DISTRIBUTED</majorModelMode> - <documentation>%aditoprj%/neonView/AppointmentPreview_view/documentation.adoc</documentation> - <layout> - <headerFooterLayout> - <name>layout</name> - </headerFooterLayout> - </layout> - <children> - <appointmentPreviewViewTemplate> - <name>Appointments</name> - <summaryField>SUMMARY</summaryField> - <descriptionField>DESCRIPTION</descriptionField> - <beginField>BEGIN</beginField> - <endField>END</endField> - <periodField>STARTEND</periodField> - <attendeesField>ATTENDEES</attendeesField> - <privateField>CLASSIFICATION</privateField> - <transparencyField>TRANSPARENCY</transparencyField> - <statusField>STATUS</statusField> - <locationField>LOCATION</locationField> - <linkField>LINKS</linkField> - <organizerField>ORGANIZER</organizerField> - <categoriesField>CATEGORIES</categoriesField> - <favoriteActionGroup1>PartStatActionGroup</favoriteActionGroup1> - <entityField>#ENTITY</entityField> - </appointmentPreviewViewTemplate> - <neonViewReference> - <name>be0befe0-4b29-4c23-924a-0167240d2b54</name> - <entityField>AppointmentLinks</entityField> - <view>AppointmentLinkFilter_view</view> - </neonViewReference> - </children> -</neonView> +<?xml version="1.0" encoding="UTF-8"?> +<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.1"> + <name>AppointmentPreview_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <documentation>%aditoprj%/neonView/AppointmentPreview_view/documentation.adoc</documentation> + <layout> + <headerFooterLayout> + <name>layout</name> + </headerFooterLayout> + </layout> + <children> + <appointmentPreviewViewTemplate> + <name>Appointments</name> + <summaryField>SUMMARY</summaryField> + <descriptionField>DESCRIPTION</descriptionField> + <beginField>BEGIN</beginField> + <endField>END</endField> + <periodField>STARTEND</periodField> + <attendeesField>ATTENDEES</attendeesField> + <privateField>CLASSIFICATION</privateField> + <transparencyField>TRANSPARENCY</transparencyField> + <statusField>STATUS</statusField> + <locationField>LOCATION</locationField> + <linkField>LINKS</linkField> + <organizerField>ORGANIZER</organizerField> + <categoriesField>CATEGORIES</categoriesField> + <favoriteActionGroup1>PartStatActionGroup</favoriteActionGroup1> + <entityField>#ENTITY</entityField> + </appointmentPreviewViewTemplate> + </children> +</neonView> diff --git a/neonView/LogHistoryPreview_view/LogHistoryPreview_view.aod b/neonView/LogHistoryPreview_view/LogHistoryPreview_view.aod new file mode 100644 index 00000000000..46ea9f080df --- /dev/null +++ b/neonView/LogHistoryPreview_view/LogHistoryPreview_view.aod @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.1"> + <name>LogHistoryPreview_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <headerFooterLayout> + <name>layout</name> + <header>head</header> + </headerFooterLayout> + </layout> + <children> + <cardViewTemplate> + <name>head</name> + <subtitleField>DATE_NEW</subtitleField> + <descriptionField>USER_NEW</descriptionField> + <entityField>#ENTITY</entityField> + </cardViewTemplate> + <genericViewTemplate> + <name>text</name> + <hideLabels v="true" /> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>f8d426d2-6e87-4c8c-90c1-8af65b24a90f</name> + <entityField>DESCRIPTION</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + </children> +</neonView> diff --git a/neonView/PersonPreview_view/PersonPreview_view.aod b/neonView/PersonPreview_view/PersonPreview_view.aod index f9852db57f5..eff1b886601 100644 --- a/neonView/PersonPreview_view/PersonPreview_view.aod +++ b/neonView/PersonPreview_view/PersonPreview_view.aod @@ -1,79 +1,71 @@ -<?xml version="1.0" encoding="UTF-8"?> -<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.1"> - <name>PersonPreview_view</name> - <majorModelMode>DISTRIBUTED</majorModelMode> - <layout> - <headerFooterLayout> - <name>layout</name> - <header>Header</header> - </headerFooterLayout> - </layout> - <children> - <cardViewTemplate> - <name>Header</name> - <iconField>PICTURE</iconField> - <titleField>FULL_NAME_fieldGroup</titleField> - <descriptionField>ORGANISATION_ID</descriptionField> - <favoriteAction1>newActivity</favoriteAction1> - <entityField>#ENTITY</entityField> - </cardViewTemplate> - <neonViewReference> - <name>5a1b7683-2fec-4763-9b45-e4c7a18d70fd</name> - <entityField>Communications</entityField> - <view>CommunicationList_view</view> - </neonViewReference> - <neonViewReference> - <name>4c4b1e66-fdc2-469c-a553-244b6dbffbe0</name> - <entityField>PersAddresses</entityField> - <view>AddressList_view</view> - </neonViewReference> - <neonViewReference> - <name>38bd1cc7-8b75-4755-8bb2-0177f02bbef5</name> - <entityField>OrgAddresses</entityField> - <view>AddressList_view</view> - </neonViewReference> - <genericViewTemplate> - <name>Info</name> - <showDrawer v="true" /> - <entityField>#ENTITY</entityField> - <fields> - <entityFieldLink> - <name>b1fae414-9818-48ff-8774-c310caf34d79</name> - <entityField>SALUTATION</entityField> - </entityFieldLink> - <entityFieldLink> - <name>c12f22ff-3536-45b6-b26f-1d8de6b5aea0</name> - <entityField>TITLE</entityField> - </entityFieldLink> - <entityFieldLink> - <name>f9875d78-3d72-47d3-b729-9cf80d236f6e</name> - <entityField>GENDER</entityField> - </entityFieldLink> - <entityFieldLink> - <name>5d4e0828-b7fe-4f54-a47a-f9b5838fb1ae</name> - <entityField>DATEOFBIRTH</entityField> - </entityFieldLink> - <entityFieldLink> - <name>3aa3e89b-91ce-4607-8d76-53ee309a688f</name> - <entityField>LANGUAGE</entityField> - </entityFieldLink> - <entityFieldLink> - <name>278c4e64-6f0f-4ea9-b683-75f272a6c088</name> - <entityField>STATUS</entityField> - </entityFieldLink> - <entityFieldLink> - <name>8ca0067d-4bfa-45b6-89e8-5c58c4e0d6ec</name> - <entityField>DEPARTMENT</entityField> - </entityFieldLink> - <entityFieldLink> - <name>99904332-fa07-411f-b9e8-7d0ae6918aa6</name> - <entityField>CONTACTROLE</entityField> - </entityFieldLink> - <entityFieldLink> - <name>d5cc98c9-9483-4c2d-b0f3-69e25a0474f3</name> - <entityField>POSITION</entityField> - </entityFieldLink> - </fields> - </genericViewTemplate> - </children> -</neonView> +<?xml version="1.0" encoding="UTF-8"?> +<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.1"> + <name>PersonPreview_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <headerFooterLayout> + <name>layout</name> + <header>Header</header> + </headerFooterLayout> + </layout> + <children> + <cardViewTemplate> + <name>Header</name> + <iconField>PICTURE</iconField> + <titleField>FULL_NAME_fieldGroup</titleField> + <descriptionField>ORGANISATION_ID</descriptionField> + <favoriteAction1>newActivity</favoriteAction1> + <entityField>#ENTITY</entityField> + </cardViewTemplate> + <neonViewReference> + <name>5a1b7683-2fec-4763-9b45-e4c7a18d70fd</name> + <entityField>Communications</entityField> + <view>CommunicationList_view</view> + </neonViewReference> + <neonViewReference> + <name>4c4b1e66-fdc2-469c-a553-244b6dbffbe0</name> + <entityField>PersAddresses</entityField> + <view>AddressList_view</view> + </neonViewReference> + <neonViewReference> + <name>38bd1cc7-8b75-4755-8bb2-0177f02bbef5</name> + <entityField>OrgAddresses</entityField> + <view>AddressList_view</view> + </neonViewReference> + <genericViewTemplate> + <name>Info</name> + <showDrawer v="true" /> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>f9875d78-3d72-47d3-b729-9cf80d236f6e</name> + <entityField>GENDER</entityField> + </entityFieldLink> + <entityFieldLink> + <name>5d4e0828-b7fe-4f54-a47a-f9b5838fb1ae</name> + <entityField>DATEOFBIRTH</entityField> + </entityFieldLink> + <entityFieldLink> + <name>3aa3e89b-91ce-4607-8d76-53ee309a688f</name> + <entityField>LANGUAGE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>278c4e64-6f0f-4ea9-b683-75f272a6c088</name> + <entityField>STATUS</entityField> + </entityFieldLink> + <entityFieldLink> + <name>8ca0067d-4bfa-45b6-89e8-5c58c4e0d6ec</name> + <entityField>DEPARTMENT</entityField> + </entityFieldLink> + <entityFieldLink> + <name>99904332-fa07-411f-b9e8-7d0ae6918aa6</name> + <entityField>CONTACTROLE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>d5cc98c9-9483-4c2d-b0f3-69e25a0474f3</name> + <entityField>POSITION</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + </children> +</neonView> diff --git a/process/Loghistory_lib/process.js b/process/Loghistory_lib/process.js index 064b315df60..82dd062bfb1 100644 --- a/process/Loghistory_lib/process.js +++ b/process/Loghistory_lib/process.js @@ -201,9 +201,9 @@ LogHistoryExecutor.prototype.execute = function () if (description.length > 0) { - if (this.sqlAction == 'I') description = translate.withArguments("%0 added.", [description.join(", ")], this.translationLanguage); - else if (this.sqlAction == 'U') description = translate.withArguments("%0 modified.", [description.join(", ")], this.translationLanguage); - else if (this.sqlAction == 'D') description = translate.withArguments("%0 deleted.", [description.join(", ")], this.translationLanguage); + if (this.sqlAction == 'I') description = translate.withArguments("%0 added.", [description.join(",\n")], this.translationLanguage); + else if (this.sqlAction == 'U') description = translate.withArguments("%0 modified.", [description.join(",\n")], this.translationLanguage); + else if (this.sqlAction == 'D') description = translate.withArguments("%0 deleted.", [description.join(",\n")], this.translationLanguage); for (index in references) { if (references[index].id != "") -- GitLab