From f1f0a8138b5d90ee779fe3bd2512d78dd637c7f6 Mon Sep 17 00:00:00 2001
From: Sebastian Listl <s.listl@adito.de>
Date: Fri, 28 Aug 2020 16:38:26 +0200
Subject: [PATCH] #1064320 Address search fix for street

---
 .../AddressValidation_entity.aod                       |  8 ++++++++
 .../recordcontainers/jdito/contentProcess.js           |  3 ++-
 .../entityfields/address_ws/valueProcess.js            |  3 +--
 .../AddressValidationLookup_view.aod                   | 10 +---------
 .../EmployeeRoleEdit_view/EmployeeRoleEdit_view.aod    |  4 ----
 process/WsValidation_lib/process.js                    |  8 ++------
 6 files changed, 14 insertions(+), 22 deletions(-)

diff --git a/entity/AddressValidation_entity/AddressValidation_entity.aod b/entity/AddressValidation_entity/AddressValidation_entity.aod
index 19c0dbd986..a744c59ffc 100644
--- a/entity/AddressValidation_entity/AddressValidation_entity.aod
+++ b/entity/AddressValidation_entity/AddressValidation_entity.aod
@@ -130,6 +130,7 @@
     </entityField>
     <entityField>
       <name>BUILDINGNO</name>
+      <title>Nr</title>
     </entityField>
     <entityProvider>
       <name>StreetValidation</name>
@@ -154,6 +155,10 @@
       <name>City_param</name>
       <expose v="true" />
     </entityParameter>
+    <entityField>
+      <name>STREET_AND_BUILDINGNO</name>
+      <title>Street</title>
+    </entityField>
   </entityFields>
   <recordContainers>
     <jDitoRecordContainer>
@@ -206,6 +211,9 @@
         <jDitoRecordFieldMapping>
           <name>VALUE.value</name>
         </jDitoRecordFieldMapping>
+        <jDitoRecordFieldMapping>
+          <name>STREET_AND_BUILDINGNO.value</name>
+        </jDitoRecordFieldMapping>
       </recordFieldMappings>
     </jDitoRecordContainer>
   </recordContainers>
diff --git a/entity/AddressValidation_entity/recordcontainers/jdito/contentProcess.js b/entity/AddressValidation_entity/recordcontainers/jdito/contentProcess.js
index 2f5f62eea0..e92fed1fd8 100644
--- a/entity/AddressValidation_entity/recordcontainers/jdito/contentProcess.js
+++ b/entity/AddressValidation_entity/recordcontainers/jdito/contentProcess.js
@@ -55,7 +55,8 @@ else
             row.buildingNo,
             row.lat,
             row.lon,
-            row.value
+            row.value,
+            row.road && row.buildingNo ? row.road + " " + row.buildingNo : row.road
         ];
     }));
 }
diff --git a/entity/Address_entity/entityfields/address_ws/valueProcess.js b/entity/Address_entity/entityfields/address_ws/valueProcess.js
index 2c7449d49d..ef17405a27 100644
--- a/entity/Address_entity/entityfields/address_ws/valueProcess.js
+++ b/entity/Address_entity/entityfields/address_ws/valueProcess.js
@@ -1,5 +1,4 @@
 import("system.vars");
 import("WsValidation_lib");
 
-if(!vars.get("$this.value"))
-    WsValidationFieldUtils.wsValueProcess(WsValidationType.get().TYPE_STREET_NOMINATIM, "$field.ADDRESS");
\ No newline at end of file
+WsValidationFieldUtils.wsValueProcess(WsValidationType.get().TYPE_STREET_NOMINATIM, "$field.ADDRESS");
\ No newline at end of file
diff --git a/neonView/AddressValidationLookup_view/AddressValidationLookup_view.aod b/neonView/AddressValidationLookup_view/AddressValidationLookup_view.aod
index 5c41ff868f..7372c60c7a 100644
--- a/neonView/AddressValidationLookup_view/AddressValidationLookup_view.aod
+++ b/neonView/AddressValidationLookup_view/AddressValidationLookup_view.aod
@@ -30,15 +30,7 @@
         </neonTableColumn>
         <neonTableColumn>
           <name>a272c3cb-7bbf-41a4-9490-884c2f449b40</name>
-          <entityField>STREET</entityField>
-        </neonTableColumn>
-        <neonTableColumn>
-          <name>e842bb68-96c6-4d1f-bf44-70a29c7c7d72</name>
-          <entityField>FROM_BN</entityField>
-        </neonTableColumn>
-        <neonTableColumn>
-          <name>59162b47-ec96-4076-8e57-929fccbf133d</name>
-          <entityField>TO_BN</entityField>
+          <entityField>STREET_AND_BUILDINGNO</entityField>
         </neonTableColumn>
         <neonTableColumn>
           <name>d32d92bf-db7d-443f-b911-6731ea89cf3b</name>
diff --git a/neonView/EmployeeRoleEdit_view/EmployeeRoleEdit_view.aod b/neonView/EmployeeRoleEdit_view/EmployeeRoleEdit_view.aod
index 2255ea4658..c3b40d1ec2 100644
--- a/neonView/EmployeeRoleEdit_view/EmployeeRoleEdit_view.aod
+++ b/neonView/EmployeeRoleEdit_view/EmployeeRoleEdit_view.aod
@@ -17,10 +17,6 @@
           <entityField>ROLE</entityField>
           <fullWidth v="true" />
         </neonGenericMultipleTableColumn>
-        <neonGenericMultipleTableColumn>
-          <name>a67f3020-1438-483a-9897-647336002618</name>
-          <entityField>UID</entityField>
-        </neonGenericMultipleTableColumn>
       </columns>
     </genericMultipleViewTemplate>
   </children>
diff --git a/process/WsValidation_lib/process.js b/process/WsValidation_lib/process.js
index 8d7b821ee0..5829c69588 100644
--- a/process/WsValidation_lib/process.js
+++ b/process/WsValidation_lib/process.js
@@ -354,16 +354,12 @@ WsValidationUtils.setAddressFields = function(pJSON)
         "$field.REGION": data.region,
         "$field.STATE": data.state,
         "$field.ADDRESS": data.road,
-        "$field.LAT": data.lat,
-        "$field.LON": data.lon
+        "$field.BUILDINGNO": data.buildingNo
     }
     
     for (let field in toSet) 
     {
-        let value = toSet[field];
-        if (!value)
-            value = "";
-
+        let value = toSet[field] || "";
         neon.setFieldValue(field, value);
     }
     
-- 
GitLab