Skip to content
Snippets Groups Projects
Commit ef7b6d29 authored by Johannes Hörmann's avatar Johannes Hörmann
Browse files

fix unfiltered attributes-usage

parent 4aad1fa0
No related branches found
No related tags found
No related merge requests found
......@@ -39,6 +39,7 @@
<entityField>
<name>CITY</name>
<title>City</title>
<consumer>CityValidation</consumer>
<mandatoryProcess>%aditoprj%/entity/Address_entity/entityfields/city/mandatoryProcess.js</mandatoryProcess>
<displayValueProcess>%aditoprj%/entity/Address_entity/entityfields/city/displayValueProcess.js</displayValueProcess>
<onValueChange>%aditoprj%/entity/Address_entity/entityfields/city/onValueChange.js</onValueChange>
......@@ -76,6 +77,7 @@
<entityField>
<name>ZIP</name>
<title>Postcode</title>
<consumer>ZipValidation</consumer>
<mandatoryProcess>%aditoprj%/entity/Address_entity/entityfields/zip/mandatoryProcess.js</mandatoryProcess>
<displayValueProcess>%aditoprj%/entity/Address_entity/entityfields/zip/displayValueProcess.js</displayValueProcess>
<onValueChange>%aditoprj%/entity/Address_entity/entityfields/zip/onValueChange.js</onValueChange>
......
......@@ -59,6 +59,7 @@ else if (showEmpty || rowId)
}
if (vars.exists("$param.FilteredAttributeIds_param") && vars.getString("$param.FilteredAttributeIds_param"))
{
logging.log("------------------------ " + vars.getString("$param.FilteredAttributeIds_param") )
let filteredIds = JSON.parse(vars.getString("$param.FilteredAttributeIds_param"));
logging.log(filteredIds.toSource())
......@@ -69,7 +70,7 @@ else if (showEmpty || rowId)
{
this.orPrepare("AB_ATTRIBUTE.AB_ATTRIBUTEID", id);
}, subCondition);
// return nothing if filteredAttributeIds is an empty array. (--> and 1=2)
sqlCondition.andSqlCondition(subCondition, "1=2");
}
......
import("system.logging");
import("system.datetime");
import("system.util");
import("system.db");
......@@ -14,6 +15,8 @@ var columns = [
];
var uid = vars.get("$field.UID");
logging.log(uid)
logging.log(vars.get("$param.ObjectRowId_param"))
var values = [
uid[0] == "," ? uid.substr(1) : uid, // if first char is "," it is a newly generated UUID
vars.get("$field.AB_ATTRIBUTE_ID"),
......
......@@ -50,18 +50,22 @@ else if (getGroups) //if getGroups == true, it is the lookup for selecting the s
else if (objectType) //if there's an objectType, it comes from the AttributeRelation entity
{
logging.log(vars.get("$param.FilteredAttributeIds_param"))
var filteredAttributes = null;
if (vars.exists("$param.FilteredAttributeIds_param") && vars.getString("$param.FilteredAttributeIds_param")) {
var filteredAttributes = JSON.parse(vars.getString("$param.FilteredAttributeIds_param"));
var attributeCount;
if (vars.exists("$param.AttributeCount_param") && vars.get("$param.AttributeCount_param"))
attributeCount = JSON.parse(vars.getString("$param.AttributeCount_param"));
var ids = AttributeUtil.getPossibleAttributes(objectType, false, filteredAttributes, attributeCount);
if (filteredAttributes.length > 0)
condition.and("SELF.AB_ATTRIBUTEID in ('" + ids.join("','") + "')");
else // do not return anything, if parameter is there but an empty array
condition.and("1=2");
filteredAttributes = JSON.parse(vars.getString("$param.FilteredAttributeIds_param"));
}
var attributeCount;
if (vars.exists("$param.AttributeCount_param") && vars.get("$param.AttributeCount_param"))
attributeCount = JSON.parse(vars.getString("$param.AttributeCount_param"));
var ids = AttributeUtil.getPossibleAttributes(objectType, false, filteredAttributes, attributeCount);
if (ids.length > 0)
condition.and("SELF.AB_ATTRIBUTEID in ('" + ids.join("','") + "')");
else if (filteredAttributes != null) // do not return anything, if parameter is there but an empty array
condition.and("1=2");
}
else if (parentType)
......
......@@ -39,7 +39,7 @@
<customProperties>
<customBooleanProperty>
<name>addressValidation.enable</name>
<property v="false" />
<property v="true" />
</customBooleanProperty>
<customStringProperty>
<name>addressValidation.url</name>
......@@ -59,7 +59,7 @@
</customStringProperty>
<customBooleanProperty>
<name>zipCityValidation.enable</name>
<property v="false" />
<property v="true" />
</customBooleanProperty>
<customStringProperty>
<name>zipCityValidation.url</name>
......@@ -80,7 +80,7 @@
<customBooleanProperty>
<name>phoneValidation.enable</name>
<description></description>
<property v="false" />
<property v="true" />
</customBooleanProperty>
<customStringProperty>
<name>phoneValidation.url</name>
......
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