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

AttributeUsage preset max_count for inherited usages

parent 423bc498
No related branches found
No related tags found
No related merge requests found
...@@ -1034,15 +1034,14 @@ function AttributeUsageUtil () {} ...@@ -1034,15 +1034,14 @@ function AttributeUsageUtil () {}
* @param {String} pAttributeId the id of the superordinate attribute * @param {String} pAttributeId the id of the superordinate attribute
* @param {String} pObjectType the context * @param {String} pObjectType the context
*/ */
AttributeUsageUtil.insertChildrenUsages = function (pAttributeId, pObjectType)
{ {
if (!pAttributeId) if (!pAttributeId)
return; return;
var table = "AB_ATTRIBUTEUSAGE"; 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 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 = '" + " (select count(*) from AB_ATTRIBUTEUSAGE where AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID = AB_ATTRIBUTE.AB_ATTRIBUTEID and OBJECT_TYPE = '"
+ pObjectType + "') = 0 from AB_ATTRIBUTE"; + pObjectType + "') = 0 from AB_ATTRIBUTE";
...@@ -1059,9 +1058,12 @@ AttributeUsageUtil.insertChildrenUsages = function (pAttributeId, pObjectType) ...@@ -1059,9 +1058,12 @@ AttributeUsageUtil.insertChildrenUsages = function (pAttributeId, pObjectType)
attributes.forEach(function (row) 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]); inserts.push([table, columns, types, values]);
} }
_addInserts(row[0], pObjectType); _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