diff --git a/entity/AttributeRelation_entity/AttributeRelation_entity.aod b/entity/AttributeRelation_entity/AttributeRelation_entity.aod index 05c0bf6f0734e4ea7c8fbbd41efd67172e936955..040e3dfeaeef7181ad13197a1fae39c3d7fd22df 100644 --- a/entity/AttributeRelation_entity/AttributeRelation_entity.aod +++ b/entity/AttributeRelation_entity/AttributeRelation_entity.aod @@ -250,6 +250,7 @@ <children> <entityParameter> <name>GetTree_param</name> + <valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/attributerelations/children/gettree_param/valueProcess.js</valueProcess> <expose v="false" /> </entityParameter> </children> diff --git a/entity/AttributeRelation_entity/entityfields/attributerelations/children/gettree_param/valueProcess.js b/entity/AttributeRelation_entity/entityfields/attributerelations/children/gettree_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/entity/AttributeRelation_entity/entityfields/specificattribute/children/attributecount_param/valueProcess.js b/entity/AttributeRelation_entity/entityfields/specificattribute/children/attributecount_param/valueProcess.js index 9c0bc231731f77eee827bad7693c8ce56d7d45d8..0d6de778c4719400e3c4302e1fa4169fd70fd128 100644 --- a/entity/AttributeRelation_entity/entityfields/specificattribute/children/attributecount_param/valueProcess.js +++ b/entity/AttributeRelation_entity/entityfields/specificattribute/children/attributecount_param/valueProcess.js @@ -5,4 +5,6 @@ import("system.vars"); var objectType = vars.exists("$param.ObjectType_param") && vars.get("$param.ObjectType_param"); var rowId = vars.exists("$param.ObjectRowId_param") && vars.get("$param.ObjectRowId_param"); if (vars.get("$param.GetTree_param") == "true" && rowId) - result.object(AttributeRelationUtils.countAttributeRelations(rowId, objectType)); \ No newline at end of file +{ + result.object(AttributeRelationUtils.countAttributeRelations(rowId, objectType)); +} \ No newline at end of file diff --git a/entity/AttributeRelation_entity/entityfields/value/onValidation.js b/entity/AttributeRelation_entity/entityfields/value/onValidation.js index 81af77d1176502b787ed26e0cb8845f754ec87dc..ef3040e48654b8adde21d33bbed134b180a5b504 100644 --- a/entity/AttributeRelation_entity/entityfields/value/onValidation.js +++ b/entity/AttributeRelation_entity/entityfields/value/onValidation.js @@ -1,18 +1,8 @@ -import("system.translate"); import("Util_lib"); import("system.result"); import("system.vars"); import("Attribute_lib"); -if(vars.get("$field.AB_ATTRIBUTE_ID") && !AttributeRelationUtils.validateSingleCount( - vars.get("$param.ObjectType_param"), - vars.get("$param.ObjectRowId_param"), - vars.get("$field.AB_ATTRIBUTE_ID") -)) { - result.string(translate.text("Invalid attribute count")); -} -else -{ var attributeType = AttributeTypes.get(vars.get("$field.ATTRIBUTE_TYPE")); if (attributeType && !attributeType.useLookup) { @@ -21,5 +11,4 @@ if (attributeType && !attributeType.useLookup) { result.string(validationResult); } -} } \ No newline at end of file diff --git a/entity/AttributeRelation_entity/entityfields/value_lookup/onValidation.js b/entity/AttributeRelation_entity/entityfields/value_lookup/onValidation.js index 38d6db89efb9db9a63dcd3c508e5dd25bb3f9e3d..f517b44992fe2d13b2cca675d774dee0028ff7e0 100644 --- a/entity/AttributeRelation_entity/entityfields/value_lookup/onValidation.js +++ b/entity/AttributeRelation_entity/entityfields/value_lookup/onValidation.js @@ -1,18 +1,8 @@ -import("system.translate"); import("Util_lib"); import("system.result"); import("system.vars"); import("Attribute_lib"); -if(vars.get("$field.AB_ATTRIBUTE_ID") && !AttributeRelationUtils.validateSingleCount( - vars.get("$param.ObjectType_param"), - vars.get("$param.ObjectRowId_param"), - vars.get("$field.AB_ATTRIBUTE_ID") -)) { - result.string(translate.text("Invalid attribute count")); -} -else -{ var attributeType = AttributeTypes.get(vars.get("$field.ATTRIBUTE_TYPE")); if (attributeType && attributeType.useLookup) { @@ -22,4 +12,3 @@ if (attributeType && attributeType.useLookup) result.string(validationResult); } } -} diff --git a/neonContext/Salesproject/Salesproject.aod b/neonContext/Salesproject/Salesproject.aod index 92def56f1a35869471d27551d86b8e0b6362c374..9b93a07f221f0722a90b60601aeac8e4032fefa2 100644 --- a/neonContext/Salesproject/Salesproject.aod +++ b/neonContext/Salesproject/Salesproject.aod @@ -80,5 +80,9 @@ <name>407d9b32-c379-428b-b1e1-d92a820971fd</name> <view>SalesprojectPreviewMultiple_view</view> </neonViewReference> + <neonViewReference> + <name>c860de14-8ebe-438f-92c3-cba727a15690</name> + <view>SalesprojectAttribute_view</view> + </neonViewReference> </references> </neonContext> diff --git a/neonView/SalesprojectMain_view/SalesprojectMain_view.aod b/neonView/SalesprojectMain_view/SalesprojectMain_view.aod index 43368c01548b156b25d2389c85c30878e3a071c1..95fc6da52400e9b0dc53d2d2bba8123349600be5 100644 --- a/neonView/SalesprojectMain_view/SalesprojectMain_view.aod +++ b/neonView/SalesprojectMain_view/SalesprojectMain_view.aod @@ -25,8 +25,8 @@ <view>SalesprojectActivity_view</view> </neonViewReference> <neonViewReference> - <name>7ac103ea-1131-41e0-85ce-e7d2fc86dfd8</name> - <entityField>Attributes</entityField> + <name>107b20e3-6326-498a-968b-ac09257981fc</name> + <entityField>AttributeTree</entityField> <view>AttributeRelationTree_view</view> </neonViewReference> <neonViewReference> diff --git a/process/Attribute_lib/process.js b/process/Attribute_lib/process.js index f7ed889c7010152235989623fecc09548a9abb04..98ff92d9eb3f27b726c777f1ed7aa3dc026bdfb8 100644 --- a/process/Attribute_lib/process.js +++ b/process/Attribute_lib/process.js @@ -808,29 +808,6 @@ AttributeRelationUtils.countAttributeRelations = function (pRowId, pObjectType, return countObj; } -/** - * Checks weather the passed attribute can be added to the given object using the min and max count. - * - * @param {string} pObjectType the object type - * @param {string} pObjectRowId the id of the object - * @param {string} pAttributeId the attribute witch needs to be validated - * - * @returns {boolean} weather it is valid to add the attribute or not - */ -AttributeRelationUtils.validateSingleCount = function(pObjectType, pObjectRowId, pAttributeId) -{ - var [min, max] = newSelect(["AB_ATTRIBUTEUSAGE.MIN_COUNT", "AB_ATTRIBUTEUSAGE.MAX_COUNT"]) - .from("AB_ATTRIBUTEUSAGE") - .where("AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID", pAttributeId) - .and("AB_ATTRIBUTEUSAGE.OBJECT_TYPE", pObjectType).arrayRow(); - var attrCount = AttributeRelationUtils.countAttributeRelations( - pObjectRowId, - pObjectType, - {} - ); - var count = attrCount[vars.get("$field.AB_ATTRIBUTE_ID")] || 0; - return count >= parseInt(min || -Infinity) && count <= parseInt(max || Infinity); -} /*********************************************************************************************************************/