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

Combobox Attribute -> Anzeige gefixt

parent 3fe88e63
No related branches found
No related tags found
No related merge requests found
......@@ -36,6 +36,7 @@
<resolution>DAY</resolution>
<possibleItemsProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/attributerelation_value/possibleItemsProcess.js</possibleItemsProcess>
<valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/attributerelation_value/valueProcess.js</valueProcess>
<displayValueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/attributerelation_value/displayValueProcess.js</displayValueProcess>
<onValueChange>%aditoprj%/entity/AttributeRelation_entity/entityfields/attributerelation_value/onValueChange.js</onValueChange>
</entityField>
<entityField>
......
import("system.db");
import("system.result");
import("system.vars");
import("Attribute_lib");
import("Sql_lib");
var attributeId = vars.get("$field.AB_ATTRIBUTE_ID");
var attrType = AttributeHandler.begin(attributeId).getAttributeType();
if (attrType == AttributeTypes.COMBO)
result.string(AttributeUtil.getSimpleAttributeName(vars.get("$field.ID_VALUE")));
\ No newline at end of file
......@@ -2,4 +2,4 @@ import("system.result");
import("system.vars");
import("Attribute_lib");
result.string(AttributeUtil.getAttributeNameById(vars.get("$field.ATTRIBUTE_PARENT_ID")))
\ No newline at end of file
result.string(AttributeUtil.getSimpleAttributeName(vars.get("$field.ATTRIBUTE_PARENT_ID")))
\ No newline at end of file
......@@ -31,6 +31,7 @@ AttributeUtil.getPossibleAttributes = function (pObjectType, pIncludeGroups)
+ " join AB_ATTRIBUTEUSAGE on AB_ATTRIBUTEID = AB_ATTRIBUTE_ID";
attrCond = SqlCondition.begin()
.andPrepare("AB_ATTRIBUTEUSAGE.OBJECT_TYPE", pObjectType)
.and("ATTRIBUTE_TYPE != '" + AttributeTypes.COMBOVALUE + "'")
.and("ATTRIBUTE_ACTIVE = 1");
if (!pIncludeGroups)
......@@ -38,19 +39,19 @@ AttributeUtil.getPossibleAttributes = function (pObjectType, pIncludeGroups)
var attributes = db.array(db.COLUMN, attrCond.buildSql(attrSql)).map(function (id)
{
return [id, AttributeUtil.getAttributeNameById(id)];
return [id, AttributeUtil.getFullAttributeName(id)];
});
return attributes;
}
/**
* returns the name of an attribute
* returns the name of an attribute with all parent attribute names
*
* @param {String} pAttributeId the id of the attribute
*
* @return {String} the name of the attribute
*/
AttributeUtil.getAttributeNameById = function (pAttributeId)
AttributeUtil.getFullAttributeName = function (pAttributeId)
{
var attributeNames = [];
var attribute;
......@@ -59,9 +60,9 @@ AttributeUtil.getAttributeNameById = function (pAttributeId)
attribute = db.array(db.ROW, SqlCondition.begin()
.andPrepare("AB_ATTRIBUTE.AB_ATTRIBUTEID", pAttributeId, "# = ?", idType)
.buildSql("select ATTRIBUTE_NAME, ATTRIBUTE_PARENT_ID from AB_ATTRIBUTE")
);
);
if (attribute.length > 0)
{
{
attributeNames.push(attribute[0]);
pAttributeId = attribute[1];
}
......@@ -72,6 +73,23 @@ AttributeUtil.getAttributeNameById = function (pAttributeId)
return attributeNames.reverse().join(" / ");
}
/**
* returns the name of an attribute
*
* @param {String} pAttributeId the id of the attribute
*
* @return {String} the name of the attribute
*/
AttributeUtil.getSimpleAttributeName = function (pAttributeId)
{
var attributeName = db.cell(SqlCondition.begin()
.andPrepare("AB_ATTRIBUTE.AB_ATTRIBUTEID", pAttributeId)
.buildSql("select ATTRIBUTE_NAME from AB_ATTRIBUTE")
);
return attributeName;
}
/**
* gets the value of an attribute for one dataset (e. g. a person)
*/
......
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