From 7f0e873a0d9262d7044b9e5cf0500534eed10a21 Mon Sep 17 00:00:00 2001 From: Sebastian Pongratz <s.pongratz@adito.de> Date: Wed, 2 Jun 2021 14:16:19 +0000 Subject: [PATCH] [Projekt: xRM-ContactManagement][TicketNr.: 1080429][[Adressen] Adressfelder neu anordnen und entfernen der Nominatim-Funktion] --- .../addValidationResultColumn.xml | 10 ++ .../2021.1.0/Addressvalidation/changelog.xml | 6 + .../Data_alias/basic/2021.1.0/changelog.xml | 1 + aliasDefinition/Data_alias/Data_alias.aod | 22 ++- .../AddressValidation_entity.aod | 33 ---- .../children/type_param/valueProcess.js | 4 - .../cityvalidation/documentation.adoc | 3 - .../children/type_param/valueProcess.js | 4 - .../streetvalidation/documentation.adoc | 3 - .../children/type_param/valueProcess.js | 4 - .../zipvalidaton/documentation.adoc | 3 - entity/Address_entity/Address_entity.aod | 143 ++++-------------- .../entityfields/address/mandatoryProcess.js | 6 - .../entityfields/address/onValueChange.js | 6 +- .../entityfields/address/stateProcess.js | 9 +- .../address_ws/displayValueProcess.js | 3 - .../address_ws/documentation.adoc | 3 - .../address_ws/mandatoryProcess.js | 6 - .../entityfields/address_ws/onValueChange.js | 3 - .../entityfields/address_ws/stateProcess.js | 11 -- .../entityfields/address_ws/titleProcess.js | 11 -- .../entityfields/address_ws/valueProcess.js | 4 - .../addresssearch/stateProcess.js | 6 +- .../addresssearch/valueProcess.js | 5 +- .../entityfields/buildingno/onValueChange.js | 3 + .../entityfields/city/mandatoryProcess.js | 6 - .../entityfields/city/onValueChange.js | 3 + .../entityfields/city/stateProcess.js | 9 +- .../city_ws/displayValueProcess.js | 3 - .../entityfields/city_ws/documentation.adoc | 3 - .../entityfields/city_ws/mandatoryProcess.js | 6 - .../entityfields/city_ws/onValueChange.js | 3 - .../entityfields/city_ws/stateProcess.js | 9 -- .../entityfields/city_ws/valueProcess.js | 3 - .../children/country_param/valueProcess.js | 4 - .../currentvalue_param/valueProcess.js | 4 - .../entityfields/country/onValueChange.js | 3 + .../entityfields/state/onValueChange.js | 3 + .../children/city_param/valueProcess.js | 4 - .../children/country_param/valueProcess.js | 4 - .../currentvalue_param/valueProcess.js | 4 - .../entityfields/zip/mandatoryProcess.js | 6 - .../entityfields/zip/onValueChange.js | 3 + .../entityfields/zip/stateProcess.js | 9 +- .../zip_ws/displayValueProcess.js | 3 - .../entityfields/zip_ws/documentation.adoc | 3 - .../entityfields/zip_ws/mandatoryProcess.js | 6 - .../entityfields/zip_ws/onValidation.js | 17 --- .../entityfields/zip_ws/onValueChange.js | 3 - .../entityfields/zip_ws/stateProcess.js | 11 -- .../entityfields/zip_ws/valueProcess.js | 3 - .../children/country_param/valueProcess.js | 4 - .../currentvalue_param/valueProcess.js | 4 - .../recordcontainers/db/onDBInsert.js | 16 +- .../recordcontainers/db/onDBUpdate.js | 18 ++- .../addr_type.displayvalue/expression.js | 8 +- .../AddressList_view/AddressList_view.aod | 12 -- .../AddressOrgMultiEdit_view.aod | 22 +-- .../AddressValidationLookup_view.aod | 20 ++- .../AdressMultiEdit_view.aod | 22 +-- .../_____PREFERENCES_PROJECT.aod | 25 +-- .../nominatim.filterkeys/property.js | 1 + process/Location_lib/process.js | 63 +++++++- process/WsValidation_lib/process.js | 101 +++++++------ .../process.js | 27 +--- .../process.js | 29 +--- 66 files changed, 290 insertions(+), 529 deletions(-) create mode 100644 .liquibase/Data_alias/basic/2021.1.0/Addressvalidation/addValidationResultColumn.xml create mode 100644 .liquibase/Data_alias/basic/2021.1.0/Addressvalidation/changelog.xml delete mode 100644 entity/AddressValidation_entity/entityfields/cityvalidation/children/type_param/valueProcess.js delete mode 100644 entity/AddressValidation_entity/entityfields/cityvalidation/documentation.adoc delete mode 100644 entity/AddressValidation_entity/entityfields/streetvalidation/children/type_param/valueProcess.js delete mode 100644 entity/AddressValidation_entity/entityfields/streetvalidation/documentation.adoc delete mode 100644 entity/AddressValidation_entity/entityfields/zipvalidaton/children/type_param/valueProcess.js delete mode 100644 entity/AddressValidation_entity/entityfields/zipvalidaton/documentation.adoc delete mode 100644 entity/Address_entity/entityfields/address/mandatoryProcess.js delete mode 100644 entity/Address_entity/entityfields/address_ws/displayValueProcess.js delete mode 100644 entity/Address_entity/entityfields/address_ws/documentation.adoc delete mode 100644 entity/Address_entity/entityfields/address_ws/mandatoryProcess.js delete mode 100644 entity/Address_entity/entityfields/address_ws/onValueChange.js delete mode 100644 entity/Address_entity/entityfields/address_ws/stateProcess.js delete mode 100644 entity/Address_entity/entityfields/address_ws/titleProcess.js delete mode 100644 entity/Address_entity/entityfields/address_ws/valueProcess.js create mode 100644 entity/Address_entity/entityfields/buildingno/onValueChange.js delete mode 100644 entity/Address_entity/entityfields/city/mandatoryProcess.js create mode 100644 entity/Address_entity/entityfields/city/onValueChange.js delete mode 100644 entity/Address_entity/entityfields/city_ws/displayValueProcess.js delete mode 100644 entity/Address_entity/entityfields/city_ws/documentation.adoc delete mode 100644 entity/Address_entity/entityfields/city_ws/mandatoryProcess.js delete mode 100644 entity/Address_entity/entityfields/city_ws/onValueChange.js delete mode 100644 entity/Address_entity/entityfields/city_ws/stateProcess.js delete mode 100644 entity/Address_entity/entityfields/city_ws/valueProcess.js delete mode 100644 entity/Address_entity/entityfields/cityvalidation/children/country_param/valueProcess.js delete mode 100644 entity/Address_entity/entityfields/cityvalidation/children/currentvalue_param/valueProcess.js create mode 100644 entity/Address_entity/entityfields/country/onValueChange.js create mode 100644 entity/Address_entity/entityfields/state/onValueChange.js delete mode 100644 entity/Address_entity/entityfields/streetvalidation/children/city_param/valueProcess.js delete mode 100644 entity/Address_entity/entityfields/streetvalidation/children/country_param/valueProcess.js delete mode 100644 entity/Address_entity/entityfields/streetvalidation/children/currentvalue_param/valueProcess.js delete mode 100644 entity/Address_entity/entityfields/zip/mandatoryProcess.js create mode 100644 entity/Address_entity/entityfields/zip/onValueChange.js delete mode 100644 entity/Address_entity/entityfields/zip_ws/displayValueProcess.js delete mode 100644 entity/Address_entity/entityfields/zip_ws/documentation.adoc delete mode 100644 entity/Address_entity/entityfields/zip_ws/mandatoryProcess.js delete mode 100644 entity/Address_entity/entityfields/zip_ws/onValidation.js delete mode 100644 entity/Address_entity/entityfields/zip_ws/onValueChange.js delete mode 100644 entity/Address_entity/entityfields/zip_ws/stateProcess.js delete mode 100644 entity/Address_entity/entityfields/zip_ws/valueProcess.js delete mode 100644 entity/Address_entity/entityfields/zipvalidation/children/country_param/valueProcess.js delete mode 100644 entity/Address_entity/entityfields/zipvalidation/children/currentvalue_param/valueProcess.js create mode 100644 preferences/_____PREFERENCES_PROJECT/customproperties/nominatim.filterkeys/property.js diff --git a/.liquibase/Data_alias/basic/2021.1.0/Addressvalidation/addValidationResultColumn.xml b/.liquibase/Data_alias/basic/2021.1.0/Addressvalidation/addValidationResultColumn.xml new file mode 100644 index 0000000000..1674db376b --- /dev/null +++ b/.liquibase/Data_alias/basic/2021.1.0/Addressvalidation/addValidationResultColumn.xml @@ -0,0 +1,10 @@ +<?xml version="1.1" encoding="UTF-8" standalone="no"?> +<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> + <changeSet author="s.pongratz" id="5974608c-488a-4be9-b404-c58dc7240f7d"> + <addColumn tableName="ADDRESS"> + <column name="VALIDATION_RESULT" type="NCLOB"/> + </addColumn> + </changeSet> +</databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2021.1.0/Addressvalidation/changelog.xml b/.liquibase/Data_alias/basic/2021.1.0/Addressvalidation/changelog.xml new file mode 100644 index 0000000000..44bba8b77f --- /dev/null +++ b/.liquibase/Data_alias/basic/2021.1.0/Addressvalidation/changelog.xml @@ -0,0 +1,6 @@ +<?xml version="1.1" encoding="UTF-8" standalone="no"?> +<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> + <include relativeToChangelogFile="true" file="addValidationResultColumn.xml"/> +</databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2021.1.0/changelog.xml b/.liquibase/Data_alias/basic/2021.1.0/changelog.xml index b99b6df912..9709b5188f 100644 --- a/.liquibase/Data_alias/basic/2021.1.0/changelog.xml +++ b/.liquibase/Data_alias/basic/2021.1.0/changelog.xml @@ -7,4 +7,5 @@ <include relativeToChangelogFile="true" file="offerWorkflow/add_ab_keyword_entry_activityCategory.xml"/> <include relativeToChangelogFile="true" file="create_standardWorkflow.xml"/> <include relativeToChangelogFile="true" file="Advertising/changelog.xml"/> + <include relativeToChangelogFile="true" file="Addressvalidation/changelog.xml"/> </databaseChangeLog> \ No newline at end of file diff --git a/aliasDefinition/Data_alias/Data_alias.aod b/aliasDefinition/Data_alias/Data_alias.aod index 5564fd5eb5..af12a5f42b 100644 --- a/aliasDefinition/Data_alias/Data_alias.aod +++ b/aliasDefinition/Data_alias/Data_alias.aod @@ -1092,8 +1092,8 @@ <dbName></dbName> <primaryKey v="false" /> <columnType v="93" /> - <size v="19" /> - <scale v="0" /> + <size v="29" /> + <scale v="9" /> <notNull v="false" /> <isUnique v="false" /> <index v="false" /> @@ -1120,8 +1120,8 @@ <dbName></dbName> <primaryKey v="false" /> <columnType v="93" /> - <size v="19" /> - <scale v="0" /> + <size v="29" /> + <scale v="9" /> <notNull v="true" /> <isUnique v="false" /> <index v="false" /> @@ -1171,6 +1171,20 @@ <title></title> <description></description> </entityFieldDb> + <entityFieldDb> + <name>VALIDATION_RESULT</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="2005" /> + <size v="2147483647" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> </entityFields> </entityDb> <entityDb> diff --git a/entity/AddressValidation_entity/AddressValidation_entity.aod b/entity/AddressValidation_entity/AddressValidation_entity.aod index 3534d6d9fb..050da6433c 100644 --- a/entity/AddressValidation_entity/AddressValidation_entity.aod +++ b/entity/AddressValidation_entity/AddressValidation_entity.aod @@ -14,17 +14,6 @@ <title>Address</title> <description>UID consists of all fields as JSON. </description> </entityField> - <entityProvider> - <name>ZipValidaton</name> - <documentation>%aditoprj%/entity/AddressValidation_entity/entityfields/zipvalidaton/documentation.adoc</documentation> - <children> - <entityParameter> - <name>Type_param</name> - <valueProcess>%aditoprj%/entity/AddressValidation_entity/entityfields/zipvalidaton/children/type_param/valueProcess.js</valueProcess> - <expose v="false" /> - </entityParameter> - </children> - </entityProvider> <entityParameter> <name>Type_param</name> <expose v="true" /> @@ -65,17 +54,6 @@ <name>VALUE</name> <description>Final value returned</description> </entityField> - <entityProvider> - <name>CityValidation</name> - <documentation>%aditoprj%/entity/AddressValidation_entity/entityfields/cityvalidation/documentation.adoc</documentation> - <children> - <entityParameter> - <name>Type_param</name> - <valueProcess>%aditoprj%/entity/AddressValidation_entity/entityfields/cityvalidation/children/type_param/valueProcess.js</valueProcess> - <expose v="false" /> - </entityParameter> - </children> - </entityProvider> <entityParameter> <name>CurrentValue_param</name> <expose v="true" /> @@ -109,17 +87,6 @@ <name>BUILDINGNO</name> <title>House number</title> </entityField> - <entityProvider> - <name>StreetValidation</name> - <documentation>%aditoprj%/entity/AddressValidation_entity/entityfields/streetvalidation/documentation.adoc</documentation> - <children> - <entityParameter> - <name>Type_param</name> - <valueProcess>%aditoprj%/entity/AddressValidation_entity/entityfields/streetvalidation/children/type_param/valueProcess.js</valueProcess> - <expose v="false" /> - </entityParameter> - </children> - </entityProvider> <entityParameter> <name>City_param</name> <expose v="true" /> diff --git a/entity/AddressValidation_entity/entityfields/cityvalidation/children/type_param/valueProcess.js b/entity/AddressValidation_entity/entityfields/cityvalidation/children/type_param/valueProcess.js deleted file mode 100644 index e856004597..0000000000 --- a/entity/AddressValidation_entity/entityfields/cityvalidation/children/type_param/valueProcess.js +++ /dev/null @@ -1,4 +0,0 @@ -import("WsValidation_lib"); -import("system.result"); - -result.string(WsValidationType.get().TYPE_CITY_NOMINATIM.key); \ No newline at end of file diff --git a/entity/AddressValidation_entity/entityfields/cityvalidation/documentation.adoc b/entity/AddressValidation_entity/entityfields/cityvalidation/documentation.adoc deleted file mode 100644 index 737201e405..0000000000 --- a/entity/AddressValidation_entity/entityfields/cityvalidation/documentation.adoc +++ /dev/null @@ -1,3 +0,0 @@ -= AddressValidation_entity - CityValidation - -Provider for validating city only \ No newline at end of file diff --git a/entity/AddressValidation_entity/entityfields/streetvalidation/children/type_param/valueProcess.js b/entity/AddressValidation_entity/entityfields/streetvalidation/children/type_param/valueProcess.js deleted file mode 100644 index 84ce4d3552..0000000000 --- a/entity/AddressValidation_entity/entityfields/streetvalidation/children/type_param/valueProcess.js +++ /dev/null @@ -1,4 +0,0 @@ -import("WsValidation_lib"); -import("system.result"); - -result.string(WsValidationType.get().TYPE_STREET_NOMINATIM.key); \ No newline at end of file diff --git a/entity/AddressValidation_entity/entityfields/streetvalidation/documentation.adoc b/entity/AddressValidation_entity/entityfields/streetvalidation/documentation.adoc deleted file mode 100644 index 60a4b5ed2a..0000000000 --- a/entity/AddressValidation_entity/entityfields/streetvalidation/documentation.adoc +++ /dev/null @@ -1,3 +0,0 @@ -= AddressValidation_entity - StreetValidation - -Provider for validating street only \ No newline at end of file diff --git a/entity/AddressValidation_entity/entityfields/zipvalidaton/children/type_param/valueProcess.js b/entity/AddressValidation_entity/entityfields/zipvalidaton/children/type_param/valueProcess.js deleted file mode 100644 index 6ab3539198..0000000000 --- a/entity/AddressValidation_entity/entityfields/zipvalidaton/children/type_param/valueProcess.js +++ /dev/null @@ -1,4 +0,0 @@ -import("WsValidation_lib"); -import("system.result"); - -result.string(WsValidationType.get().TYPE_ZIP_NOMINATIM.key); \ No newline at end of file diff --git a/entity/AddressValidation_entity/entityfields/zipvalidaton/documentation.adoc b/entity/AddressValidation_entity/entityfields/zipvalidaton/documentation.adoc deleted file mode 100644 index 9da7e51bd4..0000000000 --- a/entity/AddressValidation_entity/entityfields/zipvalidaton/documentation.adoc +++ /dev/null @@ -1,3 +0,0 @@ -= AddressValidation_entity - ZipValidation - -Provider for validating zip only \ No newline at end of file diff --git a/entity/Address_entity/Address_entity.aod b/entity/Address_entity/Address_entity.aod index 686d8185ca..1e79143f14 100644 --- a/entity/Address_entity/Address_entity.aod +++ b/entity/Address_entity/Address_entity.aod @@ -12,9 +12,10 @@ <entityField> <name>ADDRESS</name> <title>Street</title> - <mandatoryProcess>%aditoprj%/entity/Address_entity/entityfields/address/mandatoryProcess.js</mandatoryProcess> - <textInputAllowed v="true" /> + <mandatory v="true" /> + <textInputAllowed v="false" /> <stateProcess>%aditoprj%/entity/Address_entity/entityfields/address/stateProcess.js</stateProcess> + <tooltip></tooltip> <onValueChange>%aditoprj%/entity/Address_entity/entityfields/address/onValueChange.js</onValueChange> <onValueChangeTypes> <element>MASK</element> @@ -46,14 +47,21 @@ <name>BUILDINGNO</name> <title>House number</title> <stateProcess>%aditoprj%/entity/Address_entity/entityfields/buildingno/stateProcess.js</stateProcess> + <onValueChange>%aditoprj%/entity/Address_entity/entityfields/buildingno/onValueChange.js</onValueChange> + <onValueChangeTypes> + <element>MASK</element> + </onValueChangeTypes> </entityField> <entityField> <name>CITY</name> <documentation>%aditoprj%/entity/Address_entity/entityfields/city/documentation.adoc</documentation> <title>City</title> - <mandatoryProcess>%aditoprj%/entity/Address_entity/entityfields/city/mandatoryProcess.js</mandatoryProcess> - <textInputAllowed v="true" /> + <mandatory v="true" /> <stateProcess>%aditoprj%/entity/Address_entity/entityfields/city/stateProcess.js</stateProcess> + <onValueChange>%aditoprj%/entity/Address_entity/entityfields/city/onValueChange.js</onValueChange> + <onValueChangeTypes> + <element>MASK</element> + </onValueChangeTypes> </entityField> <entityField> <name>COUNTRY</name> @@ -63,6 +71,10 @@ <stateProcess>%aditoprj%/entity/Address_entity/entityfields/country/stateProcess.js</stateProcess> <valueProcess>%aditoprj%/entity/Address_entity/entityfields/country/valueProcess.js</valueProcess> <displayValueProcess>%aditoprj%/entity/Address_entity/entityfields/country/displayValueProcess.js</displayValueProcess> + <onValueChange>%aditoprj%/entity/Address_entity/entityfields/country/onValueChange.js</onValueChange> + <onValueChangeTypes> + <element>MASK</element> + </onValueChangeTypes> </entityField> <entityField> <name>DISTRICT</name> @@ -84,12 +96,20 @@ <title>${ADDRESS_STATE}</title> <mandatoryProcess>%aditoprj%/entity/Address_entity/entityfields/state/mandatoryProcess.js</mandatoryProcess> <stateProcess>%aditoprj%/entity/Address_entity/entityfields/state/stateProcess.js</stateProcess> + <onValueChange>%aditoprj%/entity/Address_entity/entityfields/state/onValueChange.js</onValueChange> + <onValueChangeTypes> + <element>MASK</element> + </onValueChangeTypes> </entityField> <entityField> <name>ZIP</name> <title>Postcode</title> - <mandatoryProcess>%aditoprj%/entity/Address_entity/entityfields/zip/mandatoryProcess.js</mandatoryProcess> + <mandatory v="true" /> <stateProcess>%aditoprj%/entity/Address_entity/entityfields/zip/stateProcess.js</stateProcess> + <onValueChange>%aditoprj%/entity/Address_entity/entityfields/zip/onValueChange.js</onValueChange> + <onValueChangeTypes> + <element>MASK</element> + </onValueChangeTypes> <onValidation>%aditoprj%/entity/Address_entity/entityfields/zip/onValidation.js</onValidation> </entityField> <entityProvider> @@ -262,42 +282,6 @@ <contentTypeProcess>%aditoprj%/entity/Address_entity/entityfields/is_standard_icon/contentTypeProcess.js</contentTypeProcess> <valueProcess>%aditoprj%/entity/Address_entity/entityfields/is_standard_icon/valueProcess.js</valueProcess> </entityField> - <entityConsumer> - <name>ZipValidation</name> - <dependency> - <name>dependency</name> - <entityName>AddressValidation_entity</entityName> - <fieldName>ZipValidaton</fieldName> - </dependency> - <children> - <entityParameter> - <name>Country_param</name> - <valueProcess>%aditoprj%/entity/Address_entity/entityfields/zipvalidation/children/country_param/valueProcess.js</valueProcess> - </entityParameter> - <entityParameter> - <name>CurrentValue_param</name> - <valueProcess>%aditoprj%/entity/Address_entity/entityfields/zipvalidation/children/currentvalue_param/valueProcess.js</valueProcess> - </entityParameter> - </children> - </entityConsumer> - <entityConsumer> - <name>CityValidation</name> - <dependency> - <name>dependency</name> - <entityName>AddressValidation_entity</entityName> - <fieldName>CityValidation</fieldName> - </dependency> - <children> - <entityParameter> - <name>CurrentValue_param</name> - <valueProcess>%aditoprj%/entity/Address_entity/entityfields/cityvalidation/children/currentvalue_param/valueProcess.js</valueProcess> - </entityParameter> - <entityParameter> - <name>Country_param</name> - <valueProcess>%aditoprj%/entity/Address_entity/entityfields/cityvalidation/children/country_param/valueProcess.js</valueProcess> - </entityParameter> - </children> - </entityConsumer> <entityField> <name>AddressSearch</name> <documentation>%aditoprj%/entity/Address_entity/entityfields/addresssearch/documentation.adoc</documentation> @@ -328,81 +312,11 @@ </entityParameter> </children> </entityConsumer> - <entityConsumer> - <name>StreetValidation</name> - <dependency> - <name>dependency</name> - <entityName>AddressValidation_entity</entityName> - <fieldName>StreetValidation</fieldName> - </dependency> - <children> - <entityParameter> - <name>City_param</name> - <valueProcess>%aditoprj%/entity/Address_entity/entityfields/streetvalidation/children/city_param/valueProcess.js</valueProcess> - </entityParameter> - <entityParameter> - <name>Country_param</name> - <valueProcess>%aditoprj%/entity/Address_entity/entityfields/streetvalidation/children/country_param/valueProcess.js</valueProcess> - </entityParameter> - <entityParameter> - <name>CurrentValue_param</name> - <valueProcess>%aditoprj%/entity/Address_entity/entityfields/streetvalidation/children/currentvalue_param/valueProcess.js</valueProcess> - </entityParameter> - </children> - </entityConsumer> <entityParameter> <name>ShowDsgvoMessage_param</name> <valueProcess>%aditoprj%/entity/Address_entity/entityfields/showdsgvomessage_param/valueProcess.js</valueProcess> <expose v="true" /> </entityParameter> - <entityField> - <name>Zip_ws</name> - <documentation>%aditoprj%/entity/Address_entity/entityfields/zip_ws/documentation.adoc</documentation> - <title>Postcode</title> - <consumer>ZipValidation</consumer> - <mandatoryProcess>%aditoprj%/entity/Address_entity/entityfields/zip_ws/mandatoryProcess.js</mandatoryProcess> - <textInputAllowed v="true" /> - <stateProcess>%aditoprj%/entity/Address_entity/entityfields/zip_ws/stateProcess.js</stateProcess> - <valueProcess>%aditoprj%/entity/Address_entity/entityfields/zip_ws/valueProcess.js</valueProcess> - <displayValueProcess>%aditoprj%/entity/Address_entity/entityfields/zip_ws/displayValueProcess.js</displayValueProcess> - <onValueChange>%aditoprj%/entity/Address_entity/entityfields/zip_ws/onValueChange.js</onValueChange> - <onValueChangeTypes> - <element>MASK</element> - </onValueChangeTypes> - <onValidation>%aditoprj%/entity/Address_entity/entityfields/zip_ws/onValidation.js</onValidation> - </entityField> - <entityField> - <name>City_ws</name> - <documentation>%aditoprj%/entity/Address_entity/entityfields/city_ws/documentation.adoc</documentation> - <title>City</title> - <consumer>CityValidation</consumer> - <mandatoryProcess>%aditoprj%/entity/Address_entity/entityfields/city_ws/mandatoryProcess.js</mandatoryProcess> - <textInputAllowed v="true" /> - <stateProcess>%aditoprj%/entity/Address_entity/entityfields/city_ws/stateProcess.js</stateProcess> - <valueProcess>%aditoprj%/entity/Address_entity/entityfields/city_ws/valueProcess.js</valueProcess> - <displayValueProcess>%aditoprj%/entity/Address_entity/entityfields/city_ws/displayValueProcess.js</displayValueProcess> - <onValueChange>%aditoprj%/entity/Address_entity/entityfields/city_ws/onValueChange.js</onValueChange> - <onValueChangeTypes> - <element>MASK</element> - </onValueChangeTypes> - </entityField> - <entityField> - <name>Address_ws</name> - <documentation>%aditoprj%/entity/Address_entity/entityfields/address_ws/documentation.adoc</documentation> - <title>Street</title> - <description></description> - <consumer>StreetValidation</consumer> - <mandatoryProcess>%aditoprj%/entity/Address_entity/entityfields/address_ws/mandatoryProcess.js</mandatoryProcess> - <textInputAllowed v="true" /> - <stateProcess>%aditoprj%/entity/Address_entity/entityfields/address_ws/stateProcess.js</stateProcess> - <titleProcess>%aditoprj%/entity/Address_entity/entityfields/address_ws/titleProcess.js</titleProcess> - <valueProcess>%aditoprj%/entity/Address_entity/entityfields/address_ws/valueProcess.js</valueProcess> - <displayValueProcess>%aditoprj%/entity/Address_entity/entityfields/address_ws/displayValueProcess.js</displayValueProcess> - <onValueChange>%aditoprj%/entity/Address_entity/entityfields/address_ws/onValueChange.js</onValueChange> - <onValueChangeTypes> - <element>MASK</element> - </onValueChangeTypes> - </entityField> <entityProvider> <name>QuickEntryAdresses</name> <documentation>%aditoprj%/entity/Address_entity/entityfields/quickentryadresses/documentation.adoc</documentation> @@ -434,6 +348,9 @@ <stateProcess>%aditoprj%/entity/Address_entity/entityfields/formattedaddress/stateProcess.js</stateProcess> <valueProcess>%aditoprj%/entity/Address_entity/entityfields/formattedaddress/valueProcess.js</valueProcess> </entityField> + <entityField> + <name>VALIDATION_RESULT</name> + </entityField> </entityFields> <recordContainers> <dbRecordContainer> @@ -543,6 +460,10 @@ <name>LON.value</name> <recordfield>ADDRESS.LON</recordfield> </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>VALIDATION_RESULT.value</name> + <recordfield>ADDRESS.VALIDATION_RESULT</recordfield> + </dbRecordFieldMapping> </recordFieldMappings> <linkInformation> <linkInformation> diff --git a/entity/Address_entity/entityfields/address/mandatoryProcess.js b/entity/Address_entity/entityfields/address/mandatoryProcess.js deleted file mode 100644 index c92fea5dd7..0000000000 --- a/entity/Address_entity/entityfields/address/mandatoryProcess.js +++ /dev/null @@ -1,6 +0,0 @@ -import("system.vars"); -import("AddressEntity_lib"); -import("system.result"); -import("WsValidation_lib"); - -result.string(WsValidationFieldUtils.mainFieldMandatoryProcess(WsValidationType.get().TYPE_STREET_NOMINATIM, AddressEntityValidation.isMandatoryField(vars.get("$field.COUNTRY")))); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/address/onValueChange.js b/entity/Address_entity/entityfields/address/onValueChange.js index 9ec7eecebe..c21d354477 100644 --- a/entity/Address_entity/entityfields/address/onValueChange.js +++ b/entity/Address_entity/entityfields/address/onValueChange.js @@ -1,5 +1,3 @@ -import("system.vars"); -import("WsValidation_lib"); +import("system.neon"); -if (WsValidationUtils.isWsEnabled(WsValidationType.get().TYPE_STREET_NOMINATIM)) - WsValidationUtils.setAddressFields(vars.get("$local.value")); \ No newline at end of file +neon.setFieldValue("$field.VALIDATION_RESULT", null); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/address/stateProcess.js b/entity/Address_entity/entityfields/address/stateProcess.js index 005ea314f1..ed5e161dcc 100644 --- a/entity/Address_entity/entityfields/address/stateProcess.js +++ b/entity/Address_entity/entityfields/address/stateProcess.js @@ -1,11 +1,10 @@ import("system.neon"); -import("system.vars"); import("system.result"); -import("WsValidation_lib"); +import("system.vars"); // The field is only displayed in edit mode because there is the "formattedAddress" field which one shows the fromated address. // If the field has a Value it would be displayed next to the formattedAddress field in view mode, so in this case the state is set to invisible. -if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_VIEW) +if (vars.get("$sys.recordstate") == "" || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_VIEW) +{ result.string(neon.COMPONENTSTATE_INVISIBLE); -else - result.string(WsValidationFieldUtils.mainFieldStateProcess(WsValidationType.get().TYPE_STREET_NOMINATIM)); \ No newline at end of file +} \ No newline at end of file diff --git a/entity/Address_entity/entityfields/address_ws/displayValueProcess.js b/entity/Address_entity/entityfields/address_ws/displayValueProcess.js deleted file mode 100644 index 8b35f14226..0000000000 --- a/entity/Address_entity/entityfields/address_ws/displayValueProcess.js +++ /dev/null @@ -1,3 +0,0 @@ -import("WsValidation_lib"); - -WsValidationFieldUtils.wsDisplayValueProcess(WsValidationType.get().TYPE_STREET_NOMINATIM, "$field.ADDRESS"); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/address_ws/documentation.adoc b/entity/Address_entity/entityfields/address_ws/documentation.adoc deleted file mode 100644 index f15b5e5649..0000000000 --- a/entity/Address_entity/entityfields/address_ws/documentation.adoc +++ /dev/null @@ -1,3 +0,0 @@ -This is a field used for the address-webservice. It is only displayed if the webservice is enabled. - -See WsValidation_lib for technical implementation information. \ No newline at end of file diff --git a/entity/Address_entity/entityfields/address_ws/mandatoryProcess.js b/entity/Address_entity/entityfields/address_ws/mandatoryProcess.js deleted file mode 100644 index 305a67d36c..0000000000 --- a/entity/Address_entity/entityfields/address_ws/mandatoryProcess.js +++ /dev/null @@ -1,6 +0,0 @@ -import("system.vars"); -import("AddressEntity_lib"); -import("WsValidation_lib"); -import("system.result"); - -result.object(WsValidationFieldUtils.wsFieldMandatoryProcess(WsValidationType.get().TYPE_STREET_NOMINATIM, AddressEntityValidation.isMandatoryField(vars.get("$field.COUNTRY"), "ADDRESS"))); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/address_ws/onValueChange.js b/entity/Address_entity/entityfields/address_ws/onValueChange.js deleted file mode 100644 index 02aee85018..0000000000 --- a/entity/Address_entity/entityfields/address_ws/onValueChange.js +++ /dev/null @@ -1,3 +0,0 @@ -import("WsValidation_lib"); - -WsValidationFieldUtils.wsOnValueChangeProcess(WsValidationType.get().TYPE_STREET_NOMINATIM, "$field.ADDRESS"); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/address_ws/stateProcess.js b/entity/Address_entity/entityfields/address_ws/stateProcess.js deleted file mode 100644 index 1e05ad82e9..0000000000 --- a/entity/Address_entity/entityfields/address_ws/stateProcess.js +++ /dev/null @@ -1,11 +0,0 @@ -import("system.neon"); -import("system.vars"); -import("system.result"); -import("WsValidation_lib"); - -// The field is only displayed in edit mode because there is the "formattedAddress" field which one shows the fromated address. -// If the field has a Value it would be displayed next to the formattedAddress field in view mode, so in this case the state is set to invisible. -if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_VIEW) - result.string(neon.COMPONENTSTATE_INVISIBLE); -else - result.string(WsValidationFieldUtils.wsFieldStateProcess(WsValidationType.get().TYPE_STREET_NOMINATIM)); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/address_ws/titleProcess.js b/entity/Address_entity/entityfields/address_ws/titleProcess.js deleted file mode 100644 index e05306fb18..0000000000 --- a/entity/Address_entity/entityfields/address_ws/titleProcess.js +++ /dev/null @@ -1,11 +0,0 @@ -import("system.translate"); -import("system.result"); -import("system.vars"); -import("KeywordRegistry_basic"); -import("Keyword_lib"); - -var key = vars.get("$field.ADDR_TYPE"); -if (key == $KeywordRegistry.addressType$post()) -{ - result.string(translate.text("Post office box number")); -} \ No newline at end of file diff --git a/entity/Address_entity/entityfields/address_ws/valueProcess.js b/entity/Address_entity/entityfields/address_ws/valueProcess.js deleted file mode 100644 index ef17405a27..0000000000 --- a/entity/Address_entity/entityfields/address_ws/valueProcess.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.vars"); -import("WsValidation_lib"); - -WsValidationFieldUtils.wsValueProcess(WsValidationType.get().TYPE_STREET_NOMINATIM, "$field.ADDRESS"); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/addresssearch/stateProcess.js b/entity/Address_entity/entityfields/addresssearch/stateProcess.js index 6b661824b3..441e172606 100644 --- a/entity/Address_entity/entityfields/addresssearch/stateProcess.js +++ b/entity/Address_entity/entityfields/addresssearch/stateProcess.js @@ -3,11 +3,7 @@ import("system.neon"); import("system.result"); import("system.vars"); -if (WsValidationUtils.isWsEnabled(WsValidationType.get().TYPE_ADDRESS_NOMINATIM)) -{ - result.string(neon.COMPONENTSTATE_AUTO); -} -else +if (!WsValidationUtils.isWsEnabled(WsValidationType.get().TYPE_ADDRESS_NOMINATIM) || vars.get("$sys.recordstate") == "" || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_VIEW) { result.string(neon.COMPONENTSTATE_INVISIBLE); } \ No newline at end of file diff --git a/entity/Address_entity/entityfields/addresssearch/valueProcess.js b/entity/Address_entity/entityfields/addresssearch/valueProcess.js index e5e514c908..094a9ae8b2 100644 --- a/entity/Address_entity/entityfields/addresssearch/valueProcess.js +++ b/entity/Address_entity/entityfields/addresssearch/valueProcess.js @@ -1,5 +1,8 @@ +import("system.logging"); import("system.result"); import("WsValidation_lib"); import("system.vars"); -result.string(WsValidationUtils.valueFromJSON(vars.get("$this.value"))); \ No newline at end of file +let json = vars.get("$this.value") == null ? vars.get("$field.VALIDATION_RESULT") : vars.get("$this.value"); + +result.string(WsValidationUtils.valueFromJSON(json)); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/buildingno/onValueChange.js b/entity/Address_entity/entityfields/buildingno/onValueChange.js new file mode 100644 index 0000000000..c21d354477 --- /dev/null +++ b/entity/Address_entity/entityfields/buildingno/onValueChange.js @@ -0,0 +1,3 @@ +import("system.neon"); + +neon.setFieldValue("$field.VALIDATION_RESULT", null); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/city/mandatoryProcess.js b/entity/Address_entity/entityfields/city/mandatoryProcess.js deleted file mode 100644 index 255d63dfb4..0000000000 --- a/entity/Address_entity/entityfields/city/mandatoryProcess.js +++ /dev/null @@ -1,6 +0,0 @@ -import("system.vars"); -import("AddressEntity_lib"); -import("system.result"); -import("WsValidation_lib"); - -result.string(WsValidationFieldUtils.mainFieldMandatoryProcess(WsValidationType.get().TYPE_CITY_NOMINATIM, AddressEntityValidation.isMandatoryField(vars.get("$field.COUNTRY")))); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/city/onValueChange.js b/entity/Address_entity/entityfields/city/onValueChange.js new file mode 100644 index 0000000000..c21d354477 --- /dev/null +++ b/entity/Address_entity/entityfields/city/onValueChange.js @@ -0,0 +1,3 @@ +import("system.neon"); + +neon.setFieldValue("$field.VALIDATION_RESULT", null); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/city/stateProcess.js b/entity/Address_entity/entityfields/city/stateProcess.js index fe5eecb4a3..ed5e161dcc 100644 --- a/entity/Address_entity/entityfields/city/stateProcess.js +++ b/entity/Address_entity/entityfields/city/stateProcess.js @@ -1,11 +1,10 @@ import("system.neon"); -import("system.vars"); import("system.result"); -import("WsValidation_lib"); +import("system.vars"); // The field is only displayed in edit mode because there is the "formattedAddress" field which one shows the fromated address. // If the field has a Value it would be displayed next to the formattedAddress field in view mode, so in this case the state is set to invisible. -if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_VIEW) +if (vars.get("$sys.recordstate") == "" || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_VIEW) +{ result.string(neon.COMPONENTSTATE_INVISIBLE); -else - result.string(WsValidationFieldUtils.mainFieldStateProcess(WsValidationType.get().TYPE_CITY_NOMINATIM)); \ No newline at end of file +} \ No newline at end of file diff --git a/entity/Address_entity/entityfields/city_ws/displayValueProcess.js b/entity/Address_entity/entityfields/city_ws/displayValueProcess.js deleted file mode 100644 index 7cbee1a42e..0000000000 --- a/entity/Address_entity/entityfields/city_ws/displayValueProcess.js +++ /dev/null @@ -1,3 +0,0 @@ -import("WsValidation_lib"); - -WsValidationFieldUtils.wsDisplayValueProcess(WsValidationType.get().TYPE_CITY_NOMINATIM, "$field.CITY"); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/city_ws/documentation.adoc b/entity/Address_entity/entityfields/city_ws/documentation.adoc deleted file mode 100644 index f15b5e5649..0000000000 --- a/entity/Address_entity/entityfields/city_ws/documentation.adoc +++ /dev/null @@ -1,3 +0,0 @@ -This is a field used for the address-webservice. It is only displayed if the webservice is enabled. - -See WsValidation_lib for technical implementation information. \ No newline at end of file diff --git a/entity/Address_entity/entityfields/city_ws/mandatoryProcess.js b/entity/Address_entity/entityfields/city_ws/mandatoryProcess.js deleted file mode 100644 index 866716ba42..0000000000 --- a/entity/Address_entity/entityfields/city_ws/mandatoryProcess.js +++ /dev/null @@ -1,6 +0,0 @@ -import("system.vars"); -import("AddressEntity_lib"); -import("WsValidation_lib"); -import("system.result"); - -result.object(WsValidationFieldUtils.wsFieldMandatoryProcess(WsValidationType.get().TYPE_CITY_NOMINATIM, AddressEntityValidation.isMandatoryField(vars.get("$field.COUNTRY"), "CITY"))); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/city_ws/onValueChange.js b/entity/Address_entity/entityfields/city_ws/onValueChange.js deleted file mode 100644 index 5938552243..0000000000 --- a/entity/Address_entity/entityfields/city_ws/onValueChange.js +++ /dev/null @@ -1,3 +0,0 @@ -import("WsValidation_lib"); - -WsValidationFieldUtils.wsOnValueChangeProcess(WsValidationType.get().TYPE_CITY_NOMINATIM, "$field.CITY"); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/city_ws/stateProcess.js b/entity/Address_entity/entityfields/city_ws/stateProcess.js deleted file mode 100644 index 7095f69b78..0000000000 --- a/entity/Address_entity/entityfields/city_ws/stateProcess.js +++ /dev/null @@ -1,9 +0,0 @@ -import("system.neon"); -import("system.vars"); -import("system.result"); -import("WsValidation_lib"); - -if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_VIEW) - result.string(neon.COMPONENTSTATE_INVISIBLE); -else - result.string(WsValidationFieldUtils.wsFieldStateProcess(WsValidationType.get().TYPE_CITY_NOMINATIM)); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/city_ws/valueProcess.js b/entity/Address_entity/entityfields/city_ws/valueProcess.js deleted file mode 100644 index 789a3b3303..0000000000 --- a/entity/Address_entity/entityfields/city_ws/valueProcess.js +++ /dev/null @@ -1,3 +0,0 @@ -import("WsValidation_lib"); - -WsValidationFieldUtils.wsValueProcess(WsValidationType.get().TYPE_CITY_NOMINATIM, "$field.CITY"); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/cityvalidation/children/country_param/valueProcess.js b/entity/Address_entity/entityfields/cityvalidation/children/country_param/valueProcess.js deleted file mode 100644 index 41f3b8dc1a..0000000000 --- a/entity/Address_entity/entityfields/cityvalidation/children/country_param/valueProcess.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.result"); -import("system.vars"); - -result.string(vars.get("$field.COUNTRY")); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/cityvalidation/children/currentvalue_param/valueProcess.js b/entity/Address_entity/entityfields/cityvalidation/children/currentvalue_param/valueProcess.js deleted file mode 100644 index 74c070329c..0000000000 --- a/entity/Address_entity/entityfields/cityvalidation/children/currentvalue_param/valueProcess.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.vars"); -import("system.result"); - -result.string(vars.get("$field.CITY")) \ No newline at end of file diff --git a/entity/Address_entity/entityfields/country/onValueChange.js b/entity/Address_entity/entityfields/country/onValueChange.js new file mode 100644 index 0000000000..c21d354477 --- /dev/null +++ b/entity/Address_entity/entityfields/country/onValueChange.js @@ -0,0 +1,3 @@ +import("system.neon"); + +neon.setFieldValue("$field.VALIDATION_RESULT", null); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/state/onValueChange.js b/entity/Address_entity/entityfields/state/onValueChange.js new file mode 100644 index 0000000000..c21d354477 --- /dev/null +++ b/entity/Address_entity/entityfields/state/onValueChange.js @@ -0,0 +1,3 @@ +import("system.neon"); + +neon.setFieldValue("$field.VALIDATION_RESULT", null); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/streetvalidation/children/city_param/valueProcess.js b/entity/Address_entity/entityfields/streetvalidation/children/city_param/valueProcess.js deleted file mode 100644 index 74c070329c..0000000000 --- a/entity/Address_entity/entityfields/streetvalidation/children/city_param/valueProcess.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.vars"); -import("system.result"); - -result.string(vars.get("$field.CITY")) \ No newline at end of file diff --git a/entity/Address_entity/entityfields/streetvalidation/children/country_param/valueProcess.js b/entity/Address_entity/entityfields/streetvalidation/children/country_param/valueProcess.js deleted file mode 100644 index 41f3b8dc1a..0000000000 --- a/entity/Address_entity/entityfields/streetvalidation/children/country_param/valueProcess.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.result"); -import("system.vars"); - -result.string(vars.get("$field.COUNTRY")); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/streetvalidation/children/currentvalue_param/valueProcess.js b/entity/Address_entity/entityfields/streetvalidation/children/currentvalue_param/valueProcess.js deleted file mode 100644 index 8e559d5146..0000000000 --- a/entity/Address_entity/entityfields/streetvalidation/children/currentvalue_param/valueProcess.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.vars"); -import("system.result"); - -result.string(vars.get("$field.ADDRESS")) \ No newline at end of file diff --git a/entity/Address_entity/entityfields/zip/mandatoryProcess.js b/entity/Address_entity/entityfields/zip/mandatoryProcess.js deleted file mode 100644 index 453956bca6..0000000000 --- a/entity/Address_entity/entityfields/zip/mandatoryProcess.js +++ /dev/null @@ -1,6 +0,0 @@ -import("system.vars"); -import("AddressEntity_lib"); -import("WsValidation_lib"); -import("system.result"); - -result.object(WsValidationFieldUtils.mainFieldMandatoryProcess(WsValidationType.get().TYPE_ZIP_NOMINATIM, AddressEntityValidation.isMandatoryField(vars.get("$field.COUNTRY")))); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/zip/onValueChange.js b/entity/Address_entity/entityfields/zip/onValueChange.js new file mode 100644 index 0000000000..c21d354477 --- /dev/null +++ b/entity/Address_entity/entityfields/zip/onValueChange.js @@ -0,0 +1,3 @@ +import("system.neon"); + +neon.setFieldValue("$field.VALIDATION_RESULT", null); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/zip/stateProcess.js b/entity/Address_entity/entityfields/zip/stateProcess.js index 764f48cdd7..ed5e161dcc 100644 --- a/entity/Address_entity/entityfields/zip/stateProcess.js +++ b/entity/Address_entity/entityfields/zip/stateProcess.js @@ -1,11 +1,10 @@ import("system.neon"); -import("system.vars"); import("system.result"); -import("WsValidation_lib"); +import("system.vars"); // The field is only displayed in edit mode because there is the "formattedAddress" field which one shows the fromated address. // If the field has a Value it would be displayed next to the formattedAddress field in view mode, so in this case the state is set to invisible. -if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_VIEW) +if (vars.get("$sys.recordstate") == "" || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_VIEW) +{ result.string(neon.COMPONENTSTATE_INVISIBLE); -else - result.string(WsValidationFieldUtils.mainFieldStateProcess(WsValidationType.get().TYPE_ZIP_NOMINATIM)); \ No newline at end of file +} \ No newline at end of file diff --git a/entity/Address_entity/entityfields/zip_ws/displayValueProcess.js b/entity/Address_entity/entityfields/zip_ws/displayValueProcess.js deleted file mode 100644 index 3c1fea5790..0000000000 --- a/entity/Address_entity/entityfields/zip_ws/displayValueProcess.js +++ /dev/null @@ -1,3 +0,0 @@ -import("WsValidation_lib"); - -WsValidationFieldUtils.wsDisplayValueProcess(WsValidationType.get().TYPE_ZIP_NOMINATIM); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/zip_ws/documentation.adoc b/entity/Address_entity/entityfields/zip_ws/documentation.adoc deleted file mode 100644 index f15b5e5649..0000000000 --- a/entity/Address_entity/entityfields/zip_ws/documentation.adoc +++ /dev/null @@ -1,3 +0,0 @@ -This is a field used for the address-webservice. It is only displayed if the webservice is enabled. - -See WsValidation_lib for technical implementation information. \ No newline at end of file diff --git a/entity/Address_entity/entityfields/zip_ws/mandatoryProcess.js b/entity/Address_entity/entityfields/zip_ws/mandatoryProcess.js deleted file mode 100644 index 453956bca6..0000000000 --- a/entity/Address_entity/entityfields/zip_ws/mandatoryProcess.js +++ /dev/null @@ -1,6 +0,0 @@ -import("system.vars"); -import("AddressEntity_lib"); -import("WsValidation_lib"); -import("system.result"); - -result.object(WsValidationFieldUtils.mainFieldMandatoryProcess(WsValidationType.get().TYPE_ZIP_NOMINATIM, AddressEntityValidation.isMandatoryField(vars.get("$field.COUNTRY")))); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/zip_ws/onValidation.js b/entity/Address_entity/entityfields/zip_ws/onValidation.js deleted file mode 100644 index bbbf2acbbc..0000000000 --- a/entity/Address_entity/entityfields/zip_ws/onValidation.js +++ /dev/null @@ -1,17 +0,0 @@ -import("WsValidation_lib"); -import("system.translate"); -import("system.result"); -import("system.vars"); -import("PostalAddress_lib"); -import("Entity_lib"); - -if (WsValidationUtils.isWsEnabled(WsValidationType.get().TYPE_ZIP_NOMINATIM)) -{ - var wsData = WsValidationUtils.parseJSONArray(vars.get("$local.value")); - - // If it comes from WS (not null as parsing succeeded), assume it's correct. If not: validate. - if (wsData == null) - { - result.string(AddressValidationUtils.validateZipField(vars.get("$field.COUNTRY"), vars.get("$local.value"))); - } -} \ No newline at end of file diff --git a/entity/Address_entity/entityfields/zip_ws/onValueChange.js b/entity/Address_entity/entityfields/zip_ws/onValueChange.js deleted file mode 100644 index dfd1bbf97d..0000000000 --- a/entity/Address_entity/entityfields/zip_ws/onValueChange.js +++ /dev/null @@ -1,3 +0,0 @@ -import("WsValidation_lib"); - -WsValidationFieldUtils.wsOnValueChangeProcess(WsValidationType.get().TYPE_ZIP_NOMINATIM, "$field.ZIP"); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/zip_ws/stateProcess.js b/entity/Address_entity/entityfields/zip_ws/stateProcess.js deleted file mode 100644 index 624d619e37..0000000000 --- a/entity/Address_entity/entityfields/zip_ws/stateProcess.js +++ /dev/null @@ -1,11 +0,0 @@ -import("system.neon"); -import("system.vars"); -import("system.result"); -import("WsValidation_lib"); - -// The field is only displayed in edit mode because there is the "formattedAddress" field which one shows the fromated address. -// If the field has a Value it would be displayed next to the formattedAddress field in view mode, so in this case the state is set to invisible. -if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_VIEW) - result.string(neon.COMPONENTSTATE_INVISIBLE); -else - result.string(WsValidationFieldUtils.wsFieldStateProcess(WsValidationType.get().TYPE_ZIP_NOMINATIM)); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/zip_ws/valueProcess.js b/entity/Address_entity/entityfields/zip_ws/valueProcess.js deleted file mode 100644 index 0ecfd8b06e..0000000000 --- a/entity/Address_entity/entityfields/zip_ws/valueProcess.js +++ /dev/null @@ -1,3 +0,0 @@ -import("WsValidation_lib"); - -WsValidationFieldUtils.wsValueProcess(WsValidationType.get().TYPE_ZIP_NOMINATIM, "$field.ZIP"); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/zipvalidation/children/country_param/valueProcess.js b/entity/Address_entity/entityfields/zipvalidation/children/country_param/valueProcess.js deleted file mode 100644 index 41f3b8dc1a..0000000000 --- a/entity/Address_entity/entityfields/zipvalidation/children/country_param/valueProcess.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.result"); -import("system.vars"); - -result.string(vars.get("$field.COUNTRY")); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/zipvalidation/children/currentvalue_param/valueProcess.js b/entity/Address_entity/entityfields/zipvalidation/children/currentvalue_param/valueProcess.js deleted file mode 100644 index d9e7983e6f..0000000000 --- a/entity/Address_entity/entityfields/zipvalidation/children/currentvalue_param/valueProcess.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.vars"); -import("system.result"); - -result.string(vars.get("$field.ZIP")) \ No newline at end of file diff --git a/entity/Address_entity/recordcontainers/db/onDBInsert.js b/entity/Address_entity/recordcontainers/db/onDBInsert.js index b088c7a1b3..80f13d5246 100644 --- a/entity/Address_entity/recordcontainers/db/onDBInsert.js +++ b/entity/Address_entity/recordcontainers/db/onDBInsert.js @@ -59,11 +59,19 @@ var address = new AddressObject(rowdata["ADDRESS.ADDRESS"], rowdata["ADDRESS.BUI var addressLocation = new LocationFinder().getGeoLocation(address); if (addressLocation) { + let fieldsValues = { + "LAT": addressLocation.lat, + "LON": addressLocation.lon + }; + + if (rowdata["ADDRESS.VALIDATION_RESULT"] === null) + { + fieldsValues["VALIDATION_RESULT"] = addressLocation.requestResult; + } + newWhere("ADDRESS.ADDRESSID", "$local.uid") - .updateFields({ - "LAT": addressLocation.lat, - "LON": addressLocation.lon - }); + .updateFields(fieldsValues); + } WorkflowSignalSender.inserted(); \ No newline at end of file diff --git a/entity/Address_entity/recordcontainers/db/onDBUpdate.js b/entity/Address_entity/recordcontainers/db/onDBUpdate.js index 8ce04bc6f3..a1868fd1d6 100644 --- a/entity/Address_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/Address_entity/recordcontainers/db/onDBUpdate.js @@ -1,3 +1,4 @@ +import("WsValidation_lib"); import("Workflow_lib"); import("Sql_lib"); import("Location_lib"); @@ -27,11 +28,20 @@ if (isAddressChanged) var addressLocation = new LocationFinder().getGeoLocation(address); if (addressLocation) { + let fieldsValues = {}; + if (isAddressChanged) + { + fieldsValues["LAT"] = addressLocation.lat; + fieldsValues["LON"] = addressLocation.lon; + } + + if (rowdata["ADDRESS.VALIDATION_RESULT"] === null) + { + fieldsValues["VALIDATION_RESULT"] = addressLocation.requestResult; + } + newWhere("ADDRESS.ADDRESSID", "$local.uid") - .updateFields({ - "LAT": addressLocation.lat, - "LON": addressLocation.lon - }); + .updateFields(fieldsValues); } } diff --git a/entity/Address_entity/recordcontainers/db/recordfieldmappings/addr_type.displayvalue/expression.js b/entity/Address_entity/recordcontainers/db/recordfieldmappings/addr_type.displayvalue/expression.js index 34af55ea17..cbce8488e0 100644 --- a/entity/Address_entity/recordcontainers/db/recordfieldmappings/addr_type.displayvalue/expression.js +++ b/entity/Address_entity/recordcontainers/db/recordfieldmappings/addr_type.displayvalue/expression.js @@ -1,6 +1,10 @@ import("system.result"); import("Keyword_lib"); import("KeywordRegistry_basic"); +import("Sql_lib"); -var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.addressType(), "ADDRESS.ADDR_TYPE"); -result.string(sql); +let sqlMasking = new SqlMaskingUtils(); + +let sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.addressType(), "ADDRESS.ADDR_TYPE"); +let validationICON = SqlBuilder.caseWhen(newWhere("ADDRESS.VALIDATION_RESULT is null")).thenString(" !").elseString("").toString(); +result.string(sqlMasking.concatWithSeparator([sql, validationICON], "", false)); diff --git a/neonView/AddressList_view/AddressList_view.aod b/neonView/AddressList_view/AddressList_view.aod index a3e85b279b..958e360b91 100644 --- a/neonView/AddressList_view/AddressList_view.aod +++ b/neonView/AddressList_view/AddressList_view.aod @@ -30,26 +30,14 @@ <entityField>AddressSearch</entityField> <fullWidth v="true" /> </neonTitledListTableColumn> - <neonTitledListTableColumn> - <name>e809ff52-e8f7-443a-bf34-7e36daa2de42</name> - <entityField>Zip_ws</entityField> - </neonTitledListTableColumn> <neonTitledListTableColumn> <name>0336ea99-c4a1-4f39-b5aa-a520a7dcbaab</name> <entityField>ZIP</entityField> </neonTitledListTableColumn> - <neonTitledListTableColumn> - <name>69734ec3-b7a6-4efd-8dab-5059975fab70</name> - <entityField>City_ws</entityField> - </neonTitledListTableColumn> <neonTitledListTableColumn> <name>12727b21-0359-4430-a9c2-54eb48e2e864</name> <entityField>CITY</entityField> </neonTitledListTableColumn> - <neonTitledListTableColumn> - <name>2e48e6ac-a524-49e7-ad71-a29f1dd68891</name> - <entityField>Address_ws</entityField> - </neonTitledListTableColumn> <neonTitledListTableColumn> <name>4e5e6a4f-f43e-4861-a912-fb05e576f960</name> <entityField>ADDRESS</entityField> diff --git a/neonView/AddressOrgMultiEdit_view/AddressOrgMultiEdit_view.aod b/neonView/AddressOrgMultiEdit_view/AddressOrgMultiEdit_view.aod index fa53f54f1a..b695b472b6 100644 --- a/neonView/AddressOrgMultiEdit_view/AddressOrgMultiEdit_view.aod +++ b/neonView/AddressOrgMultiEdit_view/AddressOrgMultiEdit_view.aod @@ -13,6 +13,11 @@ <entityField>#ENTITY</entityField> <title>Company address</title> <columns> + <neonGenericMultipleTableColumn> + <name>00300f6f-ac45-4daa-9693-6452da972403</name> + <entityField>AddressSearch</entityField> + <fullWidth v="true" /> + </neonGenericMultipleTableColumn> <neonGenericMultipleTableColumn> <name>2aebe24e-875a-4c57-8461-16da46d6f080</name> <entityField>ADDR_TYPE</entityField> @@ -21,31 +26,14 @@ <name>435f10b8-b6ef-4187-bffc-fc6104a6130c</name> <entityField>COUNTRY</entityField> </neonGenericMultipleTableColumn> - <neonGenericMultipleTableColumn> - <name>00300f6f-ac45-4daa-9693-6452da972403</name> - <entityField>AddressSearch</entityField> - <fullWidth v="true" /> - </neonGenericMultipleTableColumn> - <neonGenericMultipleTableColumn> - <name>b9379fcc-3212-488b-8f90-cade09c00f3c</name> - <entityField>Zip_ws</entityField> - </neonGenericMultipleTableColumn> <neonGenericMultipleTableColumn> <name>c1372a93-cf83-4c55-90e6-3b6b352abebf</name> <entityField>ZIP</entityField> </neonGenericMultipleTableColumn> - <neonGenericMultipleTableColumn> - <name>5a0d723a-8531-4330-957b-11a1be9d7eab</name> - <entityField>City_ws</entityField> - </neonGenericMultipleTableColumn> <neonGenericMultipleTableColumn> <name>2e7ba632-36ad-4852-bcca-d75bcf3f7de1</name> <entityField>CITY</entityField> </neonGenericMultipleTableColumn> - <neonGenericMultipleTableColumn> - <name>2c104842-2ca1-408d-81d6-e998c0a562f2</name> - <entityField>Address_ws</entityField> - </neonGenericMultipleTableColumn> <neonGenericMultipleTableColumn> <name>ac71d5eb-7ce7-41a0-91aa-5594f2238788</name> <entityField>ADDRESS</entityField> diff --git a/neonView/AddressValidationLookup_view/AddressValidationLookup_view.aod b/neonView/AddressValidationLookup_view/AddressValidationLookup_view.aod index c64330a9cb..3b1f25f260 100644 --- a/neonView/AddressValidationLookup_view/AddressValidationLookup_view.aod +++ b/neonView/AddressValidationLookup_view/AddressValidationLookup_view.aod @@ -12,6 +12,14 @@ <name>DataTable</name> <entityField>#ENTITY</entityField> <columns> + <neonTableColumn> + <name>7ec03f39-6acd-40ea-9912-9e60e092615b</name> + <entityField>BUILDINGNO</entityField> + </neonTableColumn> + <neonTableColumn> + <name>a272c3cb-7bbf-41a4-9490-884c2f449b40</name> + <entityField>STREET_AND_BUILDINGNO</entityField> + </neonTableColumn> <neonTableColumn> <name>a8787cc8-57a2-4cd5-903e-da14924a9052</name> <entityField>ZIP</entityField> @@ -20,22 +28,18 @@ <name>fb715731-9162-405e-b2e2-6c20921f026f</name> <entityField>CITY</entityField> </neonTableColumn> - <neonTableColumn> - <name>05bb9d3b-0e90-4a1a-bfe8-03b7dab6ed01</name> - <entityField>REGION</entityField> - </neonTableColumn> <neonTableColumn> <name>22779be5-4111-49c2-8821-0ec02cca40bb</name> <entityField>STATE</entityField> </neonTableColumn> - <neonTableColumn> - <name>a272c3cb-7bbf-41a4-9490-884c2f449b40</name> - <entityField>STREET_AND_BUILDINGNO</entityField> - </neonTableColumn> <neonTableColumn> <name>d32d92bf-db7d-443f-b911-6731ea89cf3b</name> <entityField>COUNTRY</entityField> </neonTableColumn> + <neonTableColumn> + <name>05bb9d3b-0e90-4a1a-bfe8-03b7dab6ed01</name> + <entityField>REGION</entityField> + </neonTableColumn> </columns> </tableViewTemplate> </children> diff --git a/neonView/AdressMultiEdit_view/AdressMultiEdit_view.aod b/neonView/AdressMultiEdit_view/AdressMultiEdit_view.aod index 3bcfaf74c4..d7483c3512 100644 --- a/neonView/AdressMultiEdit_view/AdressMultiEdit_view.aod +++ b/neonView/AdressMultiEdit_view/AdressMultiEdit_view.aod @@ -12,6 +12,11 @@ <name>MultipleEdit</name> <entityField>#ENTITY</entityField> <columns> + <neonGenericMultipleTableColumn> + <name>00300f6f-ac45-4daa-9693-6452da972403</name> + <entityField>AddressSearch</entityField> + <fullWidth v="true" /> + </neonGenericMultipleTableColumn> <neonGenericMultipleTableColumn> <name>2aebe24e-875a-4c57-8461-16da46d6f080</name> <entityField>ADDR_TYPE</entityField> @@ -20,31 +25,14 @@ <name>435f10b8-b6ef-4187-bffc-fc6104a6130c</name> <entityField>COUNTRY</entityField> </neonGenericMultipleTableColumn> - <neonGenericMultipleTableColumn> - <name>00300f6f-ac45-4daa-9693-6452da972403</name> - <entityField>AddressSearch</entityField> - <fullWidth v="true" /> - </neonGenericMultipleTableColumn> - <neonGenericMultipleTableColumn> - <name>b9379fcc-3212-488b-8f90-cade09c00f3c</name> - <entityField>Zip_ws</entityField> - </neonGenericMultipleTableColumn> <neonGenericMultipleTableColumn> <name>c1372a93-cf83-4c55-90e6-3b6b352abebf</name> <entityField>ZIP</entityField> </neonGenericMultipleTableColumn> - <neonGenericMultipleTableColumn> - <name>5a0d723a-8531-4330-957b-11a1be9d7eab</name> - <entityField>City_ws</entityField> - </neonGenericMultipleTableColumn> <neonGenericMultipleTableColumn> <name>2e7ba632-36ad-4852-bcca-d75bcf3f7de1</name> <entityField>CITY</entityField> </neonGenericMultipleTableColumn> - <neonGenericMultipleTableColumn> - <name>2c104842-2ca1-408d-81d6-e998c0a562f2</name> - <entityField>Address_ws</entityField> - </neonGenericMultipleTableColumn> <neonGenericMultipleTableColumn> <name>ac71d5eb-7ce7-41a0-91aa-5594f2238788</name> <entityField>ADDRESS</entityField> diff --git a/preferences/_____PREFERENCES_PROJECT/_____PREFERENCES_PROJECT.aod b/preferences/_____PREFERENCES_PROJECT/_____PREFERENCES_PROJECT.aod index 8e1dc8e208..2e5b1523b1 100644 --- a/preferences/_____PREFERENCES_PROJECT/_____PREFERENCES_PROJECT.aod +++ b/preferences/_____PREFERENCES_PROJECT/_____PREFERENCES_PROJECT.aod @@ -115,21 +115,12 @@ </customBooleanProperty> <customStringProperty> <name>nominatim.url</name> - <property>https://nom.adito.de/search.php</property> + <property>https://nom.adito.cloud/search.php</property> </customStringProperty> <customStringProperty> <name>nominatim.user</name> <property>aditouser</property> </customStringProperty> - <customIntegerProperty> - <name>duplicates.dataBlockSize</name> - <property v="5000" /> - </customIntegerProperty> - <customBooleanProperty> - <name>ai.salesprojectProbability</name> - <description></description> - <property v="false" /> - </customBooleanProperty> <customPasswordProperty> <name>nominatim.pw</name> <description></description> @@ -139,6 +130,15 @@ <name>nominatim.resultLimit</name> <description>Amount of rows returned by the address search. Default is 10, maximum is 50.</description> </customIntegerProperty> + <customJDitoProperty> + <name>nominatim.filterKeys</name> + <description></description> + <property>%aditoprj%/preferences/_____PREFERENCES_PROJECT/customproperties/nominatim.filterkeys/property.js</property> + </customJDitoProperty> + <customIntegerProperty> + <name>duplicates.dataBlockSize</name> + <property v="5000" /> + </customIntegerProperty> <customBooleanProperty> <name>AD.active</name> <description></description> @@ -187,6 +187,11 @@ <description>Default VAT in percent</description> <property>19</property> </customStringProperty> + <customBooleanProperty> + <name>ai.salesprojectProbability</name> + <description></description> + <property v="false" /> + </customBooleanProperty> <customStringProperty> <name>bulkmail.fileStorage</name> <description>Save Location for send Mails. Path is relative to Serverpath</description> diff --git a/preferences/_____PREFERENCES_PROJECT/customproperties/nominatim.filterkeys/property.js b/preferences/_____PREFERENCES_PROJECT/customproperties/nominatim.filterkeys/property.js new file mode 100644 index 0000000000..c0996e0881 --- /dev/null +++ b/preferences/_____PREFERENCES_PROJECT/customproperties/nominatim.filterkeys/property.js @@ -0,0 +1 @@ +["building", "office", "townhall"] \ No newline at end of file diff --git a/process/Location_lib/process.js b/process/Location_lib/process.js index e57ae643c7..98a3aba621 100644 --- a/process/Location_lib/process.js +++ b/process/Location_lib/process.js @@ -1,3 +1,5 @@ +import("Sql_lib"); +import("system.db"); import("system.logging"); import("Address_lib"); import("Util_lib"); @@ -170,12 +172,12 @@ function LocationFinder () { this._minAccuracy = AddressParts.ZIPCODE(); this._accuracyOrder = [ - AddressParts.BUILDINGNO(), - AddressParts.ADDRESS(), - AddressParts.ZIPCODE(), - AddressParts.CITY(), - AddressParts.STATE(), - AddressParts.COUNTRY() + AddressParts.BUILDINGNO(), + AddressParts.ADDRESS(), + AddressParts.ZIPCODE(), + AddressParts.CITY(), + AddressParts.STATE(), + AddressParts.COUNTRY() ]; this._getLocationFn = LocationFinder._getLocationWithNominatim; this._isServiceAvailable = WsValidationUtils.isWsEnabled("TYPE_FULLADDRESS_NOMINATIM"); @@ -254,7 +256,7 @@ LocationFinder.prototype.isEnabled = function () * or the min accuracy has been exceeded (the default min accuracy is zipCode). * * @param {AddressObject} pAddress an object containing the address data - * @return {Object} object with the properties "lat", "lon" and "accuracy", or null if the address could not be found + * @return {Object} object with the properties "lat", "lon", "requestResult" and "accuracy", or null if the address could not be found */ LocationFinder.prototype.getGeoLocation = function (pAddress) { @@ -279,6 +281,7 @@ LocationFinder.prototype.getGeoLocation = function (pAddress) return { lat: location.lat, lon: location.lon, + requestResult: JSON.stringify(location), accuracy: mostAccurateField }; } @@ -286,4 +289,50 @@ LocationFinder.prototype.getGeoLocation = function (pAddress) searchAddress[mostAccurateField] = null; } return null; +} + +/** + * Update LAT, LON and VALIDATION of the given Addresses + * This function is call-by-reference and the errors of the updates will be returned by pMalformedAddressData. + * + * @param {pMalformedAddressData} to collect the errors of the updates + * @param {pAddresses} pAddress an object containing the address data + * + * @return {void} + */ +LocationFinder.PagingFunctionSetLocations = function (pMalformedAddressData, pAddresses) +{ + var locationUpdates = []; + pAddresses.forEach(function ([addressId, address, buildingno, zip, city, country, state, validationResult]) + { + var addressData = new AddressObject(address, buildingno, zip, city, country, state); + try + { + var location = locationSearch.getGeoLocation(addressData); + + if (location) + { + let fields = ["LAT", "LON"]; + let values = [location.lat, location.lon]; + + if (Utils.isNullOrEmpty(validationResult)) + { + fields.push("VALIDATION_RESULT"); + values.push(location.requestResult); + } + + locationUpdates.push(["ADDRESS", fields, null, values, + newWhere("ADDRESS.ADDRESSID", addressId).buildCondition()]); + } + } + catch (pException) + { + pMalformedAddressData.push(addressId); + } + }); + + if (locationUpdates.length > 0) + { + db.updates(locationUpdates); + } } \ No newline at end of file diff --git a/process/WsValidation_lib/process.js b/process/WsValidation_lib/process.js index 817a2a1841..44b4967131 100644 --- a/process/WsValidation_lib/process.js +++ b/process/WsValidation_lib/process.js @@ -78,58 +78,65 @@ WsValidationType.get = function(pKey) } } - function _processNominatimAddressLookup(pWsResult, pValue) - { - if (pWsResult != null) + function _processNominatimAddressLookup(pWsResult, pValue) { - return pWsResult.map(function(pPlaceData) + let filterKeys = JSON.parse(project.getPreferenceValue("custom.nominatim.filterKeys", "[]")); + + let filteredResults = []; + if (pWsResult != null) { - if (pPlaceData.address == undefined) - pPlaceData.address = {}; + pWsResult.forEach(function(pPlaceData) + { + if (Utils.isEmpty(filterKeys) || filterKeys.indexOf(pPlaceData.osm_type) > -1 || filterKeys.indexOf(pPlaceData.type) > -1 || filterKeys.indexOf(pPlaceData["class"]) > -1) + { + if (pPlaceData.address == undefined) + pPlaceData.address = {}; - var city = pPlaceData.address.town - || pPlaceData.address.city - || pPlaceData.address.village - || pPlaceData.address.hamlet; + var city = pPlaceData.address.town + || pPlaceData.address.city + || pPlaceData.address.village + || pPlaceData.address.hamlet; - var cityext = pPlaceData.address.suburb - || pPlaceData.address.city_district; + var cityext = pPlaceData.address.suburb + || pPlaceData.address.city_district; - var road = pPlaceData.address.road - || pPlaceData.address.street - || pPlaceData.address.path - || pPlaceData.address.address27; + var road = pPlaceData.address.road + || pPlaceData.address.street + || pPlaceData.address.path + || pPlaceData.address.address27; - return { - placeId: pPlaceData.place_id, - value: pValue, - displayName: pPlaceData.display_name, - zipCode: pPlaceData.address.postcode, - city: city, - cityExt: cityext, - country: pPlaceData.address.country_code.toUpperCase(), //4 - state: pPlaceData.address.state, - road: road, //8 - buildingNo: pPlaceData.address.house_number, - lat: pPlaceData.lat, - lon: pPlaceData.lon - }; - }); - } + filteredResults.push({ + placeId: pPlaceData.place_id, + value: pValue, + displayName: pPlaceData.display_name, + zipCode: pPlaceData.address.postcode, + city: city, + cityExt: cityext, + country: pPlaceData.address.country_code.toUpperCase(), //4 + state: pPlaceData.address.state, + road: road, //8 + buildingNo: pPlaceData.address.house_number, + lat: pPlaceData.lat, + lon: pPlaceData.lon + }); + } + + }); + } - return []; - } + return filteredResults; + } - function _processNominatimAddressLocation (pWsResult) - { - if (pWsResult == null || pWsResult.length === 0) - return null; + function _processNominatimAddressLocation (pWsResult, pValue) + { + pWsResult = _processNominatimAddressLookup(pWsResult, pValue); + if (Utils.isNullOrEmpty(pWsResult)) + { + return null; + } - return { - lat: pWsResult[0].lat, - lon: pWsResult[0].lon - }; - } + return pWsResult[0]; + } /** * request using a custom webservice @@ -278,6 +285,7 @@ WsValidationType.get = function(pKey) if (!Utils.isNullOrEmpty(pParameters)) { var nominatimRequest = new NominatimRequest(url) + .includeAddressDetails() .setResultLimit(1) .setParameters(pParameters); @@ -361,7 +369,8 @@ WsValidationUtils.setAddressFields = function(pJSON) //"$field.DISTRICT": data.district, not needed currently "$field.STATE": data.state, "$field.ADDRESS": data.road, - "$field.BUILDINGNO": data.buildingNo + "$field.BUILDINGNO": data.buildingNo, + "$field.VALIDATION_RESULT": JSON.stringify(data) } for (let field in toSet) @@ -383,8 +392,10 @@ WsValidationUtils.setAddressFields = function(pJSON) WsValidationUtils.valueFromJSON = function(pJSON) { var data = WsValidationUtils.parseJSONArray(pJSON); - if (data == null) + if (Utils.isNullOrEmpty(data) || Utils.isNullOrEmpty(data.value)) + { return null; + } return data.value; } diff --git a/process/setMissingAddressLocations_serverProcess/process.js b/process/setMissingAddressLocations_serverProcess/process.js index 7cef5bfae4..dd23bc7aee 100644 --- a/process/setMissingAddressLocations_serverProcess/process.js +++ b/process/setMissingAddressLocations_serverProcess/process.js @@ -10,34 +10,13 @@ var malformedAddressData = []; if (locationSearch.isEnabled()) { - newSelect("ADDRESSID, ADDRESS, BUILDINGNO, ZIP, CITY, COUNTRY, PROVINCE") + newSelect("ADDRESSID, ADDRESS, BUILDINGNO, ZIP, CITY, COUNTRY, PROVINCE, VALIDATION_RESULT") .from("ADDRESS") .where("ADDRESS.LAT is null") .or("ADDRESS.LON is null") .pageSize(400) - .forEachPage(function (addresses) - { - var locationUpdates = []; - addresses.forEach(function ([addressId, address, buildingno, zip, city, country, state]) - { - var addressData = new AddressObject(address, buildingno, zip, city, country, state); - - try - { - var location = locationSearch.getGeoLocation(addressData); - if (location) - { - locationUpdates.push(["ADDRESS", ["LAT", "LON"], null, [location.lat, location.lon], - newWhere("ADDRESS.ADDRESSID", addressId).buildCondition()]); - } - } - catch (pException) - { - malformedAddressData.push(addressId); - } - }); - if (locationUpdates.length > 0) - db.updates(locationUpdates); + .forEachPage(function (pAddresses) { + LocationFinder.PagingFunctionSetLocations(malformedAddressData, pAddresses); }); if (Utils.isNotNullOrEmptyString(malformedAddressData)) { diff --git a/process/updateAllAddressLocations_serverProcess/process.js b/process/updateAllAddressLocations_serverProcess/process.js index 6239ba470a..9f53d5000b 100644 --- a/process/updateAllAddressLocations_serverProcess/process.js +++ b/process/updateAllAddressLocations_serverProcess/process.js @@ -10,34 +10,13 @@ var malformedAddressData = []; if (locationSearch.isEnabled()) { - newSelect("ADDRESSID, ADDRESS, BUILDINGNO, ZIP, CITY, COUNTRY, PROVINCE") + newSelect("ADDRESSID, ADDRESS, BUILDINGNO, ZIP, CITY, COUNTRY, PROVINCE, VALIDATION_RESULT") .from("ADDRESS") .pageSize(400) - .forEachPage(function (addresses) - { - var locationUpdates = []; - addresses.forEach(function ([addressId, address, buildingno, zip, city, country, state]) - { - var addressData = new AddressObject(address, buildingno, zip, city, country, state); - try - { - var location = locationSearch.getGeoLocation(addressData); - - if (location) - { - locationUpdates.push(["ADDRESS", ["LAT", "LON"], null, [location.lat, location.lon], - newWhere("ADDRESS.ADDRESSID", addressId).buildCondition()]); - } - } - catch (pException) - { - malformedAddressData.push(addressId); - } - }); - if (locationUpdates.length > 0) - db.updates(locationUpdates); + .forEachPage(function (pAddresses) { + LocationFinder.PagingFunctionSetLocations(malformedAddressData, pAddresses); }); - if (Utils.isNotNullOrEmptyString(malformedAddressData)) + if (!Utils.isNullOrEmpty(malformedAddressData)) { errMsg = "updateAllAddressLocations_serverProcess: Something went wrong, during updating address locations, with the following uids: "; malformedAddressData.forEach(function(pMalformedData) -- GitLab