From a641bcda86198fba1906133e76f142b7aaabb67e Mon Sep 17 00:00:00 2001
From: Johannes Hoermann <j.hoermann@adito.de>
Date: Mon, 25 Nov 2019 11:09:56 +0100
Subject: [PATCH] preset leadimport csv configuration

---
 entity/Leadimport_entity/Leadimport_entity.aod           | 3 +++
 .../entityfields/fielddelimiters/valueProcess.js         | 9 +++++++++
 .../entityfields/fieldseparator/valueProcess.js          | 9 +++++++++
 .../entityfields/sentenceseparator/valueProcess.js       | 9 +++++++++
 process/KeywordRegistry_basic/process.js                 | 3 +++
 5 files changed, 33 insertions(+)
 create mode 100644 entity/Leadimport_entity/entityfields/fielddelimiters/valueProcess.js
 create mode 100644 entity/Leadimport_entity/entityfields/fieldseparator/valueProcess.js
 create mode 100644 entity/Leadimport_entity/entityfields/sentenceseparator/valueProcess.js

diff --git a/entity/Leadimport_entity/Leadimport_entity.aod b/entity/Leadimport_entity/Leadimport_entity.aod
index 581974e1dd..d9ae5a1b44 100644
--- a/entity/Leadimport_entity/Leadimport_entity.aod
+++ b/entity/Leadimport_entity/Leadimport_entity.aod
@@ -72,6 +72,7 @@
       <title>Record separator</title>
       <consumer>KeywordRecordSeparator</consumer>
       <mandatory v="true" />
+      <valueProcess>%aditoprj%/entity/Leadimport_entity/entityfields/sentenceseparator/valueProcess.js</valueProcess>
       <displayValueProcess>%aditoprj%/entity/Leadimport_entity/entityfields/sentenceseparator/displayValueProcess.js</displayValueProcess>
     </entityField>
     <entityField>
@@ -79,6 +80,7 @@
       <title>Field separator</title>
       <consumer>KeyWordFieldSeparator</consumer>
       <mandatory v="true" />
+      <valueProcess>%aditoprj%/entity/Leadimport_entity/entityfields/fieldseparator/valueProcess.js</valueProcess>
       <displayValueProcess>%aditoprj%/entity/Leadimport_entity/entityfields/fieldseparator/displayValueProcess.js</displayValueProcess>
     </entityField>
     <entityField>
@@ -86,6 +88,7 @@
       <title>Field delimiter</title>
       <consumer>KeywordFieldLimit</consumer>
       <mandatory v="true" />
+      <valueProcess>%aditoprj%/entity/Leadimport_entity/entityfields/fielddelimiters/valueProcess.js</valueProcess>
       <displayValueProcess>%aditoprj%/entity/Leadimport_entity/entityfields/fielddelimiters/displayValueProcess.js</displayValueProcess>
     </entityField>
     <entityField>
diff --git a/entity/Leadimport_entity/entityfields/fielddelimiters/valueProcess.js b/entity/Leadimport_entity/entityfields/fielddelimiters/valueProcess.js
new file mode 100644
index 0000000000..6e2027a761
--- /dev/null
+++ b/entity/Leadimport_entity/entityfields/fielddelimiters/valueProcess.js
@@ -0,0 +1,9 @@
+import("system.result");
+import("system.neon");
+import("system.vars");
+import("KeywordRegistry_basic");
+
+if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null)
+{
+    result.string($KeywordRegistry.fieldLimit$doubleQuotation());
+}
\ No newline at end of file
diff --git a/entity/Leadimport_entity/entityfields/fieldseparator/valueProcess.js b/entity/Leadimport_entity/entityfields/fieldseparator/valueProcess.js
new file mode 100644
index 0000000000..f52d74f4b9
--- /dev/null
+++ b/entity/Leadimport_entity/entityfields/fieldseparator/valueProcess.js
@@ -0,0 +1,9 @@
+import("system.result");
+import("system.neon");
+import("system.vars");
+import("KeywordRegistry_basic");
+
+if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null)
+{
+    result.string($KeywordRegistry.fieldSeparator$semicolon());
+}
\ No newline at end of file
diff --git a/entity/Leadimport_entity/entityfields/sentenceseparator/valueProcess.js b/entity/Leadimport_entity/entityfields/sentenceseparator/valueProcess.js
new file mode 100644
index 0000000000..63f9d0f23b
--- /dev/null
+++ b/entity/Leadimport_entity/entityfields/sentenceseparator/valueProcess.js
@@ -0,0 +1,9 @@
+import("system.result");
+import("system.neon");
+import("system.vars");
+import("KeywordRegistry_basic");
+
+if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null)
+{
+    result.string($KeywordRegistry.recordSeparator$crlf());
+}
\ No newline at end of file
diff --git a/process/KeywordRegistry_basic/process.js b/process/KeywordRegistry_basic/process.js
index 05dfb7dbdf..a1f19c6e73 100644
--- a/process/KeywordRegistry_basic/process.js
+++ b/process/KeywordRegistry_basic/process.js
@@ -225,7 +225,10 @@ $KeywordRegistry.importStatus$loaded = function(){return $KeywordRegistry._autoP
 $KeywordRegistry.importStatus$transfered = function(){return $KeywordRegistry._autoPad("TRANSFERED");};
 
 $KeywordRegistry.fieldSeparator = function(){return "FieldSeparator";};
+$KeywordRegistry.fieldSeparator$semicolon = function(){return $KeywordRegistry._autoPad("SEMICOLON");};
 $KeywordRegistry.fieldLimit = function(){return "FieldLimit";};
+$KeywordRegistry.fieldLimit$doubleQuotation = function(){return $KeywordRegistry._autoPad("DOUBLEQUOTATION");};
 $KeywordRegistry.recordSeparator = function(){return "RecordSeparator";};
+$KeywordRegistry.recordSeparator$crlf = function(){return $KeywordRegistry._autoPad("CRLF");};
 $KeywordRegistry.importFields = function(){return "ImportFields";};
 $KeywordRegistry.dupStatus = function(){return "DupStatus";};
\ No newline at end of file
-- 
GitLab