Skip to content
Snippets Groups Projects
Commit 27dd3a9f authored by S.Listl's avatar S.Listl
Browse files

Attribute theme tree fix

parent 5c9eeca5
No related branches found
No related tags found
No related merge requests found
......@@ -120,8 +120,7 @@ function _sortArrayForTree (pArray)
pArray.forEach(function (row) {allIds[row[idIndex]] = true;});
var index = 0;
for (let itemsAdded = true; itemsAdded; itemsAdded = oldIndex != index)
{
do {
var oldIndex = index;
pArray.forEach(function (row)
{
......@@ -131,7 +130,7 @@ function _sortArrayForTree (pArray)
index : index++
};
}, rows);
}
} while (oldIndex != index);
var sortedArray = new Array(index);
for (let i in rows)
sortedArray[rows[i].index] = rows[i].data;
......
......@@ -167,6 +167,7 @@
<entityParameter>
<name>AttrParentType_param</name>
<expose v="true" />
<triggerRecalculation v="true" />
<description>PARAMETER</description>
</entityParameter>
<entityParameter>
......@@ -289,6 +290,10 @@
<name>AttrParentId_param</name>
<valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/attributegroup/children/attrparentid_param/valueProcess.js</valueProcess>
</entityParameter>
<entityParameter>
<name>AttrParentType_param</name>
<valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/attributegroup/children/attrparenttype_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
</entityConsumer>
<entityField>
......
import("system.vars");
import("system.result");
result.string(vars.getString("$field.ATTRIBUTE_TYPE").trim());
......@@ -33,8 +33,11 @@ else if (getGroups) //if getGroups == true, it is the lookup for selecting the s
var isGroupCondition = SqlCondition.begin();
for (let type in $AttributeTypes)
if ($AttributeTypes[type].isGroup && $AttributeTypes[type] != $AttributeTypes.COMBO)
if ($AttributeTypes[type].isGroup && $AttributeTypes[type] != $AttributeTypes.COMBO
&& (parentType == $AttributeTypes.VOID || $AttributeTypes[type] != $AttributeTypes.VOID))
{
isGroupCondition.orPrepare(["AB_ATTRIBUTE", "ATTRIBUTE_TYPE", uidTableAlias], $AttributeTypes[type]);
}
condition.andSqlCondition(SqlCondition.begin()
.andSqlCondition(isGroupCondition)
......@@ -88,9 +91,7 @@ function _buildAttributeTable (pAttributes)
var arrayIndex = 0;
//stops the loop when no new items were added so that recursive relations between attributes don't cause an infinite loop
for (let itemsAdded = true; itemsAdded; itemsAdded = oldIndex != arrayIndex)
{
do {
var oldIndex = arrayIndex;
pAttributes.forEach(function (row)
{
......@@ -102,7 +103,8 @@ function _buildAttributeTable (pAttributes)
index : arrayIndex++
};
}, rows);
}
} while (oldIndex != arrayIndex); //stops the loop when no new items were added so that recursive relations between attributes don't cause an infinite loop
var displaySimpleName = vars.exists("$param.DisplaySimpleName_param") && vars.get("$param.DisplaySimpleName_param");
var sortedArray = new Array(Object.keys(rows).length);
for (let i in rows)
......@@ -114,8 +116,7 @@ function _buildAttributeTable (pAttributes)
.andPrepare("AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID", rowData[0])
.buildSql("select OBJECT_TYPE from AB_ATTRIBUTEUSAGE")
);
if (usages.length)
rowData[7] = usages.join(", ");
rowData[7] = usages.join(", ");
}
var fullName = displaySimpleName
? rowData[8]
......
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