From 31f316540bc9762721a866c8a591f08c8569ef7c Mon Sep 17 00:00:00 2001
From: Benjamin Ulrich <b.ulrich@adito.de>
Date: Mon, 8 Mar 2021 14:54:17 +0000
Subject: [PATCH] =?UTF-8?q?[Projekt:=20xRM-Sales][TicketNr.:=201073510][Ve?=
 =?UTF-8?q?rtriebsprozesse=20-=20=C3=9Cberarbeitung:=20Code=20refactoring]?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../Checklists/alter_ChecklistEntry.xml       |  35 ++++++
 .../basic/2021.0.2/Checklists/changelog.xml   |   6 +
 .../Data_alias/basic/2021.0.2/changelog.xml   |   1 +
 aliasDefinition/Data_alias/Data_alias.aod     |  13 +-
 .../ChecklistEntryValue_entity.aod            |  20 ++-
 .../checklistentry_id/displayValueProcess.js  |  29 -----
 .../children/setcompleted/onActionProcess.js  |  25 +++-
 .../stateProcess.js                           |   5 +-
 .../entityfields/type/displayValueProcess.js  |   7 --
 .../entityfields/type/valueProcess.js         |  16 ---
 .../recordcontainers/jdito/contentProcess.js  | 115 +++++++++++++++---
 .../ChecklistEntry_entity.aod                 |  18 +--
 .../entityfields/auto/displayValueProcess.js  |  14 +++
 .../entityfields/auto/onValueChange.js        |   3 +
 .../entityfields/auto/placeholderProcess.js   |   4 +
 .../entityfields/date_edit/valueProcess.js    |   2 +-
 .../entityfields/date_new/valueProcess.js     |   2 +-
 .../entityfields/title/displayValueProcess.js |   2 +-
 .../entityfields/title/dropDownProcess.js     |   2 +-
 .../entityfields/type/dropDownProcess.js      |   5 -
 .../entityfields/user_edit/valueProcess.js    |   2 +-
 .../entityfields/user_new/valueProcess.js     |   2 +-
 .../entityfields/date_edit/valueProcess.js    |   2 +-
 .../entityfields/date_new/valueProcess.js     |   2 +-
 .../entityfields/user_edit/valueProcess.js    |   2 +-
 .../entityfields/user_new/valueProcess.js     |   2 +-
 entity/Member_entity/Member_entity.aod        |   1 -
 .../recordcontainers/jdito/contentProcess.js  |   2 +-
 .../entityfields/date_edit/valueProcess.js    |   2 +-
 .../entityfields/date_new/valueProcess.js     |   2 +-
 .../entityfields/phase/dropDownProcess.js     |  10 +-
 .../entityfields/phase/onValidation.js        |   6 +-
 .../entityfields/user_edit/valueProcess.js    |   2 +-
 .../entityfields/user_new/valueProcess.js     |   2 +-
 .../iconIdProcess.js                          |   2 +-
 .../phase.displayvalue/expression.js          |   1 -
 .../checklistid_param/valueProcess.js         |   2 +-
 .../_____LANGUAGE_EXTRA.aod                   |   3 +
 .../_____LANGUAGE_de/_____LANGUAGE_de.aod     |   8 ++
 .../_____LANGUAGE_en/_____LANGUAGE_en.aod     |   3 +
 .../ChecklistEntryList_view.aod               |   2 +-
 .../ChecklistEntryMultiEdit_view.aod          |   2 +-
 .../ChecklistEntryValueList_view.aod          |   2 +-
 .../ChecklistEntryRegistry_basic/process.js   |  79 ++++++------
 process/KeywordRegistry_basic/process.js      |   1 +
 45 files changed, 299 insertions(+), 169 deletions(-)
 create mode 100644 .liquibase/Data_alias/basic/2021.0.2/Checklists/alter_ChecklistEntry.xml
 create mode 100644 .liquibase/Data_alias/basic/2021.0.2/Checklists/changelog.xml
 delete mode 100644 entity/ChecklistEntryValue_entity/entityfields/checklistentry_id/displayValueProcess.js
 delete mode 100644 entity/ChecklistEntryValue_entity/entityfields/type/displayValueProcess.js
 delete mode 100644 entity/ChecklistEntryValue_entity/entityfields/type/valueProcess.js
 create mode 100644 entity/ChecklistEntry_entity/entityfields/auto/displayValueProcess.js
 create mode 100644 entity/ChecklistEntry_entity/entityfields/auto/onValueChange.js
 create mode 100644 entity/ChecklistEntry_entity/entityfields/auto/placeholderProcess.js
 delete mode 100644 entity/ChecklistEntry_entity/entityfields/type/dropDownProcess.js

diff --git a/.liquibase/Data_alias/basic/2021.0.2/Checklists/alter_ChecklistEntry.xml b/.liquibase/Data_alias/basic/2021.0.2/Checklists/alter_ChecklistEntry.xml
new file mode 100644
index 0000000000..924c2b6c71
--- /dev/null
+++ b/.liquibase/Data_alias/basic/2021.0.2/Checklists/alter_ChecklistEntry.xml
@@ -0,0 +1,35 @@
+<?xml version="1.1" encoding="UTF-8" standalone="no"?>
+<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
+
+    <!--change datatype of title to nvarchar (derby doesn't have nvarchar)-->
+        <changeSet dbms="!derby" author="b.ulrich" id="77758b00-afe0-457d-886c-3cfe5bd6dca3">
+            <modifyDataType tableName="CHECKLISTENTRY" columnName="TITLE" newDataType="NVARCHAR(100)"/>
+        </changeSet>
+    
+    <!--make automatic work as an boolean-->
+        <!--change "type" to "auto"-->
+            <changeSet author="b.ulrich" id="986053d4-8b69-4892-93cd-2f2defbc85d1">
+                <addColumn tableName="CHECKLISTENTRY">
+                    <column name="AUTO" type="TINYINT" defaultValueNumeric="0"/>
+                </addColumn>
+        <!--update existing Data-->
+                <update tableName="CHECKLISTENTRY">
+                    <column name="AUTO" valueNumeric="1"/>
+                    <where>TYPE = ?</where>
+                    <whereParams>
+                        <param value="AUTO"/>
+                    </whereParams>
+                </update>
+        <!--and add not Null constraint-->
+                <addNotNullConstraint
+                    columnDataType="TINYINT"
+                    columnName="AUTO"
+                    tableName="CHECKLISTENTRY"/>
+        <!--drop old column-->
+                <dropColumn tableName="CHECKLISTENTRY">
+                    <column name="TYPE"/>
+                </dropColumn>
+            </changeSet>
+</databaseChangeLog>
\ No newline at end of file
diff --git a/.liquibase/Data_alias/basic/2021.0.2/Checklists/changelog.xml b/.liquibase/Data_alias/basic/2021.0.2/Checklists/changelog.xml
new file mode 100644
index 0000000000..c4d0936867
--- /dev/null
+++ b/.liquibase/Data_alias/basic/2021.0.2/Checklists/changelog.xml
@@ -0,0 +1,6 @@
+<?xml version="1.1" encoding="UTF-8" standalone="no"?>
+<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
+    <include relativeToChangelogFile="true" file="alter_ChecklistEntry.xml"/>
+</databaseChangeLog>
\ No newline at end of file
diff --git a/.liquibase/Data_alias/basic/2021.0.2/changelog.xml b/.liquibase/Data_alias/basic/2021.0.2/changelog.xml
index f2415888a9..537189254f 100644
--- a/.liquibase/Data_alias/basic/2021.0.2/changelog.xml
+++ b/.liquibase/Data_alias/basic/2021.0.2/changelog.xml
@@ -3,4 +3,5 @@
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
     <include relativeToChangelogFile="true" file="Event/changelog.xml"/>
     <include relativeToChangelogFile="true" file="alter_CompetitionExpandReasonSize.xml"/>
+    <include relativeToChangelogFile="true" file="Checklists/changelog.xml"/>
 </databaseChangeLog>
\ No newline at end of file
diff --git a/aliasDefinition/Data_alias/Data_alias.aod b/aliasDefinition/Data_alias/Data_alias.aod
index c4ab229cfe..abce13e87d 100644
--- a/aliasDefinition/Data_alias/Data_alias.aod
+++ b/aliasDefinition/Data_alias/Data_alias.aod
@@ -18106,11 +18106,11 @@
                 <description></description>
               </entityFieldDb>
               <entityFieldDb>
-                <name>TYPE</name>
+                <name>USER_EDIT</name>
                 <dbName></dbName>
                 <primaryKey v="false" />
                 <columnType v="12" />
-                <size v="10" />
+                <size v="50" />
                 <scale v="0" />
                 <notNull v="false" />
                 <isUnique v="false" />
@@ -18119,16 +18119,17 @@
                 <description></description>
               </entityFieldDb>
               <entityFieldDb>
-                <name>USER_EDIT</name>
+                <name>AUTO</name>
                 <dbName></dbName>
                 <primaryKey v="false" />
-                <columnType v="12" />
-                <size v="50" />
+                <columnType v="5" />
+                <size v="5" />
                 <scale v="0" />
-                <notNull v="false" />
+                <notNull v="true" />
                 <isUnique v="false" />
                 <index v="false" />
                 <documentation></documentation>
+                <title></title>
                 <description></description>
               </entityFieldDb>
             </entityFields>
diff --git a/entity/ChecklistEntryValue_entity/ChecklistEntryValue_entity.aod b/entity/ChecklistEntryValue_entity/ChecklistEntryValue_entity.aod
index a2e7566be1..307cc1e870 100644
--- a/entity/ChecklistEntryValue_entity/ChecklistEntryValue_entity.aod
+++ b/entity/ChecklistEntryValue_entity/ChecklistEntryValue_entity.aod
@@ -21,7 +21,6 @@
       <name>CHECKLISTENTRY_ID</name>
       <title>Checklist entry</title>
       <state>READONLY</state>
-      <displayValueProcess>%aditoprj%/entity/ChecklistEntryValue_entity/entityfields/checklistentry_id/displayValueProcess.js</displayValueProcess>
     </entityField>
     <entityField>
       <name>OBJECT_ROWID</name>
@@ -103,11 +102,13 @@
       </children>
     </entityActionGroup>
     <entityField>
-      <name>type</name>
-      <title>Type</title>
-      <valueProcess>%aditoprj%/entity/ChecklistEntryValue_entity/entityfields/type/valueProcess.js</valueProcess>
-      <displayValueProcess>%aditoprj%/entity/ChecklistEntryValue_entity/entityfields/type/displayValueProcess.js</displayValueProcess>
+      <name>AUTO</name>
+      <title>Automatically</title>
     </entityField>
+    <entityParameter>
+      <name>ChecklistEntryValueId_param</name>
+      <expose v="true" />
+    </entityParameter>
   </entityFields>
   <recordContainers>
     <jDitoRecordContainer>
@@ -146,6 +147,15 @@
         <jDitoRecordFieldMapping>
           <name>USER_NEW.value</name>
         </jDitoRecordFieldMapping>
+        <jDitoRecordFieldMapping>
+          <name>CHECKLISTENTRY_ID.displayValue</name>
+        </jDitoRecordFieldMapping>
+        <jDitoRecordFieldMapping>
+          <name>AUTO.value</name>
+        </jDitoRecordFieldMapping>
+        <jDitoRecordFieldMapping>
+          <name>AUTO.displayValue</name>
+        </jDitoRecordFieldMapping>
       </recordFieldMappings>
     </jDitoRecordContainer>
   </recordContainers>
diff --git a/entity/ChecklistEntryValue_entity/entityfields/checklistentry_id/displayValueProcess.js b/entity/ChecklistEntryValue_entity/entityfields/checklistentry_id/displayValueProcess.js
deleted file mode 100644
index 4e7b2c6977..0000000000
--- a/entity/ChecklistEntryValue_entity/entityfields/checklistentry_id/displayValueProcess.js
+++ /dev/null
@@ -1,29 +0,0 @@
-import("system.db");
-import("system.result");
-import("system.vars");
-import("system.translate");
-import("ChecklistEntryRegistry_basic");
-import("Util_lib");
-import("Sql_lib");
-    
-
-var alias = db.getCurrentAlias();
-
-
-var checklistEntryId = vars.get("$field.CHECKLISTENTRY_ID");
-var verfierFnName = newSelect("TITLE", alias)
-                            .from("CHECKLISTENTRY")
-                            .where("CHECKLISTENTRY.CHECKLISTENTRYID", checklistEntryId)
-                            .cell();
-var verifierFn = $ChecklistEntryRegistry[verfierFnName];
-var displayValue;
-
-if (Utils.isFunction(verifierFn))
-    displayValue = verifierFn().title;
-else{
-    displayValue = translate.text(verfierFnName);
-}
-
-result.string(displayValue);
-
-
diff --git a/entity/ChecklistEntryValue_entity/entityfields/setchecklistentrycompleted/children/setcompleted/onActionProcess.js b/entity/ChecklistEntryValue_entity/entityfields/setchecklistentrycompleted/children/setcompleted/onActionProcess.js
index 4684843918..e1f74869bb 100644
--- a/entity/ChecklistEntryValue_entity/entityfields/setchecklistentrycompleted/children/setcompleted/onActionProcess.js
+++ b/entity/ChecklistEntryValue_entity/entityfields/setchecklistentrycompleted/children/setcompleted/onActionProcess.js
@@ -1,9 +1,26 @@
+import("system.entities");
 import("system.vars");
 import("system.neon");
 import("Sql_lib");
 
+var loadConfig = entities.createConfigForLoadingRows()
+                            .entity("ChecklistEntryValue_entity")
+                            .fields(["CHECKLISTENTRYVALUEID"])
+                            .addParameter("ObjectRowId_param", vars.get("$param.ObjectRowId_param"))
+                            .addParameter("ChecklistEntryValueId_param", vars.get("$field.CHECKLISTENTRYVALUEID"))
+                            .addParameter("ChecklistId_param", vars.get("$param.ChecklistId_param"));
 
-newWhere("CHECKLISTENTRYVALUE.CHECKLISTENTRYVALUEID", "$field.CHECKLISTENTRYVALUEID")
-    .updateFields({"IS_FULFILLED":1});
-        
-neon.refreshAll();
\ No newline at end of file
+var checklistEntryValueIds = entities.getRows(loadConfig);
+
+var updateConfig = entities.createConfigForUpdatingRows()
+                                .entity("ChecklistEntryValue_entity")
+                                .fieldValues({"IS_FULFILLED": 1})
+                                .uid(checklistEntryValueIds[0]["CHECKLISTENTRYVALUEID"])
+                                .addParameter("ObjectRowId_param", vars.get("$param.ObjectRowId_param"))
+                                .addParameter("ChecklistEntryValueId_param", vars.get("$field.CHECKLISTENTRYVALUEID"))
+                                .addParameter("ChecklistId_param", vars.get("$param.ChecklistId_param"))
+                                .ignorePermissions(true);
+
+entities.updateRow(updateConfig);
+    
+neon.refresh();
\ No newline at end of file
diff --git a/entity/ChecklistEntryValue_entity/entityfields/setchecklistentrycompleted/stateProcess.js b/entity/ChecklistEntryValue_entity/entityfields/setchecklistentrycompleted/stateProcess.js
index 9e756de19a..e2abbdb1d6 100644
--- a/entity/ChecklistEntryValue_entity/entityfields/setchecklistentrycompleted/stateProcess.js
+++ b/entity/ChecklistEntryValue_entity/entityfields/setchecklistentrycompleted/stateProcess.js
@@ -4,12 +4,11 @@ import("system.neon");
 import("KeywordRegistry_basic");
 
 
-if (vars.get("$field.type") == $KeywordRegistry.checklistEntryType$auto())
+if (vars.get("$field.AUTO") == 1)
 {
     result.string(neon.COMPONENTSTATE_DISABLED);
 }
-
-if (vars.get("$field.type") == $KeywordRegistry.checklistEntryType$manual())
+else
 {
     result.string(neon.COMPONENTSTATE_EDITABLE);
 }
\ No newline at end of file
diff --git a/entity/ChecklistEntryValue_entity/entityfields/type/displayValueProcess.js b/entity/ChecklistEntryValue_entity/entityfields/type/displayValueProcess.js
deleted file mode 100644
index 574355fa5a..0000000000
--- a/entity/ChecklistEntryValue_entity/entityfields/type/displayValueProcess.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import("Keyword_lib");
-import("system.vars");
-import("system.result");
-import("KeywordRegistry_basic");
-
-
-result.string(KeywordUtils.getViewValue($KeywordRegistry.checklistEntryType(), vars.get("$field.type")));
\ No newline at end of file
diff --git a/entity/ChecklistEntryValue_entity/entityfields/type/valueProcess.js b/entity/ChecklistEntryValue_entity/entityfields/type/valueProcess.js
deleted file mode 100644
index 08c466c3be..0000000000
--- a/entity/ChecklistEntryValue_entity/entityfields/type/valueProcess.js
+++ /dev/null
@@ -1,16 +0,0 @@
-import("system.result");
-import("system.vars");
-import("Sql_lib");
-
-
-var checklistEntryId = vars.get("$field.CHECKLISTENTRY_ID");
-
-if (checklistEntryId)
-{
-    var type = newSelect("TYPE")
-                .from("CHECKLISTENTRY")
-                .where("CHECKLISTENTRY.CHECKLISTENTRYID", checklistEntryId)
-                .cell(); 
-
-    result.string(type);
-}
\ No newline at end of file
diff --git a/entity/ChecklistEntryValue_entity/recordcontainers/jdito/contentProcess.js b/entity/ChecklistEntryValue_entity/recordcontainers/jdito/contentProcess.js
index 52962aa1f6..a17f5785d3 100644
--- a/entity/ChecklistEntryValue_entity/recordcontainers/jdito/contentProcess.js
+++ b/entity/ChecklistEntryValue_entity/recordcontainers/jdito/contentProcess.js
@@ -1,3 +1,4 @@
+import("system.translate");
 import("system.result");
 import("system.vars");
 import("system.util");
@@ -5,10 +6,10 @@ import("system.db");
 import("KeywordRegistry_basic");
 import("Util_lib");
 import("Sql_lib");
-
+import("ChecklistEntryRegistry_basic");
 
 var newUid;
-var isExistent;
+var doesExist;
 var checklistEntryIds = [];
 var preparedStatements = [];
 var checklistEntryValues = [];
@@ -19,11 +20,45 @@ var cols = ["CHECKLISTENTRYVALUEID", "CHECKLISTENTRY_ID", "OBJECT_ROWID", "OBJEC
 
 var checklistId = vars.get("$param.ChecklistId_param");
 var objectRowId = vars.get("$param.ObjectRowId_param");
-//var objectType = vars.get("$param.ObjectType_param"); - necessary?
 var checklistEntries = [];
-if (checklistId)
+var checklistEntryValueId = vars.get("$param.ChecklistEntryValueId_param");
+if (checklistEntryValueId)
+{
+    //get all entries of the current checklist
+    checklistEntries = newSelect([
+                                    "CHECKLISTENTRY.CHECKLISTENTRYID", 
+                                    "CHECKLISTENTRY.CHECKLIST_ID", 
+                                    "CHECKLISTENTRY.TITLE", 
+                                    "CHECKLISTENTRY.AUTO", 
+                                    "CHECKLISTENTRY.USER_NEW", 
+                                    "CHECKLISTENTRY.USER_EDIT", 
+                                    "CHECKLISTENTRY.DATE_NEW", 
+                                    "CHECKLISTENTRY.DATE_EDIT"])
+                            .from("CHECKLISTENTRY")
+                            .join("CHECKLISTENTRYVALUE", "CHECKLISTENTRYVALUE.CHECKLISTENTRY_ID = CHECKLISTENTRY.CHECKLISTENTRYID")
+                            .where("CHECKLISTENTRY.CHECKLIST_ID", checklistId)
+                            .and("CHECKLISTENTRYVALUE.CHECKLISTENTRYVALUEID", checklistEntryValueId)
+                            .table();
+                            
+    checklistEntries.forEach(function(pRow){
+        if (pRow[0]) 
+        {
+            checklistEntryIds.push(pRow[0]);
+        }
+    });
+}
+else if (checklistId)
 {
-    checklistEntries = newSelect("CHECKLISTENTRYID, CHECKLIST_ID, TITLE, TYPE, USER_NEW, USER_EDIT, DATE_NEW, DATE_EDIT")
+    //get all entries of the current checklist
+    checklistEntries = newSelect([
+                                    "CHECKLISTENTRY.CHECKLISTENTRYID", 
+                                    "CHECKLISTENTRY.CHECKLIST_ID", 
+                                    "CHECKLISTENTRY.TITLE", 
+                                    "CHECKLISTENTRY.AUTO", 
+                                    "CHECKLISTENTRY.USER_NEW", 
+                                    "CHECKLISTENTRY.USER_EDIT", 
+                                    "CHECKLISTENTRY.DATE_NEW", 
+                                    "CHECKLISTENTRY.DATE_EDIT"])
                             .from("CHECKLISTENTRY")
                             .where("CHECKLISTENTRY.CHECKLIST_ID", checklistId)
                             .table();
@@ -36,13 +71,14 @@ if (checklistId)
     });
 }
 
-for (i = 0; i < checklistEntries.length; i++) 
+//loop trough the checklistEntries and handle them according to their type
+for (let i = 0; i < checklistEntries.length; i++) 
 {
-    for (j = 0; j < checklistEntries[i].length; j++) 
+    for (let ii = 0; ii < checklistEntries[i].length; ii++) 
     {
-        checklistEntryValues[i] = new Array(10);
+        checklistEntryValues[i] = new Array(13);
 
-        if (checklistEntries[i][3] == $KeywordRegistry.checklistEntryType$auto())
+        if (checklistEntries[i][3] == 1)//if auto == true
         {
             newUid = util.getNewUUID();
             vars.set("$param.VerifierFnName_param", checklistEntries[i][2]);
@@ -50,28 +86,37 @@ for (i = 0; i < checklistEntries.length; i++)
                                         Utils.toBoolean(vars.get("$param.Verifier_param")) ? 1 : 0, objectRowId,
                                         "", "null", vars.get("$sys.user")];
         }
-        else 
+        else//else manual
         {
-            isExistent = newSelect("CHECKLISTENTRYVALUEID, CHECKLISTENTRY_ID, CHECKLISTENTRYVALUEID,\n\
-                                                DATE_EDIT, DATE_NEW, IS_FULFILLED, OBJECT_ROWID, OBJECT_TYPE, USER_EDIT, USER_NEW")
+            doesExist = newSelect([
+                                    "CHECKLISTENTRYVALUE.CHECKLISTENTRYVALUEID", 
+                                    "CHECKLISTENTRYVALUE.CHECKLISTENTRY_ID", 
+                                    "CHECKLISTENTRYVALUE.CHECKLISTENTRYVALUEID",
+                                    "CHECKLISTENTRYVALUE.DATE_EDIT", 
+                                    "CHECKLISTENTRYVALUE.DATE_NEW", 
+                                    "CHECKLISTENTRYVALUE.IS_FULFILLED",
+                                    "CHECKLISTENTRYVALUE.OBJECT_ROWID", 
+                                    "CHECKLISTENTRYVALUE.OBJECT_TYPE", 
+                                    "CHECKLISTENTRYVALUE.USER_EDIT", 
+                                    "CHECKLISTENTRYVALUE.USER_NEW"])
                                     .from("CHECKLISTENTRYVALUE")
                                     .where("CHECKLISTENTRYVALUE.CHECKLISTENTRY_ID", checklistEntries[i][0])
                                     .and("CHECKLISTENTRYVALUE.OBJECT_ROWID", objectRowId)
                                     .arrayRow();
-            if (isExistent.length > 0)
+            if (doesExist.length > 0)
             {
-                checklistEntryValues[i] = isExistent;
+                checklistEntryValues[i] = doesExist;
             }
             else
             {
                 newUid = util.getNewUUID();
                 checklistEntryValues[i] = [newUid, checklistEntries[i][0], newUid, "", vars.get("$sys.date"), "0", objectRowId, "", 
-                                            "null", vars.get("$sys.user")];
-                isExistent = preparedStatements.some(function(pPreparedStatement){
+                                            "null", vars.get("$sys.user"), ""];
+                doesExist = preparedStatements.some(function(pPreparedStatement){
                     return pPreparedStatement[3].includes(checklistEntries[i][0]) && pPreparedStatement[3].includes(objectRowId);
                 });
                 
-                if (!isExistent)
+                if (!doesExist)
                 {
                     preparedStatements.push(["CHECKLISTENTRYVALUE", 
                                             cols,
@@ -89,7 +134,39 @@ for (i = 0; i < checklistEntries.length; i++)
             }
         }
     }
+    checklistEntryValues[i][10] = _checklistEntryDisplayValue(checklistEntries[i][2]);
+    checklistEntryValues[i][11] = checklistEntries[i][3];
+    checklistEntryValues[i][12] = _autoDisplayValue(checklistEntries[i][3]);
 } 
 
-db.inserts(preparedStatements, db.getCurrentAlias());
-result.object(checklistEntryValues);
\ No newline at end of file
+db.inserts(preparedStatements);//insert the ones that don't already exist
+result.object(checklistEntryValues);
+
+
+function _checklistEntryDisplayValue(pChecklistEntryTitle)
+{
+    var displayValue;
+    var verfierFnName = pChecklistEntryTitle;
+                                
+    var verifierFn = $ChecklistEntryRegistry[verfierFnName];
+
+
+    if (Utils.isFunction(verifierFn))
+        displayValue = verifierFn().title;
+    else{
+        displayValue = translate.text(verfierFnName);
+    }
+    return displayValue;
+}
+
+function _autoDisplayValue(pAutoValue)
+{
+    if(pAutoValue == 1)
+    {
+        return translate.text("Automatically");
+    }
+    else
+    {
+        return translate.text("Manually");
+    }
+}
\ No newline at end of file
diff --git a/entity/ChecklistEntry_entity/ChecklistEntry_entity.aod b/entity/ChecklistEntry_entity/ChecklistEntry_entity.aod
index 200dfd8307..3385604c58 100644
--- a/entity/ChecklistEntry_entity/ChecklistEntry_entity.aod
+++ b/entity/ChecklistEntry_entity/ChecklistEntry_entity.aod
@@ -19,13 +19,17 @@
     <entityField>
       <name>TITLE</name>
       <title>Title</title>
+      <mandatory v="true" />
       <dropDownProcess>%aditoprj%/entity/ChecklistEntry_entity/entityfields/title/dropDownProcess.js</dropDownProcess>
       <displayValueProcess>%aditoprj%/entity/ChecklistEntry_entity/entityfields/title/displayValueProcess.js</displayValueProcess>
     </entityField>
     <entityField>
-      <name>TYPE</name>
-      <title>Type</title>
-      <dropDownProcess>%aditoprj%/entity/ChecklistEntry_entity/entityfields/type/dropDownProcess.js</dropDownProcess>
+      <name>AUTO</name>
+      <title>Automatically</title>
+      <contentType>BOOLEAN</contentType>
+      <placeholderProcess>%aditoprj%/entity/ChecklistEntry_entity/entityfields/auto/placeholderProcess.js</placeholderProcess>
+      <displayValueProcess>%aditoprj%/entity/ChecklistEntry_entity/entityfields/auto/displayValueProcess.js</displayValueProcess>
+      <onValueChange>%aditoprj%/entity/ChecklistEntry_entity/entityfields/auto/onValueChange.js</onValueChange>
     </entityField>
     <entityField>
       <name>USER_EDIT</name>
@@ -99,10 +103,6 @@
           <name>TITLE.value</name>
           <recordfield>CHECKLISTENTRY.TITLE</recordfield>
         </dbRecordFieldMapping>
-        <dbRecordFieldMapping>
-          <name>TYPE.value</name>
-          <recordfield>CHECKLISTENTRY.TYPE</recordfield>
-        </dbRecordFieldMapping>
         <dbRecordFieldMapping>
           <name>USER_EDIT.value</name>
           <recordfield>CHECKLISTENTRY.USER_EDIT</recordfield>
@@ -115,6 +115,10 @@
           <name>CHECKLIST_ID.value</name>
           <recordfield>CHECKLISTENTRY.CHECKLIST_ID</recordfield>
         </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>AUTO.value</name>
+          <recordfield>CHECKLISTENTRY.AUTO</recordfield>
+        </dbRecordFieldMapping>
       </recordFieldMappings>
       <linkInformation>
         <linkInformation>
diff --git a/entity/ChecklistEntry_entity/entityfields/auto/displayValueProcess.js b/entity/ChecklistEntry_entity/entityfields/auto/displayValueProcess.js
new file mode 100644
index 0000000000..94bb5f7e4d
--- /dev/null
+++ b/entity/ChecklistEntry_entity/entityfields/auto/displayValueProcess.js
@@ -0,0 +1,14 @@
+import("system.translate");
+import("system.result");
+import("system.vars");
+
+var auto = vars.get("$field.AUTO");
+
+if(auto == 1)
+{
+    result.string(translate.text("Automatically"));
+}
+else
+{
+    result.string(translate.text("Manually"));
+}
\ No newline at end of file
diff --git a/entity/ChecklistEntry_entity/entityfields/auto/onValueChange.js b/entity/ChecklistEntry_entity/entityfields/auto/onValueChange.js
new file mode 100644
index 0000000000..e44082d115
--- /dev/null
+++ b/entity/ChecklistEntry_entity/entityfields/auto/onValueChange.js
@@ -0,0 +1,3 @@
+import("system.neon");
+
+neon.setFieldValue("$field.TITLE", null);
\ No newline at end of file
diff --git a/entity/ChecklistEntry_entity/entityfields/auto/placeholderProcess.js b/entity/ChecklistEntry_entity/entityfields/auto/placeholderProcess.js
new file mode 100644
index 0000000000..7f69ea4c65
--- /dev/null
+++ b/entity/ChecklistEntry_entity/entityfields/auto/placeholderProcess.js
@@ -0,0 +1,4 @@
+import("system.translate");
+import("system.result");
+
+result.string(translate.text("Automatically"));
\ No newline at end of file
diff --git a/entity/ChecklistEntry_entity/entityfields/date_edit/valueProcess.js b/entity/ChecklistEntry_entity/entityfields/date_edit/valueProcess.js
index b1325e5481..7aa6fc91c9 100644
--- a/entity/ChecklistEntry_entity/entityfields/date_edit/valueProcess.js
+++ b/entity/ChecklistEntry_entity/entityfields/date_edit/valueProcess.js
@@ -2,7 +2,7 @@ import("system.vars");
 import("system.result");
 import("system.neon");
 
-if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_EDIT)
+if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT)
 {
     result.string(vars.get("$sys.date"));
 }
\ No newline at end of file
diff --git a/entity/ChecklistEntry_entity/entityfields/date_new/valueProcess.js b/entity/ChecklistEntry_entity/entityfields/date_new/valueProcess.js
index 557358ecb6..e5780ea888 100644
--- a/entity/ChecklistEntry_entity/entityfields/date_new/valueProcess.js
+++ b/entity/ChecklistEntry_entity/entityfields/date_new/valueProcess.js
@@ -2,7 +2,7 @@ import("system.vars");
 import("system.result");
 import("system.neon");
 
-if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_NEW)
+if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null)
 {
     result.string(vars.get("$sys.date"));
 }
\ No newline at end of file
diff --git a/entity/ChecklistEntry_entity/entityfields/title/displayValueProcess.js b/entity/ChecklistEntry_entity/entityfields/title/displayValueProcess.js
index b9d9117ece..8a1672dcd9 100644
--- a/entity/ChecklistEntry_entity/entityfields/title/displayValueProcess.js
+++ b/entity/ChecklistEntry_entity/entityfields/title/displayValueProcess.js
@@ -5,7 +5,7 @@ import("KeywordRegistry_basic");
 
 var title = vars.get("$field.TITLE");
 
-if (vars.get("$field.TYPE") == $KeywordRegistry.checklistEntryType$manual())
+if (vars.get("$field.AUTO") != 1)
 {
     result.string(translate.text(title));
 }
\ No newline at end of file
diff --git a/entity/ChecklistEntry_entity/entityfields/title/dropDownProcess.js b/entity/ChecklistEntry_entity/entityfields/title/dropDownProcess.js
index 3a7f1a267b..b8fce1068b 100644
--- a/entity/ChecklistEntry_entity/entityfields/title/dropDownProcess.js
+++ b/entity/ChecklistEntry_entity/entityfields/title/dropDownProcess.js
@@ -4,7 +4,7 @@ import("KeywordRegistry_basic");
 import("ChecklistEntryRegistry_basic");
 
 
-if (vars.get("$field.TYPE") == $KeywordRegistry.checklistEntryType$auto())
+if (vars.get("$field.AUTO") == 1)
 {
     result.object($ChecklistEntryRegistry.getEntryList());
 }
\ No newline at end of file
diff --git a/entity/ChecklistEntry_entity/entityfields/type/dropDownProcess.js b/entity/ChecklistEntry_entity/entityfields/type/dropDownProcess.js
deleted file mode 100644
index f3b2df2523..0000000000
--- a/entity/ChecklistEntry_entity/entityfields/type/dropDownProcess.js
+++ /dev/null
@@ -1,5 +0,0 @@
-import("system.result");
-import("system.vars");
-import("system.translate");
-
-result.object({"MANUAL":translate.text("Manually"), "AUTO":translate.text("Automatically")});
\ No newline at end of file
diff --git a/entity/ChecklistEntry_entity/entityfields/user_edit/valueProcess.js b/entity/ChecklistEntry_entity/entityfields/user_edit/valueProcess.js
index de5a4ba34e..023108b48d 100644
--- a/entity/ChecklistEntry_entity/entityfields/user_edit/valueProcess.js
+++ b/entity/ChecklistEntry_entity/entityfields/user_edit/valueProcess.js
@@ -2,7 +2,7 @@ import("system.vars");
 import("system.result");
 import("system.neon");
 
-if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_EDIT)
+if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT)
 {
     result.string(vars.get("$sys.user"));
 }
\ No newline at end of file
diff --git a/entity/ChecklistEntry_entity/entityfields/user_new/valueProcess.js b/entity/ChecklistEntry_entity/entityfields/user_new/valueProcess.js
index c2c237153f..97e43c18a2 100644
--- a/entity/ChecklistEntry_entity/entityfields/user_new/valueProcess.js
+++ b/entity/ChecklistEntry_entity/entityfields/user_new/valueProcess.js
@@ -2,7 +2,7 @@ import("system.vars");
 import("system.result");
 import("system.neon");
 
-if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_NEW)
+if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null)
 {
     result.string(vars.get("$sys.user"));
 }
\ No newline at end of file
diff --git a/entity/Checklist_entity/entityfields/date_edit/valueProcess.js b/entity/Checklist_entity/entityfields/date_edit/valueProcess.js
index b1325e5481..7aa6fc91c9 100644
--- a/entity/Checklist_entity/entityfields/date_edit/valueProcess.js
+++ b/entity/Checklist_entity/entityfields/date_edit/valueProcess.js
@@ -2,7 +2,7 @@ import("system.vars");
 import("system.result");
 import("system.neon");
 
-if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_EDIT)
+if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT)
 {
     result.string(vars.get("$sys.date"));
 }
\ No newline at end of file
diff --git a/entity/Checklist_entity/entityfields/date_new/valueProcess.js b/entity/Checklist_entity/entityfields/date_new/valueProcess.js
index 557358ecb6..779344e196 100644
--- a/entity/Checklist_entity/entityfields/date_new/valueProcess.js
+++ b/entity/Checklist_entity/entityfields/date_new/valueProcess.js
@@ -2,7 +2,7 @@ import("system.vars");
 import("system.result");
 import("system.neon");
 
-if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_NEW)
+if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW)
 {
     result.string(vars.get("$sys.date"));
 }
\ No newline at end of file
diff --git a/entity/Checklist_entity/entityfields/user_edit/valueProcess.js b/entity/Checklist_entity/entityfields/user_edit/valueProcess.js
index de5a4ba34e..023108b48d 100644
--- a/entity/Checklist_entity/entityfields/user_edit/valueProcess.js
+++ b/entity/Checklist_entity/entityfields/user_edit/valueProcess.js
@@ -2,7 +2,7 @@ import("system.vars");
 import("system.result");
 import("system.neon");
 
-if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_EDIT)
+if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT)
 {
     result.string(vars.get("$sys.user"));
 }
\ No newline at end of file
diff --git a/entity/Checklist_entity/entityfields/user_new/valueProcess.js b/entity/Checklist_entity/entityfields/user_new/valueProcess.js
index c2c237153f..97e43c18a2 100644
--- a/entity/Checklist_entity/entityfields/user_new/valueProcess.js
+++ b/entity/Checklist_entity/entityfields/user_new/valueProcess.js
@@ -2,7 +2,7 @@ import("system.vars");
 import("system.result");
 import("system.neon");
 
-if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_NEW)
+if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null)
 {
     result.string(vars.get("$sys.user"));
 }
\ No newline at end of file
diff --git a/entity/Member_entity/Member_entity.aod b/entity/Member_entity/Member_entity.aod
index 2d994f8014..2352659698 100644
--- a/entity/Member_entity/Member_entity.aod
+++ b/entity/Member_entity/Member_entity.aod
@@ -456,7 +456,6 @@
       <name>jdito</name>
       <jDitoRecordAlias>Data_alias</jDitoRecordAlias>
       <isFilterable v="true" />
-      <isSortable v="true" />
       <contentProcess>%aditoprj%/entity/Member_entity/recordcontainers/jdito/contentProcess.js</contentProcess>
       <onInsert>%aditoprj%/entity/Member_entity/recordcontainers/jdito/onInsert.js</onInsert>
       <onUpdate>%aditoprj%/entity/Member_entity/recordcontainers/jdito/onUpdate.js</onUpdate>
diff --git a/entity/Member_entity/recordcontainers/jdito/contentProcess.js b/entity/Member_entity/recordcontainers/jdito/contentProcess.js
index 48b27281c4..85d651ee76 100644
--- a/entity/Member_entity/recordcontainers/jdito/contentProcess.js
+++ b/entity/Member_entity/recordcontainers/jdito/contentProcess.js
@@ -128,7 +128,7 @@ if (Utils.isNullOrEmpty(idValues) || memberRows.length === 0)
             row[7],
             "VAADIN:GLOBE",
             "TEXT:" + row[4].substring(row[4].indexOf(" ", 0)+1, row[4].length),
-            "MEMBERROLEDISTRICTRESPONSIBLE",
+            "70cbad1b-eac6-4369-ba50-4946e0fbcb3a",
             translate.text("District Responsible"),
             vars.get("$param.ObjectRowId_param"),
             vars.get("$param.ObjectType_param"),
diff --git a/entity/SalesprojectPhaseDefinition_entity/entityfields/date_edit/valueProcess.js b/entity/SalesprojectPhaseDefinition_entity/entityfields/date_edit/valueProcess.js
index 4b3fffc0c6..e22054c04f 100644
--- a/entity/SalesprojectPhaseDefinition_entity/entityfields/date_edit/valueProcess.js
+++ b/entity/SalesprojectPhaseDefinition_entity/entityfields/date_edit/valueProcess.js
@@ -5,7 +5,7 @@ import("system.result");
 
 var currentDate = null;
 
-if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_EDIT)
+if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT)
 {
     currentUser = vars.get("$sys.date");
 }
diff --git a/entity/SalesprojectPhaseDefinition_entity/entityfields/date_new/valueProcess.js b/entity/SalesprojectPhaseDefinition_entity/entityfields/date_new/valueProcess.js
index b4e0581883..e1f0aceaa6 100644
--- a/entity/SalesprojectPhaseDefinition_entity/entityfields/date_new/valueProcess.js
+++ b/entity/SalesprojectPhaseDefinition_entity/entityfields/date_new/valueProcess.js
@@ -5,7 +5,7 @@ import("system.result");
 
 var currentDate = null;
 
-if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_NEW)
+if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null)
 {
     currentUser = vars.get("$sys.date");
 }
diff --git a/entity/SalesprojectPhaseDefinition_entity/entityfields/phase/dropDownProcess.js b/entity/SalesprojectPhaseDefinition_entity/entityfields/phase/dropDownProcess.js
index 268d3b2dc5..ec6a82d81c 100644
--- a/entity/SalesprojectPhaseDefinition_entity/entityfields/phase/dropDownProcess.js
+++ b/entity/SalesprojectPhaseDefinition_entity/entityfields/phase/dropDownProcess.js
@@ -4,7 +4,6 @@ import("KeywordRegistry_basic");
 import("Keyword_lib");
 import("Sql_lib");
 
-
 var salesprojectPhases = KeywordUtils.getEntryNamesAndIdsByContainer($KeywordRegistry.salesprojectPhase());
 var dropDownEntries = [];
 var counter = 0;
@@ -13,11 +12,12 @@ var exisitingPhases = newSelect("PHASE")
                         .from("SALESPROJECTPHASEDEFINITION")
                         .arrayColumn();
 
-salesprojectPhases.forEach(function(pSalesprojectPhase){
-    
-    var isExistent = exisitingPhases.includes(pSalesprojectPhase[0]);
+salesprojectPhases.forEach(function(pSalesprojectPhase)
+{
+    var doesExist = exisitingPhases.includes(pSalesprojectPhase[0]);
     
-    if (!isExistent || (vars.get("$field.PHASE") == pSalesprojectPhase[0])) {
+    if (!doesExist)
+    {
         dropDownEntries[counter] = [pSalesprojectPhase[0], pSalesprojectPhase[1]];
     }
     
diff --git a/entity/SalesprojectPhaseDefinition_entity/entityfields/phase/onValidation.js b/entity/SalesprojectPhaseDefinition_entity/entityfields/phase/onValidation.js
index 61a58a6872..447fe3e410 100644
--- a/entity/SalesprojectPhaseDefinition_entity/entityfields/phase/onValidation.js
+++ b/entity/SalesprojectPhaseDefinition_entity/entityfields/phase/onValidation.js
@@ -11,14 +11,14 @@ if(thisValue != null && thisValue != "" &&
     vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_NEW &&
     thisValue != vars.get("$field.PHASE"))
 {
-   var isExistent = newSelect("COUNT(*)")
+   var doesExist = newSelect("COUNT(*)")
                     .from("SALESPROJECTPHASEDEFINITION")
                     .where("SALESPROJECTPHASEDEFINITION.SALESPROJECTPHASE", localValue)
                     .cell();
     
-    if (isExistent > 0)
+    if (doesExist > 0)
     {
-        result.string(translate.text("For this salesproject phase are already traits defined."));
+        result.string(translate.text("Traits have already been defined for this salesproject phase."));
     }
 }
                     
diff --git a/entity/SalesprojectPhaseDefinition_entity/entityfields/user_edit/valueProcess.js b/entity/SalesprojectPhaseDefinition_entity/entityfields/user_edit/valueProcess.js
index a55cb32746..4ce39f0d7b 100644
--- a/entity/SalesprojectPhaseDefinition_entity/entityfields/user_edit/valueProcess.js
+++ b/entity/SalesprojectPhaseDefinition_entity/entityfields/user_edit/valueProcess.js
@@ -5,7 +5,7 @@ import("system.result");
 
 var currentUser = null;
 
-if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_EDIT)
+if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT)
 {
     currentUser = vars.get("$sys.user");
 }
diff --git a/entity/SalesprojectPhaseDefinition_entity/entityfields/user_new/valueProcess.js b/entity/SalesprojectPhaseDefinition_entity/entityfields/user_new/valueProcess.js
index 1411b9ac93..9257fbfc20 100644
--- a/entity/SalesprojectPhaseDefinition_entity/entityfields/user_new/valueProcess.js
+++ b/entity/SalesprojectPhaseDefinition_entity/entityfields/user_new/valueProcess.js
@@ -5,7 +5,7 @@ import("system.result");
 
 var currentUser = null;
 
-if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_NEW)
+if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null)
 {
     currentUser = vars.get("$sys.user");
 }
diff --git a/entity/SalesprojectPhaseDefinition_entity/iconIdProcess.js b/entity/SalesprojectPhaseDefinition_entity/iconIdProcess.js
index b647759848..8785776266 100644
--- a/entity/SalesprojectPhaseDefinition_entity/iconIdProcess.js
+++ b/entity/SalesprojectPhaseDefinition_entity/iconIdProcess.js
@@ -1,4 +1,4 @@
 import("system.vars");
 import("system.result");
 
-result.string("TEXT:" + vars.getString("$field.PHASE").substr(vars.getString("$field.PHASE").indexOf("PHASE",0)+5, vars.getString("$field.PHASE").length).trim());
\ No newline at end of file
+result.string("TEXT:" + vars.getString("$field.PHASE.displayValue"));
\ No newline at end of file
diff --git a/entity/SalesprojectPhaseDefinition_entity/recordcontainers/db/recordfieldmappings/phase.displayvalue/expression.js b/entity/SalesprojectPhaseDefinition_entity/recordcontainers/db/recordfieldmappings/phase.displayvalue/expression.js
index c566f14a5d..d86536b1bd 100644
--- a/entity/SalesprojectPhaseDefinition_entity/recordcontainers/db/recordfieldmappings/phase.displayvalue/expression.js
+++ b/entity/SalesprojectPhaseDefinition_entity/recordcontainers/db/recordfieldmappings/phase.displayvalue/expression.js
@@ -4,6 +4,5 @@ import("KeywordRegistry_basic");
 import("Sql_lib");
 
 var resolvingSql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.salesprojectPhase(), "SALESPROJECTPHASEDEFINITION.SALESPROJECTPHASE");
-//var sql = "case when SALESPROJECT_PHASE = '" + $KeywordRegistry.salesprojectPhase$offer() + "' THEN 'Offer' ELSE (" + resolvingSql.toString() + ") end";
 
 result.string(resolvingSql);
diff --git a/entity/Salesproject_entity/entityfields/checklistentryvalues/children/checklistid_param/valueProcess.js b/entity/Salesproject_entity/entityfields/checklistentryvalues/children/checklistid_param/valueProcess.js
index 7d139bbd21..2a921546e3 100644
--- a/entity/Salesproject_entity/entityfields/checklistentryvalues/children/checklistid_param/valueProcess.js
+++ b/entity/Salesproject_entity/entityfields/checklistentryvalues/children/checklistid_param/valueProcess.js
@@ -4,7 +4,7 @@ import("KeywordRegistry_basic");
 import("Sql_lib");
 
 
-var checklistId = newSelect("CHECKLIST_ID")
+var checklistId = newSelect("SALESPROJECTPHASEDEFINITION.CHECKLIST_ID")
                         .from("SALESPROJECTPHASEDEFINITION")
                         .where("SALESPROJECTPHASEDEFINITION.PHASE", vars.get("$field.PHASE"))
                         .cell();
diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
index 4977ca9962..553c663568 100644
--- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
+++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
@@ -8097,6 +8097,9 @@
     <entry>
       <key>Add %0 Observations</key>
     </entry>
+    <entry>
+      <key>Traits have already been defined for this salesproject phase.</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 eb940e2e18..88793e214b 100644
--- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
+++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
@@ -10688,6 +10688,14 @@ Bitte Datumseingabe prüfen</value>
       <key>Add %0 Observations</key>
       <value>%0 Beobachtungen hinzufügen</value>
     </entry>
+    <entry>
+      <key>Traits have already been defined for this salesproject phase.</key>
+      <value>Für diese Vertriebsprojektphase wurden schon Merkmale festgelegt.</value>
+    </entry>
+    <entry>
+      <key>Automatically</key>
+      <value>Automatisch</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 0a5ecf54a3..9aa2162509 100644
--- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod
+++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod
@@ -8199,6 +8199,9 @@
     <entry>
       <key>Add %0 Observations</key>
     </entry>
+    <entry>
+      <key>Traits have already been defined for this salesproject phase.</key>
+    </entry>
   </keyValueMap>
   <font name="Dialog" style="0" size="11" />
 </language>
diff --git a/neonView/ChecklistEntryList_view/ChecklistEntryList_view.aod b/neonView/ChecklistEntryList_view/ChecklistEntryList_view.aod
index 9928f472cb..73632c6d2d 100644
--- a/neonView/ChecklistEntryList_view/ChecklistEntryList_view.aod
+++ b/neonView/ChecklistEntryList_view/ChecklistEntryList_view.aod
@@ -10,7 +10,7 @@
   <children>
     <titledListViewTemplate>
       <name>titledListViewTemplate</name>
-      <titleField>TYPE</titleField>
+      <titleField>AUTO</titleField>
       <columns>
         <neonTitledListTableColumn>
           <name>49ad66e3-645d-489a-8bf8-d56645cf5465</name>
diff --git a/neonView/ChecklistEntryMultiEdit_view/ChecklistEntryMultiEdit_view.aod b/neonView/ChecklistEntryMultiEdit_view/ChecklistEntryMultiEdit_view.aod
index 5aa3bfcace..97fdc36b6f 100644
--- a/neonView/ChecklistEntryMultiEdit_view/ChecklistEntryMultiEdit_view.aod
+++ b/neonView/ChecklistEntryMultiEdit_view/ChecklistEntryMultiEdit_view.aod
@@ -14,7 +14,7 @@
       <columns>
         <neonGenericMultipleTableColumn>
           <name>f139b472-471b-45ef-8406-f11fe052e246</name>
-          <entityField>TYPE</entityField>
+          <entityField>AUTO</entityField>
         </neonGenericMultipleTableColumn>
         <neonGenericMultipleTableColumn>
           <name>ed1eb021-aad1-4228-bcdf-eef2d44f53f8</name>
diff --git a/neonView/ChecklistEntryValueList_view/ChecklistEntryValueList_view.aod b/neonView/ChecklistEntryValueList_view/ChecklistEntryValueList_view.aod
index 1f86e623f5..05829b4051 100644
--- a/neonView/ChecklistEntryValueList_view/ChecklistEntryValueList_view.aod
+++ b/neonView/ChecklistEntryValueList_view/ChecklistEntryValueList_view.aod
@@ -24,7 +24,7 @@
         </neonTableColumn>
         <neonTableColumn>
           <name>35a60394-91ad-4e39-85b4-683564604e97</name>
-          <entityField>type</entityField>
+          <entityField>AUTO</entityField>
         </neonTableColumn>
         <neonTableColumn>
           <name>56a78ef9-dcef-4d1c-b30d-5c89f38611ec</name>
diff --git a/process/ChecklistEntryRegistry_basic/process.js b/process/ChecklistEntryRegistry_basic/process.js
index 496eda6a2e..c274a6670e 100644
--- a/process/ChecklistEntryRegistry_basic/process.js
+++ b/process/ChecklistEntryRegistry_basic/process.js
@@ -9,8 +9,24 @@ import("KeywordRegistry_basic");
 import("Sql_lib");
 
 
+
 /**
- * Returns the matching rows, to the defined parameters.
+ * Provides a central place where all checklist entries with type 'AUTO' are defined.
+ * All defined entries has to return a object of type "ChecklistEntry".
+ * <p>
+ * This object has an attribute named: <u><b><i>verifierFn</i></u></b>. This attribute is a function, which
+ * expects the uid/object-rowid as param and is, how the name implies, responsible for
+ * verifying, whether the checklist entry is fulfilled or not.
+ * 
+ * @class
+ * 
+ * @example
+ * $ChecklistEntryRegistry.salesprojectRoleProjManager()
+ */
+function $ChecklistEntryRegistry(){}
+
+/**
+ * Returns the matching rows, to the defined parameters, ignoring Permissions.
  * 
  * @param {String} pUid                 <p>
  *                                      The uid of the corresponding data set.
@@ -23,7 +39,8 @@ import("Sql_lib");
  * @param {String} pProvider            <p>
  *                                      An provider for loading the rows.
  */
-function _getRows(pUid, pEntity, pFields, pParameters, pProvider){
+$ChecklistEntryRegistry._getRows = function(pUid, pEntity, pFields, pParameters, pProvider)
+{
     
     var config = entities.createConfigForLoadingRows()
                             .entity(pEntity)
@@ -52,22 +69,6 @@ function _getRows(pUid, pEntity, pFields, pParameters, pProvider){
 
     return entities.getRows(config);
 }
-
-/**
- * Provides a central place where all checklist entries with type 'AUTO' are defined.
- * All defined entries has to return a object of type "ChecklistEntry".
- * <p>
- * This object has an attribute named: <u><b><i>verifierFn</i></u></b>. This attribute is a function, which
- * expects the uid/object-rowid as param and is, how the name implies, responsible for
- * verifying, whether the checklist entry is fulfilled or not.
- * 
- * @class
- * 
- * @example
- * $ChecklistEntryRegistry.salesprojectRoleProjManager()
- */
-function $ChecklistEntryRegistry(){}
-
 /*
  * Returns you a list of all existing entries as object <br>
  * <i><u>(key: functionname & value: title)</u></i><br>
@@ -81,7 +82,7 @@ $ChecklistEntryRegistry.getEntryList = function(){
     var returnableList = {};
     
     rawList.forEach(function(pEntry){
-        if (!(pEntry == 'getEntryList'))
+        if (pEntry != 'getEntryList' && pEntry != '_getRows')//ignore the functions (main reason being performance)
         {
             returnableList[pEntry] = $ChecklistEntryRegistry[pEntry]().title;
         }
@@ -100,8 +101,10 @@ $ChecklistEntryRegistry.salesprojectRoleProjManager = function(){
         title: translate.text("Project team: \"Project manager\""),
         verifierFn: function(pSalesprojectId){
             
-            var spRows = _getRows(pSalesprojectId, "Salesproject_entity", ["SALESPROJECTID", "MST_TEAM_ID", "PROJECTCODE"], null, "NoPhaseRequirementLoading");
-            var memberRows = _getRows(null, "Member_entity", ["MEMBERROLE"], [["EnableMSTeams_param", spRows[0]["MST_TEAM_ID"]], ["ObjectRowId_param", spRows[0]["SALESPROJECTID"]]], "WithDistrictResponsibles");
+            var spRows = $ChecklistEntryRegistry._getRows(pSalesprojectId, "Salesproject_entity", ["SALESPROJECTID", "MST_TEAM_ID", "PROJECTCODE"], null, "NoPhaseRequirementLoading");
+            var memberRows = $ChecklistEntryRegistry._getRows(null, "Member_entity", ["MEMBERROLE"], [["EnableMSTeams_param", spRows[0]["MST_TEAM_ID"]], 
+                                                                    ["ObjectRowId_param", spRows[0]["SALESPROJECTID"]]], "WithDistrictResponsibles");
+            
             for (let i = 0; i < memberRows.length; i++) 
             {
                 if(memberRows[i]["MEMBERROLE"] == $KeywordRegistry.memberRoleProjManag())
@@ -124,8 +127,8 @@ $ChecklistEntryRegistry.salesprojectTouchpoint = function(){
         title: translate.text("Touchpoint"),
         verifierFn: function(pSalesprojectId){
             
-            var spRows = _getRows(pSalesprojectId, "Salesproject_entity", ["SALESPROJECTID", "MST_TEAM_ID", "PROJECTCODE"], null, "NoPhaseRequirementLoading");
-            var touchpintRows = _getRows(null, "SalesprojectSource_entity", ["SALESPROJECT_TOUCHPOINTID"], [["SalesprojectId_param", pSalesprojectId]], "SalesprojectSouces");
+            var spRows = $ChecklistEntryRegistry._getRows(pSalesprojectId, "Salesproject_entity", ["SALESPROJECTID", "MST_TEAM_ID", "PROJECTCODE"], null, "NoPhaseRequirementLoading");
+            var touchpintRows = $ChecklistEntryRegistry._getRows(null, "SalesprojectSource_entity", ["SALESPROJECT_TOUCHPOINTID"], [["SalesprojectId_param", pSalesprojectId]], "SalesprojectSouces");
             if(touchpintRows.length > 0) 
             {
                 return true;
@@ -145,7 +148,7 @@ $ChecklistEntryRegistry.salesprojectVolume = function(){
         title: translate.text("Volume"),
         verifierFn: function(pSalesprojectId){
             
-            var spRows = _getRows(pSalesprojectId, "Salesproject_entity", ["VOLUME"], null, "NoPhaseRequirementLoading");
+            var spRows = $ChecklistEntryRegistry._getRows(pSalesprojectId, "Salesproject_entity", ["VOLUME"], null, "NoPhaseRequirementLoading");
             if(spRows[0]["VOLUME"] && spRows[0]["VOLUME"] != "") 
             {
                 return true;
@@ -165,7 +168,7 @@ $ChecklistEntryRegistry.salesprojectProjStart = function(){
         title: translate.text("Project start"),
         verifierFn: function(pSalesprojectId){
             
-            var spRows = _getRows(pSalesprojectId, "Salesproject_entity", ["STARTDATE"], null, "NoPhaseRequirementLoading");
+            var spRows = $ChecklistEntryRegistry._getRows(pSalesprojectId, "Salesproject_entity", ["STARTDATE"], null, "NoPhaseRequirementLoading");
             if(spRows[0]["STARTDATE"] && spRows[0]["STARTDATE"] != "") 
             {
                 return true;
@@ -185,7 +188,7 @@ $ChecklistEntryRegistry.salesprojectClassificationFields = function(){
         title: translate.text("Classification fields"),
         verifierFn: function(pSalesprojectId){
             var res = false;
-            var classificationRows = _getRows(null, "Classification_entity", ["VALUE"], [["ObjectType_param", "Salesproject"], ["ObjectRowid_param", pSalesprojectId]], "Classifications");
+            var classificationRows = $ChecklistEntryRegistry._getRows(null, "Classification_entity", ["VALUE"], [["ObjectType_param", "Salesproject"], ["ObjectRowid_param", pSalesprojectId]], "Classifications");
             if(classificationRows.length > 0)
             {
                 res = true
@@ -212,8 +215,8 @@ $ChecklistEntryRegistry.salesprojectRoleIntDist = function(){
         title: translate.text("Project team: \"Internal distribution\""),
         verifierFn: function(pSalesprojectId){
             
-            var spRows = _getRows(pSalesprojectId, "Salesproject_entity", ["SALESPROJECTID", "MST_TEAM_ID", "PROJECTCODE"], null, "NoPhaseRequirementLoading");
-            var memberRows = _getRows(null, "Member_entity", ["MEMBERROLE"], [["EnableMSTeams_param", spRows[0]["MST_TEAM_ID"]], ["ObjectRowId_param", spRows[0]["SALESPROJECTID"]]], "WithDistrictResponsibles");
+            var spRows = $ChecklistEntryRegistry._getRows(pSalesprojectId, "Salesproject_entity", ["SALESPROJECTID", "MST_TEAM_ID", "PROJECTCODE"], null, "NoPhaseRequirementLoading");
+            var memberRows = $ChecklistEntryRegistry._getRows(null, "Member_entity", ["MEMBERROLE"], [["EnableMSTeams_param", spRows[0]["MST_TEAM_ID"]], ["ObjectRowId_param", spRows[0]["SALESPROJECTID"]]], "WithDistrictResponsibles");
             for (let i = 0; i < memberRows.length; i++) 
             {
                 if(memberRows[i]["MEMBERROLE"] == $KeywordRegistry.memberRoleIntenDistrib())
@@ -236,9 +239,9 @@ $ChecklistEntryRegistry.salesprojectTeamRoles = function(){
         title: translate.text("Project team roles"),
         verifierFn: function(pSalesprojectId){
             
-            var spRows = _getRows(pSalesprojectId, "Salesproject_entity", ["SALESPROJECTID", "MST_TEAM_ID", "PROJECTCODE"], null, "NoPhaseRequirementLoading");
-            var memberRows = _getRows(null, "Member_entity", ["MEMBERROLE"], [["EnableMSTeams_param", spRows[0]["MST_TEAM_ID"]], ["ObjectRowId_param", spRows[0]["SALESPROJECTID"]]], "WithDistrictResponsibles");
-            var allMemberRoles = newSelect(SqlBuilder.caseWhen(newWhere("AB_KEYWORD_ENTRY.KEYID", "MEMROLEDISTRICTRESPONSIBLE")).thenString("70cbad1b-eac6-4369-ba50-4946e0fbcb3a").elseValue("AB_KEYWORD_ENTRY.KEYID"))
+            var spRows = $ChecklistEntryRegistry._getRows(pSalesprojectId, "Salesproject_entity", ["SALESPROJECTID", "MST_TEAM_ID", "PROJECTCODE"], null, "NoPhaseRequirementLoading");
+            var memberRows = $ChecklistEntryRegistry._getRows(null, "Member_entity", ["MEMBERROLE"], [["EnableMSTeams_param", spRows[0]["MST_TEAM_ID"]], ["ObjectRowId_param", spRows[0]["SALESPROJECTID"]]], "WithDistrictResponsibles");
+            var allMemberRoles = newSelect("AB_KEYWORD_ENTRY.KEYID")
                                             .from("AB_KEYWORD_ENTRY")
                                             .where("AB_KEYWORD_ENTRY.AB_KEYWORD_CATEGORY_ID", KeywordUtils.getCategoryIdByName($KeywordRegistry.MemberRole()))
                                             .arrayColumn();
@@ -273,7 +276,7 @@ $ChecklistEntryRegistry.salesprojectOfferExists = function(){
         title: translate.text("Offer exists"),
         verifierFn: function(pSalesprojectId){
             
-            var offerRows = _getRows(null, "Offer_entity", ["OFFERID"], [["ObjectRowId_param", pSalesprojectId], ["ObjectType_param", "Salesproject"]], "Links");
+            var offerRows = $ChecklistEntryRegistry._getRows(null, "Offer_entity", ["OFFERID"], [["ObjectRowId_param", pSalesprojectId], ["ObjectType_param", "Salesproject"]], "Links");
             if(offerRows.length > 0) 
             {
                 return true;
@@ -293,7 +296,7 @@ $ChecklistEntryRegistry.salesprojectProjStart12 = function(){
         title: translate.text("Project start within next 12 months"),
         verifierFn: function(pSalesprojectId){
             
-            var spRows = _getRows(pSalesprojectId, "Salesproject_entity", ["STARTDATE"], null, "NoPhaseRequirementLoading");
+            var spRows = $ChecklistEntryRegistry._getRows(pSalesprojectId, "Salesproject_entity", ["STARTDATE"], null, "NoPhaseRequirementLoading");
 
             for (let i = 0; i < spRows.length; i++) 
             {
@@ -324,7 +327,7 @@ $ChecklistEntryRegistry.salesprojectOfferSent = function(){
         title: translate.text("Offer sent"),
         verifierFn: function(pSalesprojectId){
             
-            var offerRows = _getRows(null, "Offer_entity", ["STATUS"], [["ObjectRowId_param", pSalesprojectId], ["ObjectType_param", "Salesproject"]], "Links");
+            var offerRows = $ChecklistEntryRegistry._getRows(null, "Offer_entity", ["STATUS"], [["ObjectRowId_param", pSalesprojectId], ["ObjectType_param", "Salesproject"]], "Links");
             var res = false;
 
             for (let i = 0; i < offerRows.length; i++)
@@ -350,7 +353,7 @@ $ChecklistEntryRegistry.salesprojectProb100 = function(){
         title: translate.text("Probablity: 100%"),
         verifierFn: function(pSalesprojectId){
             
-            var spRows = _getRows(pSalesprojectId, "Salesproject_entity", ["PROBABILITY"], null, "NoPhaseRequirementLoading");
+            var spRows = $ChecklistEntryRegistry._getRows(pSalesprojectId, "Salesproject_entity", ["PROBABILITY"], null, "NoPhaseRequirementLoading");
             if(spRows[0]["PROBABILITY"] && parseInt(spRows[0]["PROBABILITY"]) == 100) 
             {
                 return true;
@@ -370,7 +373,7 @@ $ChecklistEntryRegistry.salesprojectStatusWon = function(){
         title: translate.text("Status: \"won\""),
         verifierFn: function(pSalesprojectId){
             
-            var spRows = _getRows(pSalesprojectId, "Salesproject_entity", ["STATUS"], null, "NoPhaseRequirementLoading");
+            var spRows = $ChecklistEntryRegistry._getRows(pSalesprojectId, "Salesproject_entity", ["STATUS"], null, "NoPhaseRequirementLoading");
             if(spRows[0]["STATUS"] && (spRows[0]["STATUS"] == $KeywordRegistry.salesprojectState$partialOrder() ||
                     spRows[0]["STATUS"] == $KeywordRegistry.salesprojectState$order())) 
             {
@@ -391,10 +394,10 @@ $ChecklistEntryRegistry.salesprojectContractExists = function(){
         title: translate.text("Contract"),
         verifierFn: function(pSalesprojectId){
             
-            var offerRows = _getRows(null, "Offer_entity", ["OFFERID"], [["ObjectRowId_param", pSalesprojectId], ["ObjectType_param", "Salesproject"]], "Links");
+            var offerRows = $ChecklistEntryRegistry._getRows(null, "Offer_entity", ["OFFERID"], [["ObjectRowId_param", pSalesprojectId], ["ObjectType_param", "Salesproject"]], "Links");
             for (let i = 0; i < offerRows.length; i++) 
             {
-                var documentRows = _getRows(null, "Document_entity", ["BINDATA_UPLOAD"], [["AssignmentRowId_param", offerRows[i]["OFFERID"]], ["AssignmentTable_param", "OFFER"]], "Documents");
+                var documentRows = $ChecklistEntryRegistry._getRows(null, "Document_entity", ["BINDATA_UPLOAD"], [["AssignmentRowId_param", offerRows[i]["OFFERID"]], ["AssignmentTable_param", "OFFER"]], "Documents");
                 if(documentRows.length>0)
                 {
                     return true;
diff --git a/process/KeywordRegistry_basic/process.js b/process/KeywordRegistry_basic/process.js
index ed67820926..6a21f8cc5c 100644
--- a/process/KeywordRegistry_basic/process.js
+++ b/process/KeywordRegistry_basic/process.js
@@ -341,6 +341,7 @@ $KeywordRegistry.knowledgePublishLevel$public = function(){return "PUBLIC";}
 $KeywordRegistry.visitPlanEntryStatusAppointment = function(){return "VisitPlanEntryStatusAppointment";};
 $KeywordRegistry.visitPlanEntryStatusAppointment$requested = function(){return "VISITSTATUSAPPOINTMENTREQUESTED";};
 $KeywordRegistry.visitPlanEntryStatusAppointment$confirmed = function(){return "VISITSTATUSAPPOINTMENTCONFIRMED";};
+$KeywordRegistry.knowledgePublishLevel$public = function(){return "PUBLIC";}
 
 $KeywordRegistry.notificationPriority = function(){ return "NotificationPriority";};
 $KeywordRegistry.notificationPriority$none = function(){ return "NONE";};
-- 
GitLab