From f31fcc64776a78bad8d5526ea3bbc0957e4cefb0 Mon Sep 17 00:00:00 2001
From: "j.goderbauer" <j.goderbauer@adito.de>
Date: Thu, 6 Jun 2019 16:04:59 +0200
Subject: [PATCH] Attributecount: validationmessage fix

---
 .../entityfields/max_count/onValidation.js    | 28 ++++++++++---------
 .../entityfields/min_count/onValidation.js    | 26 ++++++++---------
 .../_____LANGUAGE_EXTRA.aod                   | 12 ++++++++
 .../_____LANGUAGE_de/_____LANGUAGE_de.aod     | 15 ++++++++++
 .../_____LANGUAGE_en/_____LANGUAGE_en.aod     | 12 ++++++++
 5 files changed, 67 insertions(+), 26 deletions(-)

diff --git a/entity/AttributeUsage_entity/entityfields/max_count/onValidation.js b/entity/AttributeUsage_entity/entityfields/max_count/onValidation.js
index cfec392b70..96735194f3 100644
--- a/entity/AttributeUsage_entity/entityfields/max_count/onValidation.js
+++ b/entity/AttributeUsage_entity/entityfields/max_count/onValidation.js
@@ -1,13 +1,15 @@
-import("system.result");
-import("system.vars");
-import("system.translate");
-import("Entity_lib");
-
-var maxCount = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.MAX_COUNT"));
-
-if (maxCount)
-{
-    maxCount = Number(maxCount);
-    if (maxCount <= 0 || maxCount != Math.floor(maxCount)) //when specified, max count must can't be negative, zero or not an integer
-        result.string(false);
-}
+import("system.result");
+import("system.vars");
+import("system.translate");
+import("Entity_lib");
+
+var maxCount = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.MAX_COUNT"));
+
+if (maxCount)
+{
+    maxCount = Number(maxCount);
+    if (maxCount <= 0)
+        result.string(translate.text("Maximal count must be one or higher"));
+    else if (maxCount != Math.floor(maxCount))
+        result.string(translate.text("Maximal count has to be a whole number"));
+}
diff --git a/entity/AttributeUsage_entity/entityfields/min_count/onValidation.js b/entity/AttributeUsage_entity/entityfields/min_count/onValidation.js
index 36ddf1f1fd..2f28221a1b 100644
--- a/entity/AttributeUsage_entity/entityfields/min_count/onValidation.js
+++ b/entity/AttributeUsage_entity/entityfields/min_count/onValidation.js
@@ -1,13 +1,13 @@
-import("system.result");
-import("system.vars");
-import("system.translate");
-import("Entity_lib");
-
-var minCount = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.MIN_COUNT"));
-
-if (minCount)
-{
-    minCount = Number(minCount);
-    if (minCount < 0 || minCount != Math.floor(minCount)) //when specified, max count must can't be negative or not an integer
-        result.string(false);
-}
+import("system.result");
+import("system.vars");
+import("system.translate");
+import("Entity_lib");
+
+var minCount = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.MIN_COUNT"));
+
+if (minCount)
+{
+    minCount = Number(minCount);
+    if (minCount < 0 || minCount != Math.floor(minCount)) //when specified, max count must can't be negative or not an integer
+        result.string(translate.text("Minimal count must be a positive whole number"));
+}
diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
index f5b5a416e2..5d65862f9e 100644
--- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
+++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
@@ -3651,6 +3651,18 @@
     <entry>
       <key>Salesproject member</key>
     </entry>
+    <entry>
+      <key>Maximal count has to be a whole number</key>
+    </entry>
+    <entry>
+      <key>Minimal count must be a positive whole number</key>
+    </entry>
+    <entry>
+      <key>Meilensteine und Kontaktpunkte</key>
+    </entry>
+    <entry>
+      <key>Maximal count must be one or higher</key>
+    </entry>
   </keyValueMap>
   <font name="Dialog" style="0" size="11" />
   <sqlModels>
diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
index c713805312..dfb11a0217 100644
--- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
+++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
@@ -4567,6 +4567,21 @@
       <key>Search for new Entries</key>
       <value>Nach neuen Einträgen suchen</value>
     </entry>
+    <entry>
+      <key>Maximal count has to be a whole number</key>
+      <value>Maximale Anzahl muss eine ganze Zahl sein</value>
+    </entry>
+    <entry>
+      <key>Minimal count must be a positive whole number</key>
+      <value>Minimale Anzahl muss eine positive, ganze Zahl sein</value>
+    </entry>
+    <entry>
+      <key>Meilensteine und Kontaktpunkte</key>
+    </entry>
+    <entry>
+      <key>Maximal count must be one or higher</key>
+      <value>Maximale Anzahl muss eins oder höher sein</value>
+    </entry>
   </keyValueMap>
   <font name="Dialog" style="0" size="11" />
 </language>
diff --git a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod
index 740513fd18..6dac2a9cf5 100644
--- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod
+++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod
@@ -3700,6 +3700,18 @@
     <entry>
       <key>Salesproject member</key>
     </entry>
+    <entry>
+      <key>Maximal count has to be a whole number</key>
+    </entry>
+    <entry>
+      <key>Minimal count must be a positive whole number</key>
+    </entry>
+    <entry>
+      <key>Meilensteine und Kontaktpunkte</key>
+    </entry>
+    <entry>
+      <key>Maximal count must be one or higher</key>
+    </entry>
   </keyValueMap>
   <font name="Dialog" style="0" size="11" />
 </language>
-- 
GitLab