Skip to content
Snippets Groups Projects
Commit c0c703d1 authored by Sebastian Listl's avatar Sebastian Listl :speech_balloon: Committed by Sebastian Listl
Browse files

AttributeUsage preset max_count for inherited usages

(cherry picked from commit 29e295e3)
parent f386bf21
No related branches found
No related tags found
No related merge requests found
......@@ -1034,15 +1034,14 @@ function AttributeUsageUtil () {}
* @param {String} pAttributeId the id of the superordinate attribute
* @param {String} pObjectType the context
*/
AttributeUsageUtil.insertChildrenUsages = function (pAttributeId, pObjectType)
{
if (!pAttributeId)
return;
var table = "AB_ATTRIBUTEUSAGE";
var columns = ["AB_ATTRIBUTEUSAGEID", "AB_ATTRIBUTE_ID", "OBJECT_TYPE"];
var columns = ["AB_ATTRIBUTEUSAGEID", "AB_ATTRIBUTE_ID", "OBJECT_TYPE", "MAX_COUNT"];
var types = db.getColumnTypes(table, columns);
var sqlSelect = "select AB_ATTRIBUTEID, "
var sqlSelect = "select AB_ATTRIBUTEID, ATTRIBUTE_TYPE, "
+ " (select count(*) from AB_ATTRIBUTEUSAGE where AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID = AB_ATTRIBUTE.AB_ATTRIBUTEID and OBJECT_TYPE = '"
+ pObjectType + "') = 0 from AB_ATTRIBUTE";
......@@ -1059,9 +1058,12 @@ AttributeUsageUtil.insertChildrenUsages = function (pAttributeId, pObjectType)
attributes.forEach(function (row)
{
if (row[1] == "true")
if (row[2] == "true")
{
let values = [util.getNewUUID(), row[0], pObjectType];
let maxCount = row[1].trim() == $AttributeTypes.BOOLEAN || row[1].trim() == $AttributeTypes.VOID
? "1"
: "";
let values = [util.getNewUUID(), row[0], pObjectType, maxCount];
inserts.push([table, columns, types, values]);
}
_addInserts(row[0], pObjectType);
......
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