From 0e95a02e4a8e04afe3fb1b388b5bc3f37fc11044 Mon Sep 17 00:00:00 2001
From: Sebastian Pongratz <s.pongratz@adito.de>
Date: Tue, 2 Feb 2021 16:09:17 +0000
Subject: [PATCH] #1072266 projektsart salesproject

---
 .../basic/2021.0.0/addDateNewToSalesproject.xml    | 10 ++++++++++
 .liquibase/Data_alias/basic/2021.0.0/changelog.xml |  1 +
 .../basic/_demoData/generatedData/salesproject.xml |  6 ++++++
 aliasDefinition/Data_alias/Data_alias.aod          | 14 ++++++++++++++
 entity/Salesproject_entity/Salesproject_entity.aod | 10 +++++++---
 .../entityfields/date_new/valueProcess.js          |  9 +++++++++
 .../entityfields/startdate/valueProcess.js         |  9 ---------
 .../SalesprojectFilter_view.aod                    |  8 ++++++++
 .../SalesprojectPreview_view.aod                   |  1 +
 9 files changed, 56 insertions(+), 12 deletions(-)
 create mode 100644 .liquibase/Data_alias/basic/2021.0.0/addDateNewToSalesproject.xml
 create mode 100644 entity/Salesproject_entity/entityfields/date_new/valueProcess.js
 delete mode 100644 entity/Salesproject_entity/entityfields/startdate/valueProcess.js

diff --git a/.liquibase/Data_alias/basic/2021.0.0/addDateNewToSalesproject.xml b/.liquibase/Data_alias/basic/2021.0.0/addDateNewToSalesproject.xml
new file mode 100644
index 0000000000..93663b59e7
--- /dev/null
+++ b/.liquibase/Data_alias/basic/2021.0.0/addDateNewToSalesproject.xml
@@ -0,0 +1,10 @@
+<?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">
+  <changeSet author="s.pongratz" id="37812654-5f30-4256-9704-976567da1dd3">
+        <addColumn tableName="SALESPROJECT">
+            <column name="DATE_NEW" type="DATETIME" />
+        </addColumn>
+  </changeSet>
+</databaseChangeLog>
\ No newline at end of file
diff --git a/.liquibase/Data_alias/basic/2021.0.0/changelog.xml b/.liquibase/Data_alias/basic/2021.0.0/changelog.xml
index 0ec02e0b5d..489408fcec 100644
--- a/.liquibase/Data_alias/basic/2021.0.0/changelog.xml
+++ b/.liquibase/Data_alias/basic/2021.0.0/changelog.xml
@@ -11,4 +11,5 @@
     <include relativeToChangelogFile="true" file="MissingIndizes/add_MissingIndizes.xml"/>
     <include relativeToChangelogFile="true" file="SalesprojectConversion/changelog.xml"/>
     <include relativeToChangelogFile="true" file="Checklists/changelog.xml"/>
+    <include relativeToChangelogFile="true" file="addDateNewToSalesproject.xml"/>
 </databaseChangeLog>
\ No newline at end of file
diff --git a/.liquibase/Data_alias/basic/_demoData/generatedData/salesproject.xml b/.liquibase/Data_alias/basic/_demoData/generatedData/salesproject.xml
index b02071fcb7..501abc4a81 100644
--- a/.liquibase/Data_alias/basic/_demoData/generatedData/salesproject.xml
+++ b/.liquibase/Data_alias/basic/_demoData/generatedData/salesproject.xml
@@ -12,6 +12,7 @@
       <column name="PROJECTTITLE" value="Erstprojekt"/>
       <column name="CONTACT_ID" value="dec94545-2487-46d5-978d-26ee0fcf0f5f"/>
       <column name="STARTDATE" valueDate="2020-05-14T12:00:00"/>
+      <column name="DATE_NEW" valueDate="2020-01-01T11:22:49"/>
       <column name="STATUS" value="SALPROJSTATOPEN"/>
     </insert>
     <insert tableName="salesproject">
@@ -24,6 +25,7 @@
       <column name="PROJECTTITLE" value="Skyscraper / Pilotprojekt"/>
       <column name="CONTACT_ID" value="fc465f2f-803b-4a1f-b79d-7b466d7ecff4"/>
       <column name="STARTDATE" valueDate="2020-05-15T12:00:00"/>
+      <column name="DATE_NEW" valueDate="2020-01-01T11:22:49"/>
       <column name="STATUS" value="SALPROJSTATOPEN"/>
     </insert>
     <insert tableName="salesproject">
@@ -36,6 +38,7 @@
       <column name="PROJECTTITLE" value="Kronen Pilotprojekt"/>
       <column name="CONTACT_ID" value="a3fd3c23-12e1-4820-b76e-2cd70103d94d"/>
       <column name="STARTDATE" valueDate="2020-05-13T12:00:00"/>
+      <column name="DATE_NEW" valueDate="2020-01-01T11:22:49"/>
       <column name="STATUS" value="SALPROJSTATOPEN"/>
     </insert>
     <insert tableName="salesproject">
@@ -48,6 +51,7 @@
       <column name="PROJECTTITLE" value="Transatlantik Initialprojekt"/>
       <column name="CONTACT_ID" value="6efb4fab-64f9-4d8e-aa6f-a158d13fc273"/>
       <column name="STARTDATE" valueDate="2020-05-15T12:00:00"/>
+      <column name="DATE_NEW" valueDate="2020-01-01T11:22:49"/>
       <column name="STATUS" value="SALPROJSTATOPEN"/>
     </insert>
     <insert tableName="salesproject">
@@ -59,6 +63,7 @@
       <column name="PROJECTTITLE" value="Projekt 123"/>
       <column name="CONTACT_ID" value="fb07cb0e-c391-4503-9c47-a39ec7388f4f"/>
       <column name="STARTDATE" valueDate="2020-11-24T12:00:00"/>
+      <column name="DATE_NEW" valueDate="2020-01-01T11:22:49"/>
       <column name="STATUS" value="SALPROJSTATOPEN"/>
     </insert>
     <insert tableName="salesproject">
@@ -71,6 +76,7 @@
       <column name="PROJECTTITLE" value="Buchner Neuprojekt"/>
       <column name="CONTACT_ID" value="019651a4-503e-4e06-aefd-e7e631bf3144"/>
       <column name="STARTDATE" valueDate="2020-02-05T12:00:00"/>
+      <column name="DATE_NEW" valueDate="2020-01-01T11:22:49"/>
       <column name="STATUS" value="SALPROJSTATOPEN"/>
     </insert>
   </changeSet>
diff --git a/aliasDefinition/Data_alias/Data_alias.aod b/aliasDefinition/Data_alias/Data_alias.aod
index eb3430a4a6..f8f3974c8a 100644
--- a/aliasDefinition/Data_alias/Data_alias.aod
+++ b/aliasDefinition/Data_alias/Data_alias.aod
@@ -3786,6 +3786,20 @@
                   </customStringProperty>
                 </customProperties>
               </entityFieldDb>
+              <entityFieldDb>
+                <name>DATE_NEW</name>
+                <dbName></dbName>
+                <primaryKey v="false" />
+                <columnType v="93" />
+                <size v="29" />
+                <scale v="9" />
+                <notNull v="false" />
+                <isUnique v="false" />
+                <index v="false" />
+                <documentation></documentation>
+                <title></title>
+                <description></description>
+              </entityFieldDb>
             </entityFields>
           </entityDb>
           <entityDb>
diff --git a/entity/Salesproject_entity/Salesproject_entity.aod b/entity/Salesproject_entity/Salesproject_entity.aod
index 5300b1def4..614b8dfb06 100644
--- a/entity/Salesproject_entity/Salesproject_entity.aod
+++ b/entity/Salesproject_entity/Salesproject_entity.aod
@@ -124,8 +124,7 @@
       <outputFormat>dd.MM.yyyy</outputFormat>
       <inputFormat>dd.MM.yyyy</inputFormat>
       <groupable v="true" />
-      <mandatory v="true" />
-      <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/startdate/valueProcess.js</valueProcess>
+      <mandatory v="false" />
     </entityField>
     <entityField>
       <name>STATUS</name>
@@ -825,6 +824,10 @@
     </entityField>
     <entityField>
       <name>DATE_NEW</name>
+      <title>Created on</title>
+      <contentType>DATE</contentType>
+      <resolution>DAY</resolution>
+      <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/date_new/valueProcess.js</valueProcess>
     </entityField>
     <entityField>
       <name>ACTIVE</name>
@@ -1005,7 +1008,8 @@
         </dbRecordFieldMapping>
         <dbRecordFieldMapping>
           <name>DATE_NEW.value</name>
-          <recordfield>SALESPROJECT.STARTDATE</recordfield>
+          <recordfield>SALESPROJECT.DATE_NEW</recordfield>
+          <isFilterable v="true" />
         </dbRecordFieldMapping>
         <dbRecordFieldMapping>
           <name>ACTIVE.value</name>
diff --git a/entity/Salesproject_entity/entityfields/date_new/valueProcess.js b/entity/Salesproject_entity/entityfields/date_new/valueProcess.js
new file mode 100644
index 0000000000..0c68e0b1ce
--- /dev/null
+++ b/entity/Salesproject_entity/entityfields/date_new/valueProcess.js
@@ -0,0 +1,9 @@
+import("system.result");
+import("system.neon");
+import("system.vars");
+
+if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW)
+{
+    result.string(vars.get("$sys.date"));
+}
+    
\ No newline at end of file
diff --git a/entity/Salesproject_entity/entityfields/startdate/valueProcess.js b/entity/Salesproject_entity/entityfields/startdate/valueProcess.js
deleted file mode 100644
index 047e11fdb4..0000000000
--- a/entity/Salesproject_entity/entityfields/startdate/valueProcess.js
+++ /dev/null
@@ -1,9 +0,0 @@
-import("system.vars");
-import("system.result");
-import("system.neon");
-import("Date_lib");
-
-if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null)
-{
-    result.string(DateUtils.getTodayUTC());
-}
\ No newline at end of file
diff --git a/neonView/SalesprojectFilter_view/SalesprojectFilter_view.aod b/neonView/SalesprojectFilter_view/SalesprojectFilter_view.aod
index b02721165a..888b2580c7 100644
--- a/neonView/SalesprojectFilter_view/SalesprojectFilter_view.aod
+++ b/neonView/SalesprojectFilter_view/SalesprojectFilter_view.aod
@@ -88,6 +88,10 @@
           <name>88e6bebb-e83d-43ec-82f1-cc778fac458e</name>
           <entityField>CLASSIFICATIONVALUE</entityField>
         </neonTableColumn>
+        <neonTableColumn>
+          <name>c00e5148-54c8-488d-817a-2938e124871b</name>
+          <entityField>DATE_NEW</entityField>
+        </neonTableColumn>
         <neonTableColumn>
           <name>fec843c3-f7c0-42c7-8295-50386651edb2</name>
           <entityField>STARTDATE</entityField>
@@ -137,6 +141,10 @@
           <name>6d9d1365-985a-4357-8ecc-16ddcc201ea8</name>
           <entityField>CLASSIFICATIONVALUE</entityField>
         </neonTreeTableColumn>
+        <neonTreeTableColumn>
+          <name>c5e66669-4e12-4933-94e9-7db5c7688250</name>
+          <entityField>DATE_NEW</entityField>
+        </neonTreeTableColumn>
         <neonTreeTableColumn>
           <name>745d6192-4817-49e6-8cb2-8470c9c25f4d</name>
           <entityField>STARTDATE</entityField>
diff --git a/neonView/SalesprojectPreview_view/SalesprojectPreview_view.aod b/neonView/SalesprojectPreview_view/SalesprojectPreview_view.aod
index 639a366fda..db91bfb1b7 100644
--- a/neonView/SalesprojectPreview_view/SalesprojectPreview_view.aod
+++ b/neonView/SalesprojectPreview_view/SalesprojectPreview_view.aod
@@ -18,6 +18,7 @@
       <descriptionField>PROJECTCODE</descriptionField>
       <favoriteAction1>newActivity</favoriteAction1>
       <entityField>#ENTITY</entityField>
+      <informationField>DATE_NEW</informationField>
     </cardViewTemplate>
     <favoriteViewTemplate>
       <name>Favorites</name>
-- 
GitLab