Skip to content
Snippets Groups Projects
Commit 54cd71bb authored by Sebastian Listl's avatar Sebastian Listl :speech_balloon: Committed by S.Listl
Browse files

Attribute usage delete/update fix

(cherry picked from commit 39c162bf)
parent 74afec5a
No related branches found
No related tags found
No related merge requests found
......@@ -14,7 +14,6 @@
<name>OBJECT_TYPE</name>
<title>Module</title>
<consumer>Context</consumer>
<valueProcess>%aditoprj%/entity/AttributeUsage_entity/entityfields/object_type/valueProcess.js</valueProcess>
<displayValueProcess>%aditoprj%/entity/AttributeUsage_entity/entityfields/object_type/displayValueProcess.js</displayValueProcess>
<onValueChangeTypes>
<element>MASK</element>
......@@ -46,6 +45,7 @@
<entityParameter>
<name>AttributeId_param</name>
<expose v="true" />
<mandatory v="true" />
<description>PARAMETER</description>
</entityParameter>
<entityField>
......
......@@ -2,7 +2,5 @@ import("system.vars");
import("system.result");
import("system.neon");
if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.AttributeId_param") && vars.get("$param.AttributeId_param") != null)
result.string(vars.get("$param.AttributeId_param"));
else if (vars.get("$this.value"))
result.string(vars.get("$this.value"));
\ No newline at end of file
if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW)
result.string(vars.get("$param.AttributeId_param"));
\ No newline at end of file
......@@ -3,7 +3,11 @@ import("system.neon");
import("system.vars");
import("system.project");
if (vars.exists("$field.OBJECT_TYPE") && vars.get("$field.OBJECT_TYPE"))
if (vars.get("$field.OBJECT_TYPE"))
{
//this is a workaround to get the old value in the onDBUpdate process
//@TODO replace this when it's possible to get the old value in onDBUpdate
vars.set("$context.originalObjectType", vars.get("$field.OBJECT_TYPE"));
result.string(project.getDataModel(project.DATAMODEL_KIND_CONTEXT, vars.get("$field.OBJECT_TYPE"))[1]);
}
\ No newline at end of file
import("system.vars");
//this is a workaround to get the old value in the onDBUpdate process
//@TODO replace this when it's possible to get the old value in onDBUpdate
vars.set("$context.originalObjectType", vars.get("$field.OBJECT_TYPE"));
\ No newline at end of file
......@@ -2,6 +2,6 @@ import("system.vars");
import("Attribute_lib");
var data = vars.get("$local.rowdata");
var objectType = data["OBJECT_TYPE.value"];
var objectType = data["AB_ATTRIBUTEUSAGE.OBJECT_TYPE"];
AttributeUsageUtil.deleteChildrenUsages(attributeId, objectType);
\ No newline at end of file
AttributeUsageUtil.deleteChildrenUsages(vars.get("$field.AB_ATTRIBUTE_ID"), objectType);
\ No newline at end of file
......@@ -2,8 +2,8 @@ import("system.vars");
import("Attribute_lib");
var data = vars.get("$local.rowdata");
var attributeId = data["AB_ATTRIBUTE_ID.value"];
var objectType = data["OBJECT_TYPE.value"];
var attributeId = data["AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID"];
var objectType = data["AB_ATTRIBUTEUSAGE.OBJECT_TYPE"];
AttributeUsageUtil.insertChildrenUsages(attributeId, objectType);
AttributeUsageUtil.removeDuplicates(attributeId);
\ No newline at end of file
import("system.vars");
import("Attribute_lib");
var data = vars.get("$local.rowdata");
var attributeId = data["AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID"];
var oldObjectType = vars.get("$context.originalObjectType");
var newObjectType = data["AB_ATTRIBUTEUSAGE.OBJECT_TYPE"];
AttributeUsageUtil.updateChildrenUsages(attributeId, oldObjectType, newObjectType);
if (vars.get("$local.changed").indexOf("AB_ATTRIBUTEUSAGE.OBJECT_TYPE") != -1)
{
var data = vars.get("$local.rowdata");
var attributeId = vars.get("$field.AB_ATTRIBUTE_ID");
var oldObjectType = vars.get("$context.originalObjectType");
var newObjectType = data["AB_ATTRIBUTEUSAGE.OBJECT_TYPE"];
AttributeUsageUtil.updateChildrenUsages(attributeId, oldObjectType, newObjectType);
}
AttributeUsageUtil.removeDuplicates(attributeId);
\ No newline at end of file
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