From e6d6086e1d87c35565f43e6c5c1712439df4b132 Mon Sep 17 00:00:00 2001 From: "b.ulrich" <b.ulrich@adito.de> Date: Tue, 22 Dec 2020 06:54:45 +0100 Subject: [PATCH] [Projekt: Entwicklung - xRM][TicketNr.: 1044224][Document-Context: BINDATA_UPLOAD muss Pflichtfeld sein] --- entity/Document_entity/Document_entity.aod | 3 ++- .../entityfields/bindata_upload/mandatoryProcess.js | 4 ++-- entity/Document_entity/onValidation.js | 13 +++++++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 entity/Document_entity/onValidation.js diff --git a/entity/Document_entity/Document_entity.aod b/entity/Document_entity/Document_entity.aod index f1dda1cc41..713af4aaed 100644 --- a/entity/Document_entity/Document_entity.aod +++ b/entity/Document_entity/Document_entity.aod @@ -5,6 +5,7 @@ <documentation>%aditoprj%/entity/Document_entity/documentation.adoc</documentation> <title>Document</title> <grantCreateProcess>%aditoprj%/entity/Document_entity/grantCreateProcess.js</grantCreateProcess> + <onValidation>%aditoprj%/entity/Document_entity/onValidation.js</onValidation> <iconId>VAADIN:FILE</iconId> <titlePlural>Documents</titlePlural> <recordContainer>jdito</recordContainer> @@ -57,7 +58,7 @@ <name>BINDATA_UPLOAD</name> <title>File</title> <contentType>FILE</contentType> - <mandatory v="false" /> + <mandatory v="true" /> <mandatoryProcess>%aditoprj%/entity/Document_entity/entityfields/bindata_upload/mandatoryProcess.js</mandatoryProcess> <onValueChange>%aditoprj%/entity/Document_entity/entityfields/bindata_upload/onValueChange.js</onValueChange> <onValueChangeTypes> diff --git a/entity/Document_entity/entityfields/bindata_upload/mandatoryProcess.js b/entity/Document_entity/entityfields/bindata_upload/mandatoryProcess.js index 9b10455db3..d250f4bf65 100644 --- a/entity/Document_entity/entityfields/bindata_upload/mandatoryProcess.js +++ b/entity/Document_entity/entityfields/bindata_upload/mandatoryProcess.js @@ -3,6 +3,6 @@ import("system.vars"); import("system.result"); if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) - result.string("true"); + result.string(true); else - result.string("false"); + result.string(false); \ No newline at end of file diff --git a/entity/Document_entity/onValidation.js b/entity/Document_entity/onValidation.js new file mode 100644 index 0000000000..53b827644e --- /dev/null +++ b/entity/Document_entity/onValidation.js @@ -0,0 +1,13 @@ +import("system.neon"); +import("system.result"); +import("system.vars"); + +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) +{ + var bindata = vars.get("$field.BINDATA_UPLOAD"); + + if(bindata == null || bindata == "") + { + result.string("Dont forget to upload a file"); + } +} \ No newline at end of file -- GitLab