From 82e81acfb4f59f56e3f41f199171b0a616fd2527 Mon Sep 17 00:00:00 2001 From: "a.schindlbeck" <a.schindlbeck@adito.de> Date: Thu, 27 Jun 2019 11:46:42 +0200 Subject: [PATCH] =?UTF-8?q?#1039171=20Verkn=C3=BCpfte=20Termine=20als=20Da?= =?UTF-8?q?shlet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Appointment_entity/Appointment_entity.aod | 4 ++ .../recordcontainers/jdito/contentProcess.js | 38 ++++++++---- .../linkedobjectid_param/valueProcess.js | 2 +- .../_____LANGUAGE_EXTRA.aod | 3 + .../_____LANGUAGE_de/_____LANGUAGE_de.aod | 1 + .../_____LANGUAGE_en/_____LANGUAGE_en.aod | 3 + neonContext/Appointment/Appointment.aod | 4 ++ .../AppointmentFilterDashlet_view.aod | 59 +++++++++++++++++++ process/Sql_lib/process.js | 7 +++ 9 files changed, 109 insertions(+), 12 deletions(-) create mode 100644 neonView/AppointmentFilterDashlet_view/AppointmentFilterDashlet_view.aod diff --git a/entity/Appointment_entity/Appointment_entity.aod b/entity/Appointment_entity/Appointment_entity.aod index 7bd09fc91b..4805824fc4 100644 --- a/entity/Appointment_entity/Appointment_entity.aod +++ b/entity/Appointment_entity/Appointment_entity.aod @@ -213,6 +213,10 @@ </entityDependency> </dependencies> </entityProvider> + <entityParameter> + <name>LinkedAppointmentsFromDashlet_param</name> + <expose v="true" /> + </entityParameter> </entityFields> <recordContainers> <jDitoRecordContainer> diff --git a/entity/Appointment_entity/recordcontainers/jdito/contentProcess.js b/entity/Appointment_entity/recordcontainers/jdito/contentProcess.js index 4e8aac3eba..23649935d1 100644 --- a/entity/Appointment_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/Appointment_entity/recordcontainers/jdito/contentProcess.js @@ -1,3 +1,4 @@ +import("system.tools"); import("system.logging"); import("system.db"); import("Sql_lib"); @@ -10,31 +11,36 @@ import("system.util"); import("system.neon"); import("system.entities") + +var cond = SqlCondition.begin(); + if(vars.get("$local.idvalues") != null && vars.get("$local.idvalues") != "") { var selectedids = vars.get("$local.idvalues"); result.object([buildEntry(calendars.getEntry(selectedids, null, null), null)]); } +else if(vars.getString("$param.LinkedAppointmentsFromDashlet_param")) +{ + var contactid = tools.getCurrentUser()["params"]["contactID"]; + + cond.andPrepareValue("AB_APPOINTMENTLINK.OBJECT_ROWID", contactid) + var idscond = db.translateCondition(cond.build("1 = 1")); + + var appointmentUids = db.table("select APPOINTMENT_ID from AB_APPOINTMENTLINK where " + idscond); + result.object(buildEntriesFromUids(appointmentUids)); +} + /** * Will be triggert if a module needs AppointmentFilter_view */ else if(vars.getString("$param.LinkedObjectId_param") != undefined) { - var cond = SqlCondition - .begin() - .andPrepareVars("AB_APPOINTMENTLINK.OBJECT_ROWID", "$param.LinkedObjectId_param") + cond.andPrepareVars("AB_APPOINTMENTLINK.OBJECT_ROWID", "$param.LinkedObjectId_param") var idscond = db.translateCondition(cond.build("1 = 1")); var appointmentUids = db.table("select APPOINTMENT_ID from AB_APPOINTMENTLINK where " + idscond); - - var entryArray = new Array(appointmentUids.length); - - for(var i = 0; i < appointmentUids.length; i++) - { - entryArray[i] = buildEntry(calendars.getEntry(appointmentUids[i], null, null), null); - } - result.object(entryArray); + result.object(buildEntriesFromUids(appointmentUids)); } /** * Will be used, if the user is operating the calendar. @@ -54,6 +60,16 @@ else if(vars.exists("$param.Entry_param") && vars.get("$param.Entry_param")) ]); } +function buildEntriesFromUids(appointmentUids) +{ + var entryArray = new Array(appointmentUids.length); + + for(var i = 0; i < appointmentUids.length; i++) + entryArray[i] = buildEntry(calendars.getEntry(appointmentUids[i], null, null), null); + + return entryArray; +} + function buildEntry(pEntry, pMasterentry) { diff --git a/entity/Person_entity/entityfields/appointments/children/linkedobjectid_param/valueProcess.js b/entity/Person_entity/entityfields/appointments/children/linkedobjectid_param/valueProcess.js index b08d2d5cae..18cdb55d5f 100644 --- a/entity/Person_entity/entityfields/appointments/children/linkedobjectid_param/valueProcess.js +++ b/entity/Person_entity/entityfields/appointments/children/linkedobjectid_param/valueProcess.js @@ -2,4 +2,4 @@ import("system.result"); import("system.vars"); -result.string(vars.get("$field.PERSONID")); \ No newline at end of file +result.string(vars.get("$field.CONTACTID")); \ No newline at end of file diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod index a8c3c421bd..6f39fc39c2 100644 --- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod +++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod @@ -4434,6 +4434,9 @@ <entry> <key>Linked Appointments</key> </entry> + <entry> + <key>Location</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> <sqlModels> diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod index 2b0b8d4c42..1c51ddec69 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -3761,6 +3761,7 @@ </entry> <entry> <key>Calendar</key> + <value>Kalender</value> </entry> <entry> <key>${SQL_LIB_UNDEFINED_VALUE} field: %0</key> diff --git a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod index fe2f84a688..92f7a1352a 100644 --- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod +++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod @@ -4483,6 +4483,9 @@ <entry> <key>Linked Appointments</key> </entry> + <entry> + <key>Location</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> </language> diff --git a/neonContext/Appointment/Appointment.aod b/neonContext/Appointment/Appointment.aod index 88ff16a854..67da92ae2f 100644 --- a/neonContext/Appointment/Appointment.aod +++ b/neonContext/Appointment/Appointment.aod @@ -23,5 +23,9 @@ <name>2a5e05b2-3f12-43b4-a3f4-3c31dbe0dace</name> <view>AppointmentFilter_view</view> </neonViewReference> + <neonViewReference> + <name>de97b676-6504-4edc-96ba-77ff8483a3a0</name> + <view>AppointmentFilterDashlet_view</view> + </neonViewReference> </references> </neonContext> diff --git a/neonView/AppointmentFilterDashlet_view/AppointmentFilterDashlet_view.aod b/neonView/AppointmentFilterDashlet_view/AppointmentFilterDashlet_view.aod new file mode 100644 index 0000000000..6ce3ce63a5 --- /dev/null +++ b/neonView/AppointmentFilterDashlet_view/AppointmentFilterDashlet_view.aod @@ -0,0 +1,59 @@ +<?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>AppointmentFilterDashlet_view</name> + <title>Linked Appointments</title> + <majorModelMode>DISTRIBUTED</majorModelMode> + <filterable v="false" /> + <dashletConfigurations> + <neonDashletConfiguration> + <name>appointmentFilterConfig</name> + <title>Linked Appointments</title> + <fragment>Appointment/full</fragment> + <icon>VAADIN:CALENDAR</icon> + <categories> + <neonDashletCategory> + <name>Calendar</name> + <title>Calendar</title> + </neonDashletCategory> + </categories> + <parameters> + <neonDashletParameter> + <name>LinkedAppointmentsFromDashlet_param</name> + <value>true</value> + </neonDashletParameter> + </parameters> + </neonDashletConfiguration> + </dashletConfigurations> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <tableViewTemplate> + <name>Table</name> + <autoNewRow v="false" /> + <entityField>#ENTITY</entityField> + <isEditable v="false" /> + <isDeletable v="false" /> + <columns> + <neonTableColumn> + <name>0aa3d147-674f-4765-826e-f97a4b48dc8a</name> + <entityField>SUMMARY</entityField> + </neonTableColumn> + <neonTableColumn> + <name>87170445-d63e-449b-9568-a055d5ed8afd</name> + <entityField>BEGIN</entityField> + </neonTableColumn> + <neonTableColumn> + <name>2284bbe2-dab7-45ce-9ced-8227802c3e92</name> + <entityField>END</entityField> + </neonTableColumn> + <neonTableColumn> + <name>43f7ef8a-19da-4ed6-afd3-2cfb825ab5b8</name> + <entityField>LOCATION</entityField> + </neonTableColumn> + </columns> + </tableViewTemplate> + </children> +</neonView> diff --git a/process/Sql_lib/process.js b/process/Sql_lib/process.js index ae7bfd7d08..18a3c8ebc2 100644 --- a/process/Sql_lib/process.js +++ b/process/Sql_lib/process.js @@ -277,6 +277,13 @@ SqlCondition.prototype.andPrepareVars = function(field, variable, cond, fieldTyp return this; } +SqlCondition.prototype.andPrepareValue = function(field, value) { + if (value) { + return this.andPrepare(field, value, null, null); + } + return this; +} + /** * same as the "orPrepare"-function but with validation of adito-variables functionality * @param {String | String[]} field the database field as "tablename.columnname"; e.g. "ORGANISATION.NAME" or as array with column-alias: ["ORGANISATION", "NAME", "myorgAlias"] -- GitLab