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

address: do not validate mandatory if fields are empty

parent 31202159
No related branches found
No related tags found
No related merge requests found
......@@ -28,6 +28,7 @@
<documentation>%aditoprj%/entity/Address_entity/entityfields/addr_type/documentation.adoc</documentation>
<title>Addresstype</title>
<consumer>KeywordAddressTypes</consumer>
<valueProcess>%aditoprj%/entity/Address_entity/entityfields/addr_type/valueProcess.js</valueProcess>
<displayValueProcess>%aditoprj%/entity/Address_entity/entityfields/addr_type/displayValueProcess.js</displayValueProcess>
</entityField>
<entityField>
......@@ -49,6 +50,7 @@
<title>Country</title>
<consumer>Countries</consumer>
<mandatory v="true" />
<mandatoryProcess>%aditoprj%/entity/Address_entity/entityfields/country/mandatoryProcess.js</mandatoryProcess>
<valueProcess>%aditoprj%/entity/Address_entity/entityfields/country/valueProcess.js</valueProcess>
<displayValueProcess>%aditoprj%/entity/Address_entity/entityfields/country/displayValueProcess.js</displayValueProcess>
</entityField>
......@@ -63,6 +65,7 @@
<entityField>
<name>CONTACT_ID</name>
<mandatory v="true" />
<mandatoryProcess>%aditoprj%/entity/Address_entity/entityfields/contact_id/mandatoryProcess.js</mandatoryProcess>
<valueProcess>%aditoprj%/entity/Address_entity/entityfields/contact_id/valueProcess.js</valueProcess>
</entityField>
<entityField>
......@@ -337,12 +340,6 @@
</entityParameter>
</children>
</entityConsumer>
<entityParameter>
<name>ReloadWorkaround_param</name>
<expose v="true" />
<triggerRecalculation v="true" />
<description>PARAMETER</description>
</entityParameter>
</entityFields>
<recordContainers>
<dbRecordContainer>
......
import("Entity_lib");
import("system.result");
import("AddressEntity_lib");
result.string(AddressEntityValidation.isMandatoryField());
\ No newline at end of file
result.object(ProcessHandlingUtils.getMandatoryIgnoreAllEmpty([
"$field.ADDR_TYPE",
"$field.ADDRESS",
"$field.BUILDINGNO",
"$field.ZIP",
"$field.CITY",
"$field.COUNTRY",
"$field.STATE",
"$field.REGION",
"$field.ADDRIDENTIFIER"
], AddressEntityValidation.isMandatoryField()));
\ No newline at end of file
import("Entity_lib");
import("system.result");
import("AddressEntity_lib");
result.string(AddressEntityValidation.isMandatoryField());
\ No newline at end of file
result.object(ProcessHandlingUtils.getMandatoryIgnoreAllEmpty([
"$field.ADDR_TYPE",
"$field.ADDRESS",
"$field.BUILDINGNO",
"$field.ZIP",
"$field.CITY",
"$field.COUNTRY",
"$field.STATE",
"$field.REGION",
"$field.ADDRIDENTIFIER"
], AddressEntityValidation.isMandatoryField()));
\ No newline at end of file
import("Entity_lib");
import("system.result");
import("AddressEntity_lib");
result.object(ProcessHandlingUtils.getMandatoryIgnoreAllEmpty([
"$field.ADDR_TYPE",
"$field.ADDRESS",
"$field.BUILDINGNO",
"$field.ZIP",
"$field.CITY",
"$field.COUNTRY",
"$field.STATE",
"$field.REGION",
"$field.ADDRIDENTIFIER"
], true));
\ No newline at end of file
import("Entity_lib");
import("system.result");
import("AddressEntity_lib");
result.object(ProcessHandlingUtils.getMandatoryIgnoreAllEmpty([
"$field.ADDR_TYPE",
"$field.ADDRESS",
"$field.BUILDINGNO",
"$field.ZIP",
"$field.CITY",
"$field.COUNTRY",
"$field.STATE",
"$field.REGION",
"$field.ADDRIDENTIFIER"
], true));
\ No newline at end of file
import("Entity_lib");
import("system.result");
import("AddressEntity_lib");
result.string(AddressEntityValidation.isMandatoryField());
\ No newline at end of file
result.object(ProcessHandlingUtils.getMandatoryIgnoreAllEmpty([
"$field.ADDR_TYPE",
"$field.ADDRESS",
"$field.BUILDINGNO",
"$field.ZIP",
"$field.CITY",
"$field.COUNTRY",
"$field.STATE",
"$field.REGION",
"$field.ADDRIDENTIFIER"
], AddressEntityValidation.isMandatoryField()));
\ No newline at end of file
import("Entity_lib");
import("system.result");
import("AddressEntity_lib");
result.string(AddressEntityValidation.isMandatoryField());
result.object(ProcessHandlingUtils.getMandatoryIgnoreAllEmpty([
"$field.ADDR_TYPE",
"$field.ADDRESS",
"$field.BUILDINGNO",
"$field.ZIP",
"$field.CITY",
"$field.COUNTRY",
"$field.STATE",
"$field.REGION",
"$field.ADDRIDENTIFIER"
], AddressEntityValidation.isMandatoryField()));
\ No newline at end of file
import("system.logging");
import("system.result");
import("system.neon");
import("system.vars");
......@@ -47,6 +48,26 @@ ProcessHandlingUtils.initialParamToResult = function(pParamVarName)
}
ProcessHandlingUtils.getMandatoryIgnoreAllEmpty = function(pFields, pIsMandatory)
{
var allEmpty = true;
logging.log("-------------")
pFields.forEach(function(pField) {
logging.log(pField + " " + vars.getString(pField))
if (vars.getString(pField))
{
allEmpty = false;
}
});
logging.log(allEmpty)
logging.log(pIsMandatory)
logging.log(!allEmpty && pIsMandatory)
logging.log("-------------")
return !allEmpty && pIsMandatory;
}
/**
* Workaround for detecting field changes of fields not managed by record containers.
* Should be fixed in the future: Ticket 1030023
......
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