diff --git a/entity/Appointment_entity/Appointment_entity.aod b/entity/Appointment_entity/Appointment_entity.aod index 7bd09fc91bc3500e041fc30bcfd3dc00216e7d1f..4805824fc40af93261d7cbe99faddf0b24ab99a0 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 4e8aac3eba017eeb2368f7023a22deb0ea38c715..23649935d1dd90af87cbefa612a2733cafe75d63 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 b08d2d5cae52e973ed036c402375ee31bc1551ce..18cdb55d5f138cf19832a538801cd462c1c61246 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 a8c3c421bdef4f17adf9d09278ff446ce9ff37eb..6f39fc39c246c394733ac2caae53c9fe1887442e 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 2b0b8d4c42eac355d3ff2a6920179b44fde74b79..1c51ddec69c3f914e0fc22b0b0f880d95342babf 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 fe2f84a688a4761263b6c8641fc602a3bfca9e54..92f7a1352ab980a17995e7bf02a566c82c26bc2a 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 88ff16a8549e9b4073a8006e90b97dd9d27440f3..67da92ae2faee58f5e7fe5e08c9a7c212f32ca27 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 0000000000000000000000000000000000000000..6ce3ce63a5671607245180c40b9e70a45093daf2 --- /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 ae7bfd7d0836060686f9c879220136c012bb307f..18a3c8ebc2dd9f7dcb8560fed5f0e10b6b94ffe0 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"]