diff --git a/entity/AddressValidation_entity/AddressValidation_entity.aod b/entity/AddressValidation_entity/AddressValidation_entity.aod index 0f243581fef1c1d06b617bce59b7ee8239e875ac..824e75c1dedc077e9fda247e754b06b3b48c7900 100644 --- a/entity/AddressValidation_entity/AddressValidation_entity.aod +++ b/entity/AddressValidation_entity/AddressValidation_entity.aod @@ -96,6 +96,11 @@ </entityParameter> </children> </entityProvider> + <entityParameter> + <name>CurrentValue_param</name> + <expose v="true" /> + <description>PARAMETER</description> + </entityParameter> </entityFields> <recordContainers> <jDitoRecordContainer> diff --git a/entity/AddressValidation_entity/recordcontainers/jdito/contentProcess.js b/entity/AddressValidation_entity/recordcontainers/jdito/contentProcess.js index b816f84362c53ed72404ba157b67b711b55c5283..513b5ed01505858c06ef875861b18a726acc5560 100644 --- a/entity/AddressValidation_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/AddressValidation_entity/recordcontainers/jdito/contentProcess.js @@ -17,6 +17,9 @@ if(sysFilter.filter != null) { filter = JSON.parse(sysFilter.filter).childs[0].value; } +if (!filter && vars.exists("$param.CurrentValue_param") && vars.get("$param.CurrentValue_param")) + filter = vars.get("$param.CurrentValue_param"); + var foundAddresses = AddressValidationUtils.validate(filter, type, country); result.object(foundAddresses); \ No newline at end of file diff --git a/entity/Address_entity/Address_entity.aod b/entity/Address_entity/Address_entity.aod index cf8f5b77c530176b0dcb06a5db6f52259dab8ddd..8edd3abfe509ff60a86b5134ee6acbeb239469af 100644 --- a/entity/Address_entity/Address_entity.aod +++ b/entity/Address_entity/Address_entity.aod @@ -313,6 +313,10 @@ <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> @@ -323,6 +327,16 @@ <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> </entityFields> <recordContainers> diff --git a/entity/Address_entity/entityfields/cityvalidation/children/country_param/valueProcess.js b/entity/Address_entity/entityfields/cityvalidation/children/country_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..bece889b8e3ca6d6141ac5a750d0d068b23dc85a --- /dev/null +++ b/entity/Address_entity/entityfields/cityvalidation/children/country_param/valueProcess.js @@ -0,0 +1,4 @@ +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 new file mode 100644 index 0000000000000000000000000000000000000000..74c070329cde0f8edeabd0e80677b4105b3e256e --- /dev/null +++ b/entity/Address_entity/entityfields/cityvalidation/children/currentvalue_param/valueProcess.js @@ -0,0 +1,4 @@ +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/zipvalidation/children/currentvalue_param/valueProcess.js b/entity/Address_entity/entityfields/zipvalidation/children/currentvalue_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..d9e7983e6f2422f678b9a024ace857de80d1dc1c --- /dev/null +++ b/entity/Address_entity/entityfields/zipvalidation/children/currentvalue_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string(vars.get("$field.ZIP")) \ No newline at end of file diff --git a/entity/Communication_entity/entityfields/addr/onValueChange.js b/entity/Communication_entity/entityfields/addr/onValueChange.js index c6bc6676a2735c9892523a68b9719a4949cbf414..61a183ab8b75c224c87b82baa26ea004215e1f95 100644 --- a/entity/Communication_entity/entityfields/addr/onValueChange.js +++ b/entity/Communication_entity/entityfields/addr/onValueChange.js @@ -6,6 +6,8 @@ import("KeywordRegistry_basic"); import("system.neon"); import("PostalAddress_lib"); +// TODO: put into AddressValidation_lib + var addr = vars.get("$this.value"); if (addr) diff --git a/preferences/_____PREFERENCES_PROJECT/_____PREFERENCES_PROJECT.aod b/preferences/_____PREFERENCES_PROJECT/_____PREFERENCES_PROJECT.aod index 2e627c2e517e6de8e51a348a72ea341be0d36ca5..50084ef32801588ee4d23d333e3b5f433f7aaa0f 100644 --- a/preferences/_____PREFERENCES_PROJECT/_____PREFERENCES_PROJECT.aod +++ b/preferences/_____PREFERENCES_PROJECT/_____PREFERENCES_PROJECT.aod @@ -33,4 +33,18 @@ <indexsearchIncrementingIndexerInterval v="1000" /> <indexsearchIncrementingIndexerBunchSize v="250" /> <indexsearchMaximumHits v="50000" /> + <customProperties> + <customStringProperty> + <name>addressValidation.url</name> + <property>https://services.aditosoftware.local/services/rest/ws_checkAddress</property> + </customStringProperty> + <customStringProperty> + <name>addressValidation.user</name> + <property>Admin</property> + </customStringProperty> + <customStringProperty> + <name>addressValidation.pw</name> + <property>a</property> + </customStringProperty> + </customProperties> </preferences> diff --git a/process/AddressValidation_lib/process.js b/process/AddressValidation_lib/process.js index 38e23ed26f06145485c267f0f5b10309b47668cd..9f0ab520f0b29b8cf434c8549c4ac9b5519712de 100644 --- a/process/AddressValidation_lib/process.js +++ b/process/AddressValidation_lib/process.js @@ -1,3 +1,5 @@ +import("system.logging"); +import("system.project"); import("system.vars"); import("system.neon"); import("system.net"); @@ -61,10 +63,9 @@ function AddressValidationUtils() {} */ AddressValidationUtils.validate = function(pValue, pType, pCountry) { - // TODO: Options for url, user, pw - var userName = "Admin"; - var pw = "a"; - var url = "https://services.aditosoftware.local/services/rest/ws_checkAddress"; + var userName = project.getPreferenceValue("custom.addressValidation.user"); + var pw = project.getPreferenceValue("custom.addressValidation.pw"); + var url = project.getPreferenceValue("custom.addressValidation.url"); var actionType = "GET"; // get AddressValidationType-Object if it is only the key