diff --git a/entity/Attribute_entity/entityfields/attributetypestate_param/valueProcess.js b/entity/Attribute_entity/entityfields/attributetypestate_param/valueProcess.js index 792fe93e5d41f3abafcbe09fd5dc5c5e38fe9cc1..797792acfabfc8b1dce1c7af42b8a78a4dc9422e 100644 --- a/entity/Attribute_entity/entityfields/attributetypestate_param/valueProcess.js +++ b/entity/Attribute_entity/entityfields/attributetypestate_param/valueProcess.js @@ -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