Skip to content
Snippets Groups Projects
Commit 624ad205 authored by Dominik Lechner's avatar Dominik Lechner
Browse files

Performance-Fix in Attribute

parent fc9a7a5c
No related branches found
No related tags found
No related merge requests found
......@@ -5,28 +5,31 @@ import("system.vars");
import("Attribute_lib");
import("Sql_lib");
var type = vars.get("$field.ATTRIBUTE_TYPE").trim();
var parentType = AttributeUtil.getAttributeType(vars.get("$field.ATTRIBUTE_PARENT_ID"));
var state = neon.COMPONENTSTATE_AUTO;
if (parentType == $AttributeTypes.COMBO || parentType == $AttributeTypes.VOID)
{
state = neon.COMPONENTSTATE_READONLY;
}
else if (AttributeTypeUtil.isGroupType(type))
if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT)
{
var hasSubordinate = db.cell(SqlCondition.begin()
.andPrepareVars("AB_ATTRIBUTE.AB_ATTRIBUTEID", "$field.UID")
.buildSql(
"select exists ("
+ "select SUB.AB_ATTRIBUTEID from AB_ATTRIBUTE SUB "
+ "where SUB.ATTRIBUTE_PARENT_ID = AB_ATTRIBUTE.AB_ATTRIBUTEID"
+ ") from AB_ATTRIBUTE", "1=2"
)
) == "true";
if (hasSubordinate)
var type = vars.get("$field.ATTRIBUTE_TYPE").trim();
var parentType = AttributeUtil.getAttributeType(vars.get("$field.ATTRIBUTE_PARENT_ID"));
if (parentType == $AttributeTypes.COMBO || parentType == $AttributeTypes.VOID)
{
state = neon.COMPONENTSTATE_READONLY;
}
else if (AttributeTypeUtil.isGroupType(type))
{
var hasSubordinate = db.cell(SqlCondition.begin()
.andPrepareVars("AB_ATTRIBUTE.AB_ATTRIBUTEID", "$field.UID")
.buildSql(
"select exists ("
+ "select SUB.AB_ATTRIBUTEID from AB_ATTRIBUTE SUB "
+ "where SUB.ATTRIBUTE_PARENT_ID = AB_ATTRIBUTE.AB_ATTRIBUTEID"
+ ") from AB_ATTRIBUTE", "1=2"
)
) == "true";
if (hasSubordinate)
state = neon.COMPONENTSTATE_READONLY;
}
else if (AttributeUtil.hasRelations(vars.get("$field.UID")))
state = neon.COMPONENTSTATE_READONLY;
}
else if (AttributeUtil.hasRelations(vars.get("$field.UID")))
state = neon.COMPONENTSTATE_READONLY;
result.string(state)
\ 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