Skip to content
Snippets Groups Projects
Commit 1ce1ef8d authored by Benjamin Ulrich's avatar Benjamin Ulrich :speech_balloon: Committed by Sebastian Listl
Browse files

[Projekt: xRM-Sales][TicketNr.: 1077022][Vertriebsprojekt Eigenschaften können...

[Projekt: xRM-Sales][TicketNr.: 1077022][Vertriebsprojekt Eigenschaften können mehrfach ausgewählt werden.]
parent d570a761
No related branches found
No related tags found
No related merge requests found
......@@ -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>
......
......@@ -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
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
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);
}
}
}
......@@ -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>
......@@ -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>
......
......@@ -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);
}
/*********************************************************************************************************************/
......
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