Skip to content
Snippets Groups Projects
Commit 7a3e057c authored by j.goderbauer's avatar j.goderbauer Committed by Johannes Goderbauer
Browse files

[Projekt: Entwicklung - Neon][TicketNr.: 1046355][Datenübernehmen bei Anlage...

[Projekt: Entwicklung - Neon][TicketNr.: 1046355][Datenübernehmen bei Anlage neue Aktivität aus Aufgabe]

(cherry picked from commit 3bb7ed61)
parent 60c85d7c
No related branches found
No related tags found
No related merge requests found
......@@ -2,4 +2,6 @@ import("system.vars");
import("ActivityTask_lib");
import("Context_lib");
ActivityUtils.createNewActivity(undefined, undefined, ContextUtils.getCurrentContextId(), vars.get("$field.TASKID"));
\ No newline at end of file
var subject = vars.get("$field.SUBJECT")
var infoText = vars.get("$field.DESCRIPTION");
ActivityUtils.createNewActivity(undefined, null, ContextUtils.getCurrentContextId(), vars.get("$field.TASKID"), subject, infoText);
\ No newline at end of file
......@@ -131,10 +131,49 @@ ActivityUtils.insertDocuments = function (pActivityId, pDocuments)
else
SingleBinaryUtils.insert("ACTIVITY", "DOCUMENT", pActivityId, b64Content, filename);
});
}
};
/**
* Create a new activity
* Creates a new Activity, this will _not_ insert a new Activity into the database but will open the Activity context in "new" mode and
* presets several fields instead
*
* @param {String} [pRowId] rowid of an record that is linked automatically, as object the current context is used, so this needs to be an ID of
* the current context. Useful whenever you create an Activity from another Object (e.g. an Organisation) and that
* other object shall be linked automatically. There will be no check performed if your given context and id are possible
* values in the ActivityLinks. Specifing nothing (e.g. null) will result in not automatically linking your current
* context
* @param {Array} [pAdditionalLinks] Links that shall be added but are not from an "your curren context view"(see pRowId-param). pAdditionalLinks is a
* two dimensional array where each elemt in the array is in the form of [objectType, objectRowId]
* @param {String} [pParentContext] name of a context that shall be specified as a parent record. The relation between child an parent is:
* 1 parent : n childs; only a fre Contexts are possible parents, e.g.:
* a Task may have other Tasks or Activities as children.
* The pParentContext and pParentId both need to bet set, otherwise no parent will be set
* @param {String} [pParentId] id of record (that is of the given type in pParentContext) which shall be specified as a parent record; see
* pParentContext param
* @param {String} [pSubject] subject text which is set as preset in the Activity
* @param {String} [pInfo] description text which is set as preset in the Activity
* @param {String} [pDirection] direction key (keyword keyid) of the direction which is set as preset in the Activity; consider using $KeywordRegistry
* @param {Object} [pDocuments] 2D array where each element is an array of:
* <ul>
* <li>document-name</li>
* <li>document-content(base64-string)</li>
* <li>true/false if it's mainDocument or not</li>
* </ul>
* for example:
* <pre>[["number.txt", "MDExOCA5OTkgODgxIDk5OSAxMTkgNzI1IDM", true]]</pre>
* @static
* @example
* var content; //will be filled with letter-file as base64 encoded string
* .....
* var links = [];
* if (contactId)
* {
* var context = ContactUtils.getContextByContactId(contactId);
* links.push([context, contactId]);
* }
* ActivityUtils.createNewActivity(vars.get("$sys.uid"), links, null, null, translate.text("Letter"), translate.text("Outgoing letter was sent."),
* $KeywordRegistry.activityDirection$outgoing(), [["Letter.docx", content, false]]);
*/
ActivityUtils.createNewActivity = function(pRowId, pAdditionalLinks, pParentContext, pParentId, pSubject, pInfo, pDirection, pDocuments)
{
......@@ -149,7 +188,7 @@ ActivityUtils.createNewActivity = function(pRowId, pAdditionalLinks, pParentCont
params["Direction_param"] = pDirection;
_ActivityTaskUtils._createNew("Activity", pRowId, pAdditionalLinks, pParentContext, pParentId, params)
}
};
/*
* Gets the date of the last activity
......@@ -234,10 +273,50 @@ ActivityUtils.insertLink = function (pActivityId, pObjectType, pRowId)
* @class
*/
function TaskUtils () {}
/**
* Create a new task
* Creates a new Task, this will _not_ insert a new Task into the database but will open the Task context in "new" mode and
* preset several fields instead
*
* @param {String} [pRowId] rowid of an record that is linked automatically, as object the current context is used, so this needs to be an ID of
* the current context. Useful whenever you create an Task from another Object (e.g. an Organisation) and that
* other object shall be linked automatically. There will be no check performed if your given context and id are possible
* values in the TaskLinks. Specifing nothing (e.g. null) will result in not automatically linking your current
* context
* @param {Array} [pAdditionalLinks] Links that shall be added but are not from an "your curren context view"(see pRowId-param). pAdditionalLinks is a
* two dimensional array where each elemt in the array is in the form of [objectType, objectRowId]
* @param {String} [pParentContext] name of a context that shall be specified as a parent record. The relation between child an parent is:
* 1 parent : n childs; only a fre Contexts are possible parents, e.g.:
* a Task may have other Tasks or Activities as children.
* The pParentContext and pParentId both need to bet set, otherwise no parent will be set
* @param {String} [pParentId] id of record (that is of the given type in pParentContext) which shall be specified as a parent record; see
* pParentContext param
* @param {Object} [pParams] additional params that are bypassed to the Task-context as key-value pairs. If you set a param that is
* populated within another function parameter (e.g. the parent-parameters) the value of pParams will be discarded and the
* value of the "other function parameter" (e.g. the parent-parameter) will be used
* @param {Object} [pDocuments] 2D array where each element is an array of:
* <ul>
* <li>document-name</li>
* <li>document-content(base64-string)</li>
* <li>true/false if it's mainDocument or not</li>
* </ul>
* for example:
* <pre>[["number.txt", "MDExOCA5OTkgODgxIDk5OSAxMTkgNzI1IDM", true]]</pre>
* @static
* @example
* .....
* var links = [];
* if (contactId)
* {
* links.push([ContactUtils.getContextByContactId(contactId), contactId]);
* }
*
* if (vars.get("$field.SALESPROJECT_ID"))
* {
* links.push(["Salesproject", vars.get("$field.SALESPROJECT_ID")]);
* }
*
* TaskUtils.createNewTask(vars.get("$field.OFFERID"), links, null, null, null, [["Offer.pdf", pdfContent, false]]);
*/
TaskUtils.createNewTask = function(pRowId, pAdditionalLinks, pParentContext, pParentId, pParams, pDocuments)
{
......@@ -309,14 +388,36 @@ TaskUtils.getEndedStatuses = function()
* Do not create an instance of this!
*
* @ignore
* @private
* @class
*/
function _ActivityTaskUtils() {}
/**
* Create a new task
* Helper function which creates a new activity/task-like objects like Activity, Task or SupportTicket.
* This will _not_ insert a new record into the database but will open the corresponding context in "new" mode and presets several fields instead
*
* @param {String} pContext Name of the Context that shall be opened ("Task", "Activity", etc.)
* @param {String} [pRowId] rowid of an record that is linked automatically, as object the current context is used, so this needs to be an ID of
* the current context. Useful whenever you create an Activity/Task from another Object (e.g. an Organisation) and that
* other object shall be linked automatically. There will be no check performed if your given context and id are possible
* values in ActivityLinks/TaskLinks. Specifing nothing (e.g. null) will result in not automatically linking your current
* context
* @param {Array} [pAdditionalLinks] Links that shall be added but are not from an "your curren context view"(see pRowId-param). pAdditionalLinks is a
* two dimensional array where each elemt in the array is in the form of [objectType, objectRowId]
* @param {String} [pParentContext] name of a context that shall be specified as a parent record. The relation between child an parent is:
* 1 parent : n childs; only a fre Contexts are possible parents, e.g.:
* a Task may have other Tasks or Activities as children.
* The pParentContext and pParentId both need to bet set, otherwise no parent will be set
* Links of parent will be added automatically used as preset
* @param {String} [pParentId] id of record (that is of the given type in pParentContext) which shall be specified as a parent record; see
* pParentContext param
* @param {Object} [pParams] additional params that are bypassed to the context that is opened as key-value pairs. If you set a param that is
* populated within another function parameter (e.g. the parent-parameters) the value of pParams will be discarded and the
* value of the "other function parameter" (e.g. the parent-parameter) will be used
*
* @ignore
* @private
*/
_ActivityTaskUtils._createNew = function(pContext, pRowId, pAdditionalLinks, pParentContext, pParentId, pParams)
{
......@@ -338,14 +439,12 @@ _ActivityTaskUtils._createNew = function(pContext, pRowId, pAdditionalLinks, pPa
if (pParentContext && pParentId)
{
params["ParentContext_param"] = pParentContext;
params["ParentId_param"] = pParentId;
}
neon.openContext(pContext, null, null, neon.OPERATINGSTATE_NEW, params);
}
};
/**
* add the links to the link-table in new mode
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment