From d2a593b19feb499f6e701bb6f475b17b5b2cdc69 Mon Sep 17 00:00:00 2001
From: Benjamin Ulrich <b.ulrich@adito.de>
Date: Wed, 14 Oct 2020 13:14:23 +0000
Subject: [PATCH] =?UTF-8?q?[Projekt:=20Entwicklung=20-=20Neon][TicketNr.:?=
 =?UTF-8?q?=201054174][Fehler=20in=20FilterExtension=20f=C3=BCr=20Attribut?=
 =?UTF-8?q?es]?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../AttributeRelation_entity.aod              | 35 +++++++++++++++++++
 .../displaysimplename_param/valueProcess.js   |  3 ++
 .../attributecount_param/valueProcess.js      |  8 +++++
 .../children/objecttype_param/valueProcess.js |  4 +++
 entity/Attribute_entity/Attribute_entity.aod  | 21 +++++++++++
 .../displaysimplename_param/valueProcess.js   |  3 ++
 .../Organisation_entity.aod                   | 21 +++++++++++
 .../objectrowid_param/valueProcess.js         |  4 +++
 .../children/objecttype_param/valueProcess.js |  4 +++
 .../_____LANGUAGE_EXTRA.aod                   |  9 +++++
 .../_____LANGUAGE_de/_____LANGUAGE_de.aod     | 12 +++++++
 .../_____LANGUAGE_en/_____LANGUAGE_en.aod     |  9 +++++
 process/AttributeFilter_lib/process.js        |  2 +-
 13 files changed, 134 insertions(+), 1 deletion(-)
 create mode 100644 entity/AttributeRelation_entity/entityfields/filterprovider/children/displaysimplename_param/valueProcess.js
 create mode 100644 entity/AttributeRelation_entity/entityfields/specificfilterattributes/children/attributecount_param/valueProcess.js
 create mode 100644 entity/AttributeRelation_entity/entityfields/specificfilterattributes/children/objecttype_param/valueProcess.js
 create mode 100644 entity/Attribute_entity/entityfields/specificfilterattributes/children/displaysimplename_param/valueProcess.js
 create mode 100644 entity/Organisation_entity/entityfields/attributesfilter/children/objectrowid_param/valueProcess.js
 create mode 100644 entity/Organisation_entity/entityfields/attributesfilter/children/objecttype_param/valueProcess.js

diff --git a/entity/AttributeRelation_entity/AttributeRelation_entity.aod b/entity/AttributeRelation_entity/AttributeRelation_entity.aod
index 74b45b0ba68..4e5c98f9dec 100644
--- a/entity/AttributeRelation_entity/AttributeRelation_entity.aod
+++ b/entity/AttributeRelation_entity/AttributeRelation_entity.aod
@@ -346,6 +346,41 @@
       <name>#PROVIDER_AGGREGATES</name>
       <useAggregates v="true" />
     </entityProvider>
+    <entityConsumer>
+      <name>SpecificFilterAttributes</name>
+      <dependency>
+        <name>dependency</name>
+        <entityName>Attribute_entity</entityName>
+        <fieldName>SpecificFilterAttributes</fieldName>
+      </dependency>
+      <children>
+        <entityParameter>
+          <name>AttributeCount_param</name>
+          <valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/specificfilterattributes/children/attributecount_param/valueProcess.js</valueProcess>
+        </entityParameter>
+        <entityParameter>
+          <name>ObjectType_param</name>
+          <valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/specificfilterattributes/children/objecttype_param/valueProcess.js</valueProcess>
+        </entityParameter>
+      </children>
+    </entityConsumer>
+    <entityProvider>
+      <name>FilterProvider</name>
+      <dependencies>
+        <entityDependency>
+          <name>0560c6d0-8473-4050-9ca1-a935bbac2ef9</name>
+          <entityName>Organisation_entity</entityName>
+          <fieldName>AttributesFilter</fieldName>
+          <isConsumer v="false" />
+        </entityDependency>
+      </dependencies>
+      <children>
+        <entityParameter>
+          <name>DisplaySimpleName_param</name>
+          <valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/filterprovider/children/displaysimplename_param/valueProcess.js</valueProcess>
+        </entityParameter>
+      </children>
+    </entityProvider>
   </entityFields>
   <recordContainers>
     <jDitoRecordContainer>
diff --git a/entity/AttributeRelation_entity/entityfields/filterprovider/children/displaysimplename_param/valueProcess.js b/entity/AttributeRelation_entity/entityfields/filterprovider/children/displaysimplename_param/valueProcess.js
new file mode 100644
index 00000000000..e0f3ec47e2b
--- /dev/null
+++ b/entity/AttributeRelation_entity/entityfields/filterprovider/children/displaysimplename_param/valueProcess.js
@@ -0,0 +1,3 @@
+import("system.result");
+
+result.string(false);
\ No newline at end of file
diff --git a/entity/AttributeRelation_entity/entityfields/specificfilterattributes/children/attributecount_param/valueProcess.js b/entity/AttributeRelation_entity/entityfields/specificfilterattributes/children/attributecount_param/valueProcess.js
new file mode 100644
index 00000000000..9c0bc231731
--- /dev/null
+++ b/entity/AttributeRelation_entity/entityfields/specificfilterattributes/children/attributecount_param/valueProcess.js
@@ -0,0 +1,8 @@
+import("Attribute_lib");
+import("system.result");
+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
diff --git a/entity/AttributeRelation_entity/entityfields/specificfilterattributes/children/objecttype_param/valueProcess.js b/entity/AttributeRelation_entity/entityfields/specificfilterattributes/children/objecttype_param/valueProcess.js
new file mode 100644
index 00000000000..5c2ba1e99bd
--- /dev/null
+++ b/entity/AttributeRelation_entity/entityfields/specificfilterattributes/children/objecttype_param/valueProcess.js
@@ -0,0 +1,4 @@
+import("system.vars");
+import("system.result");
+
+result.string(vars.exists("$param.ObjectType_param") ? vars.get("$param.ObjectType_param") : "");
diff --git a/entity/Attribute_entity/Attribute_entity.aod b/entity/Attribute_entity/Attribute_entity.aod
index 6f00c57a63f..26e2e934e59 100644
--- a/entity/Attribute_entity/Attribute_entity.aod
+++ b/entity/Attribute_entity/Attribute_entity.aod
@@ -485,6 +485,27 @@
       <name>#PROVIDER_AGGREGATES</name>
       <useAggregates v="true" />
     </entityProvider>
+    <entityProvider>
+      <name>SpecificFilterAttributes</name>
+      <dependencies>
+        <entityDependency>
+          <name>9b2b5f2e-229d-4a10-a54f-cbf77aafe512</name>
+          <entityName>AttributeRelation_entity</entityName>
+          <fieldName>SpecificFilterAttributes</fieldName>
+          <isConsumer v="false" />
+        </entityDependency>
+      </dependencies>
+      <children>
+        <entityParameter>
+          <name>DisplaySimpleName_param</name>
+          <valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/specificfilterattributes/children/displaysimplename_param/valueProcess.js</valueProcess>
+        </entityParameter>
+        <entityParameter>
+          <name>ChildType_param</name>
+          <expose v="false" />
+        </entityParameter>
+      </children>
+    </entityProvider>
   </entityFields>
   <recordContainers>
     <jDitoRecordContainer>
diff --git a/entity/Attribute_entity/entityfields/specificfilterattributes/children/displaysimplename_param/valueProcess.js b/entity/Attribute_entity/entityfields/specificfilterattributes/children/displaysimplename_param/valueProcess.js
new file mode 100644
index 00000000000..e0f3ec47e2b
--- /dev/null
+++ b/entity/Attribute_entity/entityfields/specificfilterattributes/children/displaysimplename_param/valueProcess.js
@@ -0,0 +1,3 @@
+import("system.result");
+
+result.string(false);
\ No newline at end of file
diff --git a/entity/Organisation_entity/Organisation_entity.aod b/entity/Organisation_entity/Organisation_entity.aod
index b57569f1d2a..4d5db6ed1a8 100644
--- a/entity/Organisation_entity/Organisation_entity.aod
+++ b/entity/Organisation_entity/Organisation_entity.aod
@@ -1074,6 +1074,7 @@
     </entityActionGroup>
     <entityField>
       <name>STANDARD_COUNTRY</name>
+      <title>Standard Country</title>
       <groupable v="true" />
     </entityField>
     <entityParameter>
@@ -1139,10 +1140,12 @@
     </entityField>
     <entityField>
       <name>STANDARD_ZIP</name>
+      <title>Standard Zip</title>
       <groupable v="true" />
     </entityField>
     <entityField>
       <name>STANDARD_CITY</name>
+      <title>Standard City</title>
       <groupable v="true" />
     </entityField>
     <entityField>
@@ -1397,6 +1400,24 @@
         </entityActionField>
       </children>
     </entityActionGroup>
+    <entityConsumer>
+      <name>AttributesFilter</name>
+      <dependency>
+        <name>dependency</name>
+        <entityName>AttributeRelation_entity</entityName>
+        <fieldName>FilterProvider</fieldName>
+      </dependency>
+      <children>
+        <entityParameter>
+          <name>ObjectRowId_param</name>
+          <valueProcess>%aditoprj%/entity/Organisation_entity/entityfields/attributesfilter/children/objectrowid_param/valueProcess.js</valueProcess>
+        </entityParameter>
+        <entityParameter>
+          <name>ObjectType_param</name>
+          <valueProcess>%aditoprj%/entity/Organisation_entity/entityfields/attributesfilter/children/objecttype_param/valueProcess.js</valueProcess>
+        </entityParameter>
+      </children>
+    </entityConsumer>
   </entityFields>
   <recordContainers>
     <dbRecordContainer>
diff --git a/entity/Organisation_entity/entityfields/attributesfilter/children/objectrowid_param/valueProcess.js b/entity/Organisation_entity/entityfields/attributesfilter/children/objectrowid_param/valueProcess.js
new file mode 100644
index 00000000000..59af8506d7c
--- /dev/null
+++ b/entity/Organisation_entity/entityfields/attributesfilter/children/objectrowid_param/valueProcess.js
@@ -0,0 +1,4 @@
+import("system.vars");
+import("system.result");
+
+result.string(vars.get("$field.CONTACTID"));//TODO: CONTACTID/ORGANISATIONID: review if this should be the CONTACTID or the ORGANISATIONID
\ No newline at end of file
diff --git a/entity/Organisation_entity/entityfields/attributesfilter/children/objecttype_param/valueProcess.js b/entity/Organisation_entity/entityfields/attributesfilter/children/objecttype_param/valueProcess.js
new file mode 100644
index 00000000000..59af8506d7c
--- /dev/null
+++ b/entity/Organisation_entity/entityfields/attributesfilter/children/objecttype_param/valueProcess.js
@@ -0,0 +1,4 @@
+import("system.vars");
+import("system.result");
+
+result.string(vars.get("$field.CONTACTID"));//TODO: CONTACTID/ORGANISATIONID: review if this should be the CONTACTID or the ORGANISATIONID
\ No newline at end of file
diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
index 2853fb59787..bee7fd6513e 100644
--- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
+++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
@@ -7284,6 +7284,15 @@
     <entry>
       <key>Probability in %</key>
     </entry>
+    <entry>
+      <key>Standard City</key>
+    </entry>
+    <entry>
+      <key>Standard Country</key>
+    </entry>
+    <entry>
+      <key>Standard Zip</key>
+    </entry>
   </keyValueMap>
   <font name="Dialog" style="0" size="11" />
   <sqlModels>
diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
index f2aba5d40f0..04d7a482072 100644
--- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
+++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
@@ -9662,6 +9662,18 @@ Bitte Datumseingabe prüfen</value>
       <key>Probability in %</key>
       <value>Wahrscheinlichkeit in %</value>
     </entry>
+    <entry>
+      <key>Standard City</key>
+      <value>Standardstadt</value>
+    </entry>
+    <entry>
+      <key>Standard Country</key>
+      <value>Standartland</value>
+    </entry>
+    <entry>
+      <key>Standard Zip</key>
+      <value>Standart Plz</value>
+    </entry>
   </keyValueMap>
   <font name="Dialog" style="0" size="11" />
 </language>
diff --git a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod
index b09cc03cdef..8c0cd36df48 100644
--- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod
+++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod
@@ -7365,6 +7365,15 @@
     <entry>
       <key>Probability in %</key>
     </entry>
+    <entry>
+      <key>Standard City</key>
+    </entry>
+    <entry>
+      <key>Standard Country</key>
+    </entry>
+    <entry>
+      <key>Standard Zip</key>
+    </entry>
   </keyValueMap>
   <font name="Dialog" style="0" size="11" />
 </language>
diff --git a/process/AttributeFilter_lib/process.js b/process/AttributeFilter_lib/process.js
index e67a69bc2db..d64df9664bf 100644
--- a/process/AttributeFilter_lib/process.js
+++ b/process/AttributeFilter_lib/process.js
@@ -89,7 +89,7 @@ AttributeFilterExtensionMaker.getFilterFields = function(pObjectType)
     var res = [];
 
     var loadingConfig = entities.createConfigForLoadingRows().entity("Attribute_entity")
-        .provider("SpecificAttribute")
+        .provider("SpecificFilterAttributes")
         .fields(["UID", "FULL_ATTRIBUTE_NAME", "ATTRIBUTE_TYPE"])
         .addParameter("ObjectType_param", pObjectType);
 
-- 
GitLab