diff --git a/entity/Appointment_entity/afterUiInit.js b/entity/Appointment_entity/afterUiInit.js index b018dcc372580a44982d6c1fbfccf554474ca192..84f0515ebf4c6c9ba00bb4a071bacebe74fbaace 100644 --- a/entity/Appointment_entity/afterUiInit.js +++ b/entity/Appointment_entity/afterUiInit.js @@ -6,23 +6,14 @@ if(vars.exists("$param.Entry_param") && vars.get("$param.Entry_param")) { var entry = JSON.parse(vars.getString("$param.Entry_param")); - if(entry["AppLinkContext"] && entry["AppLinkId"]) + if(entry["LINKS"]) { - neon.addRecord("AppointmentLinks", - { - "OBJECTID" : entry["AppLinkId"], - "OBJECTTYPE" : entry["AppLinkContext"] - }); + entry["LINKS"].forEach(function(pLink){ + neon.addRecord("AppointmentLinks", + { + "OBJECTID" : pLink["OBJECT_ID"], + "OBJECTTYPE" : pLink["OBJECT_TYPE"] + }); + }) } -} - -if(vars.exists("$param.PresetLinks_param") && vars.get("$param.PresetLinks_param")) -{ - var presetLink = JSON.parse(vars.get("$param.PresetLinks_param")); - presetLink.forEach(function(link) { - neon.addRecord("AppointmentLinks", { - "OBJECTTYPE" : link[0], - "OBJECTID" : link[1] - }); - }); } \ No newline at end of file diff --git a/entity/Appointment_entity/recordcontainers/jdito/onDelete.js b/entity/Appointment_entity/recordcontainers/jdito/onDelete.js index 6f6249aee33bd1be9f2247d09814ffba59a1d904..a72c6d52f19cec9a1217723bf80ff9f6b3454ce5 100644 --- a/entity/Appointment_entity/recordcontainers/jdito/onDelete.js +++ b/entity/Appointment_entity/recordcontainers/jdito/onDelete.js @@ -1,8 +1,8 @@ import("system.logging"); -import("Sql_lib"); import("system.neon"); import("system.calendars"); import("system.vars"); +import("Sql_lib"); var uid; @@ -23,8 +23,9 @@ else if(vars.get("$field.OWNER")) calendars.removeEntryByUID(calendars.VEVENT, JSON.parse(vars.get("$field.OWNER"))["cn"], uid, vars.get("$field.RECURRENCEID")); } - /** - * Deletes ApointmentLinks referring to the deleted Appointment. - */ - newWhereIfSet("AB_APPOINTMENTLINK.APPOINTMENT_ID", uid) - .deleteData(); \ No newline at end of file +/** + * Deletes ApointmentLinks referring to the deleted Appointment. + */ +newWhereIfSet("AB_APPOINTMENTLINK.APPOINTMENT_ID", uid) + .deleteData(); + \ No newline at end of file diff --git a/entity/Appointment_entity/recordcontainers/jdito/onInsert.js b/entity/Appointment_entity/recordcontainers/jdito/onInsert.js index a109e86f9257c3bbc84bea6922dad55d93f14f2c..21d79d0f9f82bfa904e33604db62defa2ca9733f 100644 --- a/entity/Appointment_entity/recordcontainers/jdito/onInsert.js +++ b/entity/Appointment_entity/recordcontainers/jdito/onInsert.js @@ -1,13 +1,13 @@ -import("system.neon"); import("system.calendars"); -import("system.vars"); import("system.question"); import("system.translate"); -import("system.text"); import("system.datetime"); -import("system.db"); import("system.result"); import("system.tools"); +import("system.neon"); +import("system.vars"); +import("system.text"); +import("system.db"); var event = JSON.parse(vars.getString("$param.Entry_param")); @@ -38,6 +38,19 @@ if (fields["REMINDER.value"]) var idstringarray = calendars.insert([event]); + +if(event["LINKS"]) +{ + event["LINKS"].forEach(function(pLink){ + neon.addRecord("AppointmentLinks", + { + "OBJECTID" : pLink["OBJECT_ID"], + "OBJECTTYPE" : pLink["OBJECT_TYPE"], + "APPOINTMENT_ID" : idstringarray[0] + }); + }) +} + event[calendars.ID] = idstringarray[0]; neon.setFieldValue("$field.UID", event[calendars.ID]); diff --git a/entity/Organisation_entity/entityfields/newappointment/onActionProcess.js b/entity/Organisation_entity/entityfields/newappointment/onActionProcess.js index 75442aa5646ebe8cd8d019c944c2e92d556b42f9..0c4be0c71b604e080efc25c139a1b1af45c3c382 100644 --- a/entity/Organisation_entity/entityfields/newappointment/onActionProcess.js +++ b/entity/Organisation_entity/entityfields/newappointment/onActionProcess.js @@ -1,14 +1,23 @@ +import("system.calendars"); import("system.vars"); import("system.neon"); -import("system.calendars"); -import("Calendar_lib"); import("system.date"); -import("Context_lib"); import("system.util"); +import("Context_lib"); +import("Calendar_lib"); + +var links = [ + { + "OBJECT_ID":vars.get("$field.CONTACTID"), + "OBJECT_TYPE":ContextUtils.getCurrentContextId() + } +]; -var params = {}; -params["Entry_param"] = JSON.stringify(CalendarUtil.createEntry(util.getNewUUID(), calendars.VEVENT, "", "", false, ContextUtils.getCurrentContextId(), vars.get("$field.CONTACTID"))); +var params = { + "Entry_param":JSON.stringify(CalendarUtil.createEntry("", "", links, undefined, undefined, undefined, undefined, undefined, undefined, undefined, + undefined, undefined, undefined, undefined)) +}; neon.openContext("Appointment", "AppointmentEdit_view", null, neon.OPERATINGSTATE_NEW, params); diff --git a/entity/Person_entity/entityfields/newappointment/onActionProcess.js b/entity/Person_entity/entityfields/newappointment/onActionProcess.js index ccdf3b71d3cc39e8bf2aaaf65bf114672c799809..beb5dd48021852127db99015ed5db0c1417fc5aa 100644 --- a/entity/Person_entity/entityfields/newappointment/onActionProcess.js +++ b/entity/Person_entity/entityfields/newappointment/onActionProcess.js @@ -1,12 +1,22 @@ +import("system.calendars"); import("system.vars"); import("system.neon"); -import("system.calendars"); -import("Calendar_lib"); import("system.date"); -import("Context_lib"); import("system.util"); +import("Calendar_lib"); +import("Context_lib"); + + +var links = [ + { + "OBJECT_ID":vars.get("$field.CONTACTID"), + "OBJECT_TYPE":ContextUtils.getCurrentContextId() + } +]; -var params = {}; -params["Entry_param"] = JSON.stringify(CalendarUtil.createEntry(util.getNewUUID(), calendars.VEVENT, "", "", false, ContextUtils.getCurrentContextId(), vars.get("$field.CONTACTID"))); +var params = { + "Entry_param":JSON.stringify(CalendarUtil.createEntry("", "", links, undefined, undefined, undefined, undefined, undefined, undefined, undefined, + undefined, undefined, undefined, undefined)) +}; neon.openContext("Appointment", "AppointmentEdit_view", null, neon.OPERATINGSTATE_NEW, params); \ No newline at end of file diff --git a/entity/VisitPlanEntry_entity/afterSave.js b/entity/VisitPlanEntry_entity/afterSave.js index 0474f7803292e84fd36388734a67e8a568cefc41..7e637db97c23d16d0cc73ffd0a40c305f3f96741 100644 --- a/entity/VisitPlanEntry_entity/afterSave.js +++ b/entity/VisitPlanEntry_entity/afterSave.js @@ -1,8 +1,6 @@ -import("Sql_lib"); import("system.translate"); import("system.eMath"); import("system.datetime"); -import("Date_lib"); import("system.logging"); import("system.result"); import("system.neon"); @@ -10,8 +8,10 @@ import("system.calendars"); import("system.util"); import("system.vars"); import("system.db"); -import("Calendar_lib"); import("Communication_lib"); +import("Calendar_lib"); +import("Sql_lib"); +import("Date_lib"); var savedData = vars.get("$local.entitydata"); @@ -32,14 +32,22 @@ if(savedData["STATUS_APPOINTMENT"] == "VISITSTATUSAPPOINTMENTCONFIRMED") var endTime = savedData["END_TIME"]; var duration = eMath.subInt(endTime, startTime); - var params = {}; - params["Entry_param"] = JSON.stringify(CalendarUtil.createEntry(util.getNewUUID(), calendars.VEVENT, summary, description, false, null, null - , null, null, startTime, duration, null, null, null, null, [standardMail])); - - params["PresetLinks_param"] = JSON.stringify([ - ["Organisation", savedData["ORGANISATION_CONTACT_ID"]], - ["Person", savedData["CONTACT_ID"]] - ]); + var links = [ + { + "OBJECT_ID":savedData["ORGANISATION_CONTACT_ID"], + "OBJECT_TYPE":"Organisation" + }, + { + "OBJECT_ID":savedData["CONTACT_ID"], + "OBJECT_TYPE":"Person" + } + ] + + var params = { + "Entry_param" : JSON.stringify(CalendarUtil.createEntry(summary, description, links, undefined, undefined, + Date(Date.toExponential(startTime)), Date(Date.toExponential(endTime)), + undefined, undefined, undefined, [standardMail], undefined, undefined, undefined)) + }; neon.openContext("Appointment", "AppointmentEdit_view", [vars.get("$field.UID")], neon.OPERATINGSTATE_NEW, params, null); result.string(true); diff --git a/entity/VisitPlanEntry_entity/entityfields/entityactiongroup/children/newappointment/onActionProcess.js b/entity/VisitPlanEntry_entity/entityfields/entityactiongroup/children/newappointment/onActionProcess.js index 83d2148d4e05ea1d5c71a3b04cedc476baee492b..cb71f3b700221379fc622bb337a63194e7e9b1b8 100644 --- a/entity/VisitPlanEntry_entity/entityfields/entityactiongroup/children/newappointment/onActionProcess.js +++ b/entity/VisitPlanEntry_entity/entityfields/entityactiongroup/children/newappointment/onActionProcess.js @@ -1,16 +1,16 @@ -import("Sql_lib"); import("system.translate"); -import("system.db"); -import("Communication_lib"); import("system.datetime"); -import("system.eMath"); import("system.calendars"); +import("system.eMath"); import("system.util"); -import("Calendar_lib"); +import("system.db"); import("system.vars"); import("system.neon"); import("system.result"); +import("Communication_lib"); +import("Calendar_lib"); import("Contact_lib") +import("Sql_lib"); var selectionRowData = vars.get("$sys.selectionRows"); @@ -32,14 +32,22 @@ var entryDate = datetime.toDate(selectionRowData[0].ENTRYDATE, "dd-MM-yyyy"); startTime = entryDate + " " + datetime.toDate(selectionRowData[0].BEGIN_TIME, "HH:mm:ss.S"); startTime = datetime.toLong(startTime, "dd-MM-yyyy HH:mm:ss.S"); -var params = {}; -params["Entry_param"] = JSON.stringify(CalendarUtil.createEntry(util.getNewUUID(), calendars.VEVENT, summary, description, false, null, null - , null, null, startTime, duration, null, null, null, null, [standardMail])); - -params["PresetLinks_param"] = JSON.stringify([ - ["Organisation", selectionRowData[0].ORGANISATION_CONTACT_ID], - ["Person", selectionRowData[0].CONTACT_ID] - ]); +var links = [ + { + "OBJECT_ID" : selectionRowData[0]["ORGANISATION_CONTACT_ID"], + "OBJECT_TYPE" : "Organisation" + }, + { + "OBJECT_ID" : selectionRowData[0]["CONTACT_ID"], + "OBJECT_TYPE" : "Person" + } +]; + +var params = { + "Entry_param": JSON.stringify(CalendarUtil.createEntry(summary, description, links, undefined, undefined, Date(Date.toExponential(startTime)), + Date(Date.toExponential(endTime)), undefined, undefined, undefined, [standardMail], + undefined, undefined, undefined)) +}; neon.openContext("Appointment", "AppointmentEdit_view", [vars.get("$field.UID")], neon.OPERATINGSTATE_NEW, params, null); result.string(true); diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod index 23e6d296ea90fd1c311faa6dafe33178bbdb0377..e14370eefdc66607d7c1e05cc905124d4bf4f150 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -10708,6 +10708,13 @@ Bitte Datumseingabe prüfen</value> <key>Automatically</key> <value>Automatisch</value> </entry> + <entry> + <key>On site</key> + </entry> + <entry> + <key>Vacation</key> + <value>Urlaub</value> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> </language> diff --git a/process/Calendar_lib/process.js b/process/Calendar_lib/process.js index 978a653a75b7fa013cf05274dd8e9ee25550e00c..455b28d263c1e6def680391206245b213240c4e8 100644 --- a/process/Calendar_lib/process.js +++ b/process/Calendar_lib/process.js @@ -1,20 +1,21 @@ -import("Sql_lib"); +import("system.translate"); +import("system.datetime"); import("system.neon"); +import("system.calendars"); import("system.vars"); import("system.db"); -import("system.translate"); -import("system.datetime"); import("system.swing"); import("system.eMath"); -import("system.calendars"); import("system.logging"); import("system.tools"); import("system.text"); import("system.question"); import("system.SQLTYPES"); import("system.result"); +import("system.util"); +import("system.entities"); import("Util_lib"); -import("system.util") +import("Sql_lib"); /** @@ -184,244 +185,239 @@ CalendarUtil.newEvent = function( pSummary, pDescription, pWithLink, pUser, pAff /* - * Creates an new appointment entry (with link). + * Creates an new appointment entry. * - * @param {String} pSummary (optional) <p> - * The summary.<br> - * @param {String} pDescription (optional) <p> - * The description.<br> - * @param {Boolean} pWithLink (optional) <p> - * True, sets an linking to $image.frametable.<br> - * @param {String[][]} pWithLink (optional) <p> - * Description:<br> - * <ul> - * <li>pWithLink[0]: Name of the frame</li> - * <li>pWithLink[1]: Id of the shown record</li> - * <li>pWithLink[2]: Linking title</li> - * </ul> - * @param {String} pUser (optional) <p> - * The user (login).<br> - * @param {[]} pAffectedUsers (optional) <p> - * The affected users.<br> - * @param {date} pStart (optional) <p> - * Start of the appointment.<br> - * @param {date} pDuration (optional) <p> - * Duration of the appointment.<br> - * @param {integer} pGroupType (optional) <p> - * The group type:<br> - * <ul> - * <li>calendars.GROUP_SINGLE</li> - * <li>calendars.GROUP_MULTI</li> - * </ul> - * @param {integer} pCategory (optional) <p> - * calendars.CATEGORIES , encoded(String) (e.g.: text.encodeMS(["Service"])) - * @param {String} pStatus (optional) <p> - * Status of the appointment:<br> - * <ul> - * <li>calendars.STATUS_TENTATIVE</li> - * <li>calendars.STATUS_CONFIRMED</li> - * <li>calendars.STATUS_CANCELLED</li> - * </ul> - * @param {String} pReminder (optional) <p> - * Reminder for the appointment.<br> - * <p> + * @param {String} pSummary (optional) <p> + * The summary/title of the appointment. + * @param {String} pDescription (optional) <p> + * The appointment description. + * @param {String} pLinks (optional) <p> + * The links as objects <u>(key: "OBJECT_ID" & "OBJECT_TYPE")</u> in an array. + * @param {String} pOwner (optional) <p> + * The calendar-user (username) which will be specified as entry-owner. + * @param {String[]} pAffectedUsers (optional) <p> + * The affected users (username). + * @param {Date} pStart (optional) <p> + * The start of the appointment. + * @param {Date} pEnd (optional) <p> + * The end of the appointment. + * @param {String[]} pCategories (optional) <p> + * The categories of the appointment, the default ones are:<br> + * <ul> + * <li>Meeting</li> + * <li>Organisation</li> + * <li>OutOfOffice</li> + * <li>Vacation</li> + * </ul> + * @param {String} pStatus (optional) <p> + * Status of the appointment:<br> + * <ul> + * <li>calendars.STATUS_TENTATIVE</li> + * <li>calendars.STATUS_CONFIRMED</li> + * <li>calendars.STATUS_CANCELLED</li> + * </ul> + * @param {Date} pReminder (optional) <p> + * Date of the reminder for the appointment. + * @param {String[]} pExternalAttendees (optional) <p> + * External attendees. + * @param {String} pLocation (optional) <p> + * The location of the appointment. + * @param {Boolean} pIsAllDay (optional) <p> + * Whether if it is an all-day appointment or not. + * @param {String} pClassification (optional) <p> + * The classification of the appointment:<br> + * <ul> + * <li>calendars.CLASSIFICATION_PUBLIC</li> + * <li>calendars.CLASSIFICATION_PRIVATE</li> + * </ul> * @return {void} */ -CalendarUtil.newSilentEvent = function( pSummary, pDescription, pWithLink, pUser, pAffectedUsers, pStart, pDuration, pGroupType, pCategory, pStatus, pReminder) -{ - if ( pGroupType == undefined ) pGroupType = calendars.GROUP_SINGLE; - var event = CalendarUtil.createEntry( calendars.VEVENT, pSummary, pDescription, pWithLink, pUser, pAffectedUsers, pStart, pDuration, pCategory, pStatus, undefined, pReminder ); - return calendars.insert( [event] , pGroupType ); +CalendarUtil.newSilentEvent = function(pSummary, pDescription, pLinks, pOwner, pAffectedUsers, pStart, pEnd, pCategories, pStatus, + pReminder, pExternalAttendees, pLocation, pIsAllDay, pClassification) +{ + var event = CalendarUtil.createEntry(pSummary, pDescription, pLinks, pOwner, pAffectedUsers, pStart, pEnd, pCategories, pStatus, pReminder, + pExternalAttendees, pLocation, pIsAllDay, pClassification); + + var ids = calendars.insert([event], calendars.GROUP_SINGLE); + + if(pLinks) + { + var conf; + + pLinks.forEach(function(pLink){ + conf = entities.createConfigForAddingRows().entity("AppointmentLink_entity").fieldValues({ + "APPOINTMENT_ID" : ids[0], + "OBJECTID" : pLink["OBJECT_ID"], + "OBJECTTYPE" : pLink["OBJECT_TYPE"] + }); + + entities.createRow(conf); + }); + } } /* - * Creates an new task-/appointment object (with link). + * Creates an new appointment object, which is responsible for holding the data<br> + * till it's used to insert with: calendars.insert (e.g.: in Appointment_entity). * - * @param {String} pUid <p> - * The uuid.<br> - * @param {Date} pType <p> - * Tasks or appointments:<br> - * <ul> - * <li>calendars.VTODO</li> - * <li>calendars.VEVENT</li> - * </ul> * @param {String} pSummary (optional) <p> - * The summary.<br> + * The summary/title of the appointment. * @param {String} pDescription (optional) <p> - * The description.<br> - * @param {Boolean} pWithLink (optional) <p> - * True, sets an linking to $image.frametable.<br> - * @param {Boolean} pAppLinkContext (optional) <p> - * Name of the frame.<br> - * @param {Boolean} pAppLinkId (optional) <p> - * Id of the shown record.<br> - * @param {String} pUser (optional) <p> - * The user (login).<br> - * @param {[]} pAffectedUsers (optional) <p> - * The affected users ([login]).<br> + * The description of the appointment. + * @param {Object[]} pLinks (optional) <p> + * The links as objects <u>(key: "OBJECT_ID" & "OBJECT_TYPE")</u> in an array. + * @param {String} pOwner (optional) <p> + * The calendar-user (username) which will be specified as entry-owner. + * @param {String[]} pAffectedUsers (optional) <p> + * The affected users (usernames), which will be added to the appointment. * @param {Date} pStart (optional) <p> - * Start of the task/appointment.<br> - * @param {Date} pDuration (optional) <p> - * Duration of the task/appointment.<br> - * @param {Number} pCategory (optional) <p> - * calendars.CATEGORIES , encoded(String) (e.g.: text.encodeMS(["Service"]))<br> + * Start of the appointment. + * @param {Date} pEnd (optional) <p> + * Duration of the appointment. + * @param {String[]} pCategories (optional) <p> + * The categories of the appointment, the default ones are:<br> + * <ul> + * <li>Meeting</li> + * <li>Organisation</li> + * <li>OutOfOffice</li> + * <li>Vacation</li> + * </ul> * @param {String} pStatus (optional) Status of the appointment:<br> * <ul> * <li>calendars.STATUS_TENTATIVE</li> * <li>calendars.STATUS_CONFIRMED</li> * <li>calendars.STATUS_CANCELLED</li> * </ul> - * @param {String} pPriority (optional) <p> - * Priority of the task/appointment.<br> - * @param {String} pReminder (optional) <p> - * Reminder.<br> - * @param {[]} pExternalAttendees <p> - * external attendes ([mailaddress])<br> - * @return {Object} <p> + * @param {Date} pReminder (optional) <p> + * Date of reminder. + * @param {String[]} pExternalAttendees (optional) <p> + * External attendes (e-mail addresses). + * @param {String} pLocation (optional) <p> + * The locations of the appointment. + * @param {Boolean} pIsAllDay (optional) <p> + * Whether if it is an all-day appointment or not. + * @param {String} pClassification (optional) <p> + * The classification of the appointment: + * <ul> + * <li>calendars.CLASSIFICATION_PUBLIC</li> + * <li>calendars.CLASSIFICATION_PRIVATE</li> + * </ul> + * @return {Object} */ -CalendarUtil.createEntry = function(pUid, pType, pSummary, pDescription, pWithLink, pAppLinkContext, pAppLinkId, pUser, pAffectedUsers, pStart, pDuration, pCategory, pStatus, pPriority, pReminder, pExternalAttendees ) +CalendarUtil.createEntry = function(pSummary, pDescription, pLinks, pOwner, pAffectedUsers, pStart, pEnd, pCategories, pStatus, + pReminder, pExternalAttendees, pLocation, pIsAllDay, pClassification) { - var Entry = {}; - var framename; - var framdata; - var dbid; - var linktitle; - if ( pSummary == undefined || pSummary == null ) pSummary = ""; - if ( pDescription == undefined || pDescription == null ) + var entry = {}; + + entry[calendars.TYPE] = calendars.VEVENT; // hardcoded, cause only other option would be calendars.VTODO for an task + // since tasks are handled via. Task_entity there is no need for the calendars.VTODO option. + + if (!pDescription) { if(vars.getString("$sys.scope") == "vaadin") + { pDescription = neon.getImageContent(vars.getString("$sys.currententityname")); + } else - pDescription = swing.getImageContent(); + { + pDescription = swing.getImageContent(); //todo: check whether it's necessary or not. #1047482 + } } - if ( pUser == undefined || pUser == null ) pUser = vars.getString("$sys.user"); - //kein translate.key hier, weil es sich um einen rein technischen Wert handelt: - if ( pStart == undefined ) pStart = datetime.toLong(datetime.toDate(parseInt(vars.getString("$sys.date")) + datetime.ONE_HOUR, "dd.MM.yyyy HH:00"), "dd.MM.yyyy HH:mm"); - if ( pCategory == undefined || pCategory == null ) pCategory = ""; - - if ( (pAffectedUsers == null || pAffectedUsers == undefined) && (pExternalAttendees == null || pExternalAttendees == undefined)) + + if (!pOwner) { - Entry[calendars.AFFECTEDUSERS] = ""; + pOwner = vars.getString("$sys.user"); + } + + if (!pStart) + { + entry[calendars.DTSTART] = Date.now(); } else { - var externalAtt = []; - var affectedUsers = []; - if(pAffectedUsers) - affectedUsers = calendars.getCalendarUsers(pAffectedUsers); - - if(pExternalAttendees) - { - for(let i = 0; i < pExternalAttendees.length; i++) - externalAtt.push("; mailto:" + pExternalAttendees[i] + "; CN:" + pExternalAttendees[i] + "; ") - } - Entry[calendars.AFFECTEDUSERS] = text.encodeMS(affectedUsers.concat(externalAtt)); + entry[calendars.DTSTART] = pStart.getTime(); } - Entry[calendars.TYPE] = pType; - Entry[calendars.DTSTART] = pStart; - if ( pType == calendars.VEVENT ) + + if (!pEnd) { - if ( pDuration == undefined ) - pDuration = datetime.ONE_HOUR; - - Entry[calendars.DTEND] = String ( eMath.addInt( pStart, pDuration) ); - - if ( pStatus == undefined ) - pStatus = calendars.STATUS_CONFIRMED; - - pStatus = CalendarUtil.mapCalendarStatus(pStatus, calendars.getBackendType() ); + let tempStartdate = entry[calendars.DTSTART]; + entry[calendars.DTEND] = tempStartdate.setHours(tempStartdate.getHours()+1); } - else if ( pType == calendars.VTODO ) + else { - //kein translate.key hier, weil es sich um einen rein technischen Wert handelt: - if ( pDuration != undefined ) - Entry[calendars.DUE] = String ( eMath.addInt( pStart, pDuration) ); - else - Entry[calendars.DUE] = datetime.toLong(datetime.toDate(pStart, "dd.MM.yyyy 23:59") - ,"dd.MM.yyyy HH:mm"); - - if ( pStatus == undefined ) - pStatus = calendars.STATUS_NEEDSACTION; - - pStatus = CalendarUtil.mapCalendarStatus(pStatus, calendars.getBackendTypeTasks() ); - + entry[calendars.DTEND] = pEnd.getTime().toString(); } - if(pUid) - Entry[calendars.ID] = pUid; - - Entry[calendars.USER] = calendars.getCalendarUser(pUser); - Entry[calendars.DESCRIPTION] = pDescription; - Entry[calendars.SUMMARY] = pSummary; - Entry[calendars.STATUS] = pStatus; - Entry[calendars.CLASSIFICATION] = calendars.CLASSIFICATION_PUBLIC; - Entry[calendars.CATEGORIES] = pCategory; - Entry[calendars.TRANSPARENCY] = "OPAQUE"; - - if( pPriority != undefined ) + if (!pCategories || pCategories == []) { - Entry[calendars.PRIORITY] = pPriority; + pCategories = ""; } - - if( pReminder != undefined) + else { - Entry[calendars.HASREMINDER] = "true"; - Entry[calendars.REMINDER_DURATION] = pReminder; + for (i = 0; i < pCategories.length; i++) + { + pCategories[i] = translate.text(pCategories[i]); + } + + pCategories = text.encodeMS(pCategories); } - else - Entry[calendars.HASREMINDER] = "false"; - - if (pWithLink == false) + if ((pAffectedUsers == null || pAffectedUsers == undefined) && (pExternalAttendees == null || pExternalAttendees == undefined)) { - Entry[calendars.LINKS] = "0"; + entry[calendars.AFFECTEDUSERS] = ""; } else { - var fd = new FrameData(); - if ( typeof(pWithLink) == "object" ) + var affectedUsers = []; + + if(pAffectedUsers && pAffectedUsers != []) { - for ( var li = 0; li < pWithLink.length; li++ ) - { - framename = pWithLink[li][0]; - framdata = fd.getData("name", framename, ["table","idcolumn","title"])[0]; - dbid = pWithLink[li][1]; - linktitle = framdata[2] + " - " + pWithLink[li][2]; - - Entry["LINK_ALIAS_" + ( li + 1 )] = vars.getString("$sys.dbalias"); - Entry["LINK_TABLE_" + ( li + 1 )] = framdata[0]; - Entry["LINK_IDCOLUMN_" + ( li + 1 )] = framdata[1]; - Entry["LINK_DBID_" + ( li + 1 )] = dbid; - Entry["LINK_FRAME_" + ( li + 1 )] = "comp." + framename; - Entry["LINK_TITLE_" + ( li + 1 )] = linktitle; - } - Entry[calendars.LINKS] = pWithLink.length.toString(); + affectedUsers = calendars.getCalendarUsers(pAffectedUsers); } - else + + if(pExternalAttendees && pExternalAttendees != []) { - if ( pWithLink == true || pWithLink == undefined ) + for(let i = 0; i < pExternalAttendees.length; i++) { - framename = vars.getString("$sys.currentimagename"); - framdata = fd.getData("name", framename, ["table","idcolumn","title"])[0]; - dbid = vars.getString("$comp.idcolumn"); - linktitle = framdata[2] + " - " + swing.getImageContent(); + affectedUsers.push("; mailto:" + pExternalAttendees[i] + "; CN:" + pExternalAttendees[i] + "; ") } - Entry[calendars.LINKS] = "1"; - Entry["LINK_ALIAS_1"] = vars.getString("$sys.dbalias"); - Entry["LINK_TABLE_1"] = framdata[0]; - Entry["LINK_IDCOLUMN_1"] = framdata[1]; - Entry["LINK_DBID_1"] = dbid; - Entry["LINK_FRAME_1"] = "comp." + framename; - Entry["LINK_TITLE_1"] = linktitle; - } + } + + entry[calendars.AFFECTEDUSERS] = text.encodeMS(affectedUsers); + } + + if (!pStatus) + { + pStatus = calendars.STATUS_CONFIRMED; } - if(pAppLinkContext && pAppLinkId) + if(!pReminder) { - Entry["AppLinkContext"] = pAppLinkContext; - Entry["AppLinkId"] = pAppLinkId; + entry[calendars.HASREMINDER] = "true"; + entry[calendars.REMINDER_DURATION] = pReminder.getTime().toString(); } - return Entry; + else + { + entry[calendars.HASREMINDER] = "false"; + } + + if(pLinks) + { + entry["LINKS"] = pLinks; + } + + entry[calendars.USER] = calendars.getCalendarUser(pOwner); + entry[calendars.DESCRIPTION] = pDescription; + entry[calendars.SUMMARY] = pSummary || ""; + entry[calendars.STATUS] = CalendarUtil.mapCalendarStatus(pStatus, calendars.getBackendType()); + entry[calendars.CLASSIFICATION] = pClassification || calendars.CLASSIFICATION_PUBLIC; + entry[calendars.CATEGORIES] = pCategories; + entry[calendars.TRANSPARENCY] = "OPAQUE"; + entry[calendars.LOCATION] = pLocation || ""; + entry["X-ADITO-ISALLDAYEVENT"] = pIsAllDay ? "TRUE" : "FALSE"; + entry[calendars.DTSTART] = entry[calendars.DTSTART].toString(); + + return entry; } /*