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

Merge branch 'AddressValidation' into 'master'

Address validation

See merge request xrm/basic!61
parents 4f21705d f2b4aff3
No related branches found
No related tags found
No related merge requests found
Showing
with 125 additions and 59 deletions
......@@ -2,6 +2,7 @@
<entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.11" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.11">
<name>AddressValidation_entity</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<documentation>%aditoprj%/entity/AddressValidation_entity/documentation.adoc</documentation>
<contentTitleProcess>%aditoprj%/entity/AddressValidation_entity/contentTitleProcess.js</contentTitleProcess>
<recordContainer>jdito</recordContainer>
<entityFields>
......
See WsValidation_lib
\ No newline at end of file
import("system.logging");
import("system.result");
import("WsValidation_lib");
import("system.vars");
var type = "";
if (vars.exists("$param.Type_param") && vars.get("$param.Type_param"))
type = vars.get("$param.Type_param");
if (vars.get("$local.idvalues") != null)
{
// extract data from uid as it already contains everything
result.object(vars.get("$local.idvalues").map(function(pId)
{
var data = WsValidationUtils.parseJSONArray(pId)
return [
pId,
].concat(data.slice(0, -1))
}))
}
else
{
var type = "";
if (vars.exists("$param.Type_param") && vars.get("$param.Type_param"))
type = vars.get("$param.Type_param");
var country = "";
if (vars.exists("$param.Country_param") && vars.get("$param.Country_param"))
country = vars.get("$param.Country_param");
var country = "";
if (vars.exists("$param.Country_param") && vars.get("$param.Country_param"))
country = vars.get("$param.Country_param");
var city = "";
if (vars.exists("$param.City_param") && vars.get("$param.City_param"))
city = vars.get("$param.City_param");
var city = "";
if (vars.exists("$param.City_param") && vars.get("$param.City_param"))
city = vars.get("$param.City_param");
// get the value typed by the user
var filter = "";
var localFilter = vars.get("$local.filter");
// get the value typed by the user
var filter = "";
var localFilter = vars.get("$local.filter");
if(localFilter.filter != null) {
filter = localFilter.filter.childs[0].value;
}
if(localFilter.filter != null) {
filter = localFilter.filter.childs[0].value;
}
if (!filter && vars.exists("$param.CurrentValue_param") && vars.get("$param.CurrentValue_param"))
filter = vars.get("$param.CurrentValue_param");
if (!filter && vars.exists("$param.CurrentValue_param") && vars.get("$param.CurrentValue_param"))
filter = vars.get("$param.CurrentValue_param");
var foundAddresses = WsValidationUtils.validate(filter, type, country, city);
result.object(foundAddresses.map(function(row) {
return row.concat([filter])
}));
\ No newline at end of file
var foundAddresses = WsValidationUtils.validate(filter, type, country, city);
result.object(foundAddresses.map(function(row) {
return row.concat([filter])
}));
}
......@@ -14,6 +14,7 @@
<title>Street</title>
<mandatoryProcess>%aditoprj%/entity/Address_entity/entityfields/address/mandatoryProcess.js</mandatoryProcess>
<textInputAllowed v="true" />
<stateProcess>%aditoprj%/entity/Address_entity/entityfields/address/stateProcess.js</stateProcess>
<valueProcess>%aditoprj%/entity/Address_entity/entityfields/address/valueProcess.js</valueProcess>
<displayValueProcess>%aditoprj%/entity/Address_entity/entityfields/address/displayValueProcess.js</displayValueProcess>
<onValueChange>%aditoprj%/entity/Address_entity/entityfields/address/onValueChange.js</onValueChange>
......@@ -47,15 +48,11 @@
</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" />
<valueProcess>%aditoprj%/entity/Address_entity/entityfields/city/valueProcess.js</valueProcess>
<displayValueProcess>%aditoprj%/entity/Address_entity/entityfields/city/displayValueProcess.js</displayValueProcess>
<onValueChange>%aditoprj%/entity/Address_entity/entityfields/city/onValueChange.js</onValueChange>
<onValueChangeTypes>
<element>MASK</element>
</onValueChangeTypes>
<stateProcess>%aditoprj%/entity/Address_entity/entityfields/city/stateProcess.js</stateProcess>
</entityField>
<entityField>
<name>COUNTRY</name>
......@@ -86,13 +83,7 @@
<name>ZIP</name>
<title>Postcode</title>
<mandatoryProcess>%aditoprj%/entity/Address_entity/entityfields/zip/mandatoryProcess.js</mandatoryProcess>
<textInputAllowed v="true" />
<valueProcess>%aditoprj%/entity/Address_entity/entityfields/zip/valueProcess.js</valueProcess>
<displayValueProcess>%aditoprj%/entity/Address_entity/entityfields/zip/displayValueProcess.js</displayValueProcess>
<onValueChange>%aditoprj%/entity/Address_entity/entityfields/zip/onValueChange.js</onValueChange>
<onValueChangeTypes>
<element>MASK</element>
</onValueChangeTypes>
<stateProcess>%aditoprj%/entity/Address_entity/entityfields/zip/stateProcess.js</stateProcess>
<onValidation>%aditoprj%/entity/Address_entity/entityfields/zip/onValidation.js</onValidation>
</entityField>
<entityProvider>
......@@ -404,6 +395,49 @@
<valueProcess>%aditoprj%/entity/Address_entity/entityfields/showdsgvomessage_param/valueProcess.js</valueProcess>
<expose v="true" />
</entityParameter>
<entityField>
<name>Zip_ws</name>
<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>
<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>
<title>Street</title>
<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>
<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>
</entityFields>
<recordContainers>
<dbRecordContainer>
......
......@@ -8,3 +8,5 @@ an entity for logic behind a postal address
The entity manages storing postal addresses and provides features like validation.
Every `CONTACT` has one standard address value that is used by default for some actions. Keep in mind that this standard address has a special status and therefore may cannot be deleted.
Webservice Validation: See WsValidation_lib
\ No newline at end of file
import("Entity_lib");
import("system.result");
import("AddressEntity_lib");
import("WsValidation_lib");
result.object(AddressEntityValidation.isMandatoryField());
\ No newline at end of file
result.string(WsValidationFieldUtils.mainFieldMandatoryProcess(WsValidationType.get().TYPE_STREET_NOMINATIM));
\ No newline at end of file
import("system.vars");
import("WsValidation_lib");
// use the code if address webservice is active
//WsValidationUtils.setAddressFields(vars.get("$local.value"));
\ No newline at end of file
if (WsValidationUtils.isWsEnabled(WsValidationType.get().TYPE_STREET_NOMINATIM))
WsValidationUtils.setAddressFields(vars.get("$local.value"));
\ No newline at end of file
import("system.result");
import("WsValidation_lib");
result.string(WsValidationFieldUtils.mainFieldStateProcess(WsValidationType.get().TYPE_STREET_NOMINATIM));
\ No newline at end of file
import("WsValidation_lib");
WsValidationFieldUtils.wsDisplayValueProcess(WsValidationType.get().TYPE_STREET_NOMINATIM, "$field.ADDRESS");
\ No newline at end of file
import("AddressEntity_lib");
import("WsValidation_lib");
import("system.result");
result.object(WsValidationFieldUtils.wsFieldMandatoryProcess(WsValidationType.get().TYPE_STREET_NOMINATIM, AddressEntityValidation.isMandatoryField("ADDRESS")));
\ No newline at end of file
import("WsValidation_lib");
WsValidationFieldUtils.wsOnValueChangeProcess(WsValidationType.get().TYPE_STREET_NOMINATIM, "$field.ADDRESS");
\ No newline at end of file
import("system.result");
import("WsValidation_lib");
result.string(WsValidationFieldUtils.wsFieldStateProcess(WsValidationType.get().TYPE_STREET_NOMINATIM));
\ No newline at end of file
import("WsValidation_lib");
WsValidationFieldUtils.wsValueProcess(WsValidationType.get().TYPE_STREET_NOMINATIM, "$field.ADDRESS");
\ No newline at end of file
import("system.vars");
import("system.result");
// Needed for instant refresh if set by neon.setFieldValue
// use the code if address webservice is active
//result.string(vars.get("$field.CITY"));
\ No newline at end of file
Address validation
==
import("Entity_lib");
import("system.result");
import("AddressEntity_lib");
import("WsValidation_lib");
result.object(AddressEntityValidation.isMandatoryField());
\ No newline at end of file
result.string(WsValidationFieldUtils.mainFieldMandatoryProcess(WsValidationType.get().TYPE_CITY_NOMINATIM));
\ No newline at end of file
import("system.vars");
import("WsValidation_lib");
// use the code if address webservice is active
//WsValidationUtils.setAddressFields(vars.get("$local.value"));
\ No newline at end of file
import("system.result");
import("WsValidation_lib");
result.string(WsValidationFieldUtils.mainFieldStateProcess(WsValidationType.get().TYPE_CITY_NOMINATIM));
\ No newline at end of file
import("system.result");
import("WsValidation_lib");
import("system.vars");
// use the code if address webservice is active
//result.string(WsValidationUtils.valueFromJSON(vars.get("$this.value")));
\ No newline at end of file
import("WsValidation_lib");
WsValidationFieldUtils.wsDisplayValueProcess(WsValidationType.get().TYPE_CITY_NOMINATIM, "$field.CITY");
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment