Skip to content
Snippets Groups Projects
Commit 50020736 authored by Johannes Goderbauer's avatar Johannes Goderbauer
Browse files

Activity: new offer -> automatically links offer to activity

parent 1853a565
No related branches found
No related tags found
No related merge requests found
import("system.vars");
import("Offer_lib");
OfferUtils.createNewOffer();
\ No newline at end of file
OfferUtils.createNewOffer(null, null, null, vars.get("$field.ACTIVITYID"));
\ No newline at end of file
......@@ -932,6 +932,12 @@
<name>OfferStatus_param</name>
<expose v="true" />
</entityParameter>
<entityParameter>
<name>ActivityId_param</name>
<expose v="true" />
<mandatory v="false" />
<documentation>%aditoprj%/entity/Offer_entity/entityfields/activityid_param/documentation.adoc</documentation>
</entityParameter>
</entityFields>
<recordContainers>
<dbRecordContainer>
......
Param to automatically add an activitylink in an existing activity to a newly created offer. This will be done in on save.
Usefull when creating a new offer from the activity point of view.
\ No newline at end of file
import("system.db");
import("system.datetime");
import("system.util");
import("system.neon");
import("system.vars");
import("Offer_lib");
if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.OfferOriginal_Id_param"))
OfferUtils.copyOfferItems(vars.getString("$param.OfferOriginal_Id_param"), vars.get("$local.uid"));
if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW)
{
if (vars.exists("$param.OfferOriginal_Id_param"))
OfferUtils.copyOfferItems(vars.getString("$param.OfferOriginal_Id_param"), vars.get("$local.uid"));
var activityId = vars.get("$param.ActivityId_param");
if (activityId)
{
var activityLinkColumns = ["ACTIVITYLINKID", "ACTIVITY_ID", "DATE_NEW", "USER_NEW", "OBJECT_TYPE", "OBJECT_ROWID"];
var activityLinkValues = [util.getNewUUID(), activityId, datetime.date(), vars.get("$sys.user"), "Offer", vars.get("$field.OFFERID")];
db.insertData("ACTIVITYLINK", activityLinkColumns, null, activityLinkValues);
}
}
\ No newline at end of file
......@@ -72,8 +72,9 @@ OfferUtils.isDeletable = function(status) {
/**
* Create a new offer and open the offer context in NEW-mode
* //TODO: function comment
*/
OfferUtils.createNewOffer = function(pContextId, pRowId, pRelationId)
OfferUtils.createNewOffer = function(pContextId, pRowId, pRelationId, pActivityId)
{
var params = {};
......@@ -86,6 +87,9 @@ OfferUtils.createNewOffer = function(pContextId, pRowId, pRelationId)
if (pRelationId)
params["ContactId_param"] = pRelationId;
if (pActivityId)
params["ActivityId_param"] = pActivityId;
neon.openContext("Offer", null, null, neon.OPERATINGSTATE_NEW, params);
}
......
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