From 37df9c58e6ce4c57a2dd1fb5eb4657446e3cb798 Mon Sep 17 00:00:00 2001
From: "d.buechler" <d.buechler@adito.de>
Date: Fri, 24 May 2019 16:22:23 +0200
Subject: [PATCH] =?UTF-8?q?Es=20gibt=20nun=20eine=20Kampagnenplanungsansic?=
 =?UTF-8?q?ht.=20Hier=20wird=20Vollbild=20das=20Gantt=20angezeigt.=20Darin?=
 =?UTF-8?q?=20werden=20alle=20Kampagnen=20und=20die=20darunterliegenden=20?=
 =?UTF-8?q?Stufen=20dargestellt.=20Zus=C3=A4tzlich=20gibt=20es=20neue=20Ac?=
 =?UTF-8?q?tions=20zum=20Anlegen=20neuer=20Datens=C3=A4tze.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../_____SYSTEM_APPLICATION_NEON.aod          |   1 +
 .../CampaignPlanning_entity.aod               | 118 ++++++++++++++++++
 .../onActionProcess.js                        |   6 +
 .../onActionProcess.js                        |  13 ++
 .../recordcontainer/fromClauseProcess.js      |   3 +
 .../recordcontainer/orderClauseProcess.js     |   4 +
 .../entityfields/campaign_id/valueProcess.js  |   1 -
 .../_____LANGUAGE_EXTRA.aod                   |   6 +
 .../_____LANGUAGE_de/_____LANGUAGE_de.aod     |   9 ++
 .../_____LANGUAGE_en/_____LANGUAGE_en.aod     |   6 +
 .../CampaignPlanning/CampaignPlanning.aod     |  15 +++
 .../CampaignPlanning_view.aod                 |  30 +++++
 process/Campaign_lib/process.js               |  10 ++
 13 files changed, 221 insertions(+), 1 deletion(-)
 create mode 100644 entity/CampaignPlanning_entity/CampaignPlanning_entity.aod
 create mode 100644 entity/CampaignPlanning_entity/entityfields/newganttentries/children/createnewcampaign_action/onActionProcess.js
 create mode 100644 entity/CampaignPlanning_entity/entityfields/newganttentries/children/createnewcampaignstep_action/onActionProcess.js
 create mode 100644 entity/CampaignPlanning_entity/recordcontainers/recordcontainer/fromClauseProcess.js
 create mode 100644 entity/CampaignPlanning_entity/recordcontainers/recordcontainer/orderClauseProcess.js
 create mode 100644 neonContext/CampaignPlanning/CampaignPlanning.aod
 create mode 100644 neonView/CampaignPlanning_view/CampaignPlanning_view.aod

diff --git a/application/_____SYSTEM_APPLICATION_NEON/_____SYSTEM_APPLICATION_NEON.aod b/application/_____SYSTEM_APPLICATION_NEON/_____SYSTEM_APPLICATION_NEON.aod
index 3ff69433612..d4ac4336090 100644
--- a/application/_____SYSTEM_APPLICATION_NEON/_____SYSTEM_APPLICATION_NEON.aod
+++ b/application/_____SYSTEM_APPLICATION_NEON/_____SYSTEM_APPLICATION_NEON.aod
@@ -29,6 +29,7 @@
     <node name="Marketing" kind="123" title="Marketing">
       <icon>VAADIN:GROUP</icon>
       <node name="Group4" kind="123" title="">
+        <node name="CampaignPlanning" kind="10077" />
         <node name="Campaign" kind="10077" />
         <node name="INTERNAL_ADMINISTRATOR" kind="159" />
       </node>
diff --git a/entity/CampaignPlanning_entity/CampaignPlanning_entity.aod b/entity/CampaignPlanning_entity/CampaignPlanning_entity.aod
new file mode 100644
index 00000000000..4528a513b46
--- /dev/null
+++ b/entity/CampaignPlanning_entity/CampaignPlanning_entity.aod
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.5" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.5">
+  <name>CampaignPlanning_entity</name>
+  <majorModelMode>DISTRIBUTED</majorModelMode>
+  <icon>NEON:GROUP_APPOINTMENT</icon>
+  <title>Campaign planning</title>
+  <recordContainer>recordContainer</recordContainer>
+  <entityFields>
+    <entityProvider>
+      <name>#PROVIDER</name>
+    </entityProvider>
+    <entityField>
+      <name>DATE_START</name>
+    </entityField>
+    <entityField>
+      <name>DATE_END</name>
+    </entityField>
+    <entityField>
+      <name>STEP_NAME</name>
+    </entityField>
+    <entityField>
+      <name>STEP_DESCRIPTION</name>
+    </entityField>
+    <entityField>
+      <name>STEP_ID</name>
+    </entityField>
+    <entityField>
+      <name>PREDECESSOR_STEP_ID</name>
+    </entityField>
+    <entityField>
+      <name>CAMPAIGN_ID</name>
+      <title>Campaign</title>
+    </entityField>
+    <entityField>
+      <name>CAMPAIGN_NAME</name>
+      <title>CampaignName</title>
+    </entityField>
+    <entityActionGroup>
+      <name>NewGanttEntries</name>
+      <title>New module</title>
+      <iconId>NEON:GROUP_APPOINTMENT</iconId>
+      <children>
+        <entityActionField>
+          <name>CreateNewCampaign_action</name>
+          <fieldType>ACTION</fieldType>
+          <title>New campaign</title>
+          <onActionProcess>%aditoprj%/entity/CampaignPlanning_entity/entityfields/newganttentries/children/createnewcampaign_action/onActionProcess.js</onActionProcess>
+          <iconId>NEON:GROUP_APPOINTMENT</iconId>
+        </entityActionField>
+        <entityActionField>
+          <name>CreateNewCampaignStep_action</name>
+          <fieldType>ACTION</fieldType>
+          <title>New campaign step</title>
+          <onActionProcess>%aditoprj%/entity/CampaignPlanning_entity/entityfields/newganttentries/children/createnewcampaignstep_action/onActionProcess.js</onActionProcess>
+          <iconId>NEON:GROUP_APPOINTMENT</iconId>
+        </entityActionField>
+      </children>
+    </entityActionGroup>
+  </entityFields>
+  <recordContainers>
+    <dbRecordContainer>
+      <name>recordContainer</name>
+      <alias>Data_alias</alias>
+      <fromClauseProcess>%aditoprj%/entity/CampaignPlanning_entity/recordcontainers/recordcontainer/fromClauseProcess.js</fromClauseProcess>
+      <orderClauseProcess>%aditoprj%/entity/CampaignPlanning_entity/recordcontainers/recordcontainer/orderClauseProcess.js</orderClauseProcess>
+      <linkInformation>
+        <linkInformation>
+          <name>091a323d-d1e8-4eec-8f33-0c91bc7f62af</name>
+          <tableName>CAMPAIGN</tableName>
+          <primaryKey>CAMPAIGNID</primaryKey>
+          <isUIDTable v="false" />
+          <readonly v="true" />
+        </linkInformation>
+        <linkInformation>
+          <name>2df8e267-6c25-4bae-bd0f-2b7b4399cc2b</name>
+          <tableName>CAMPAIGNSTEP</tableName>
+          <primaryKey>CAMPAIGNSTEPID</primaryKey>
+          <isUIDTable v="true" />
+          <readonly v="false" />
+        </linkInformation>
+      </linkInformation>
+      <recordFieldMappings>
+        <dbRecordFieldMapping>
+          <name>CAMPAIGN_ID.value</name>
+          <recordfield>CAMPAIGN.CAMPAIGNID</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>CAMPAIGN_NAME.value</name>
+          <recordfield>CAMPAIGN.NAME</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>DATE_END.value</name>
+          <recordfield>CAMPAIGNSTEP.DATE_END</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>DATE_START.value</name>
+          <recordfield>CAMPAIGNSTEP.DATE_START</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>PREDECESSOR_STEP_ID.value</name>
+          <recordfield>CAMPAIGNSTEP.PREDECESSORSTEP_ID</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>STEP_DESCRIPTION.value</name>
+          <recordfield>CAMPAIGNSTEP.DESCRIPTION</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>STEP_ID.value</name>
+          <recordfield>CAMPAIGNSTEP.CAMPAIGNSTEPID</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>STEP_NAME.value</name>
+          <recordfield>CAMPAIGNSTEP.NAME</recordfield>
+        </dbRecordFieldMapping>
+      </recordFieldMappings>
+    </dbRecordContainer>
+  </recordContainers>
+</entity>
diff --git a/entity/CampaignPlanning_entity/entityfields/newganttentries/children/createnewcampaign_action/onActionProcess.js b/entity/CampaignPlanning_entity/entityfields/newganttentries/children/createnewcampaign_action/onActionProcess.js
new file mode 100644
index 00000000000..c86624e8f18
--- /dev/null
+++ b/entity/CampaignPlanning_entity/entityfields/newganttentries/children/createnewcampaign_action/onActionProcess.js
@@ -0,0 +1,6 @@
+import("system.neon");
+import("system.vars");
+import("Campaign_lib");
+
+CampaignUtils.openNewCampaignView();
+neon.refreshAll();
\ No newline at end of file
diff --git a/entity/CampaignPlanning_entity/entityfields/newganttentries/children/createnewcampaignstep_action/onActionProcess.js b/entity/CampaignPlanning_entity/entityfields/newganttentries/children/createnewcampaignstep_action/onActionProcess.js
new file mode 100644
index 00000000000..f63f4b88197
--- /dev/null
+++ b/entity/CampaignPlanning_entity/entityfields/newganttentries/children/createnewcampaignstep_action/onActionProcess.js
@@ -0,0 +1,13 @@
+import("Campaign_lib");
+import("system.vars");
+import("system.logging");
+logging.log("selectionRows -> " + JSON.stringify(vars.get("$sys.selectionRows")));
+var selectedElement = vars.get("$sys.selectionRows");
+if(selectedElement.length > 0)
+{
+    var campaignId = selectedElement[0].CAMPAIGN_ID;
+    logging.log("campaignId -> " + campaignId);
+    if(campaignId != "")
+        CampaignUtils.openNewCampaignStepView(campaignId);
+
+}
\ No newline at end of file
diff --git a/entity/CampaignPlanning_entity/recordcontainers/recordcontainer/fromClauseProcess.js b/entity/CampaignPlanning_entity/recordcontainers/recordcontainer/fromClauseProcess.js
new file mode 100644
index 00000000000..b007b4d58a7
--- /dev/null
+++ b/entity/CampaignPlanning_entity/recordcontainers/recordcontainer/fromClauseProcess.js
@@ -0,0 +1,3 @@
+import("system.result");
+
+result.string("CAMPAIGN join CAMPAIGNSTEP on CAMPAIGN.CAMPAIGNID = CAMPAIGNSTEP.CAMPAIGN_ID")
\ No newline at end of file
diff --git a/entity/CampaignPlanning_entity/recordcontainers/recordcontainer/orderClauseProcess.js b/entity/CampaignPlanning_entity/recordcontainers/recordcontainer/orderClauseProcess.js
new file mode 100644
index 00000000000..8538a702d13
--- /dev/null
+++ b/entity/CampaignPlanning_entity/recordcontainers/recordcontainer/orderClauseProcess.js
@@ -0,0 +1,4 @@
+import("system.result");
+import("system.db");
+
+result.object({"CAMPAIGNSTEP.SORTING": db.ASCENDING});
\ No newline at end of file
diff --git a/entity/CampaignStep_entity/entityfields/campaign_id/valueProcess.js b/entity/CampaignStep_entity/entityfields/campaign_id/valueProcess.js
index e9f19f672c6..5319bbb142e 100644
--- a/entity/CampaignStep_entity/entityfields/campaign_id/valueProcess.js
+++ b/entity/CampaignStep_entity/entityfields/campaign_id/valueProcess.js
@@ -1,5 +1,4 @@
 import("system.neon");
-import("system.logging");
 import("system.result");
 import("system.vars");
 
diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
index fd416261978..ee7ccae401c 100644
--- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
+++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
@@ -3993,6 +3993,12 @@
     <entry>
       <key>Classification group</key>
     </entry>
+    <entry>
+      <key>Campaign planning</key>
+    </entry>
+    <entry>
+      <key>New campaign</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 74713714f4d..ac7d1323774 100644
--- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
+++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
@@ -4008,6 +4008,7 @@
     </entry>
     <entry>
       <key>New campaign step</key>
+      <value>Neue Kampagnenstufe</value>
     </entry>
     <entry>
       <key>Cost</key>
@@ -4970,6 +4971,14 @@
       <key>Predecessor</key>
       <value>Vorgänger</value>
     </entry>
+    <entry>
+      <key>Campaign planning</key>
+      <value>Kampagnenplanung</value>
+    </entry>
+    <entry>
+      <key>New campaign</key>
+      <value>Neue Kampagne</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 ecf54afc603..9eefabd2897 100644
--- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod
+++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod
@@ -3065,6 +3065,9 @@
     <entry>
       <key>New campaign step</key>
     </entry>
+    <entry>
+      <key>New campaign</key>
+    </entry>
     <entry>
       <key>Cost</key>
     </entry>
@@ -4045,6 +4048,9 @@
     <entry>
       <key>Classification group</key>
     </entry>
+    <entry>
+      <key>Campaign planning</key>
+    </entry>
   </keyValueMap>
   <font name="Dialog" style="0" size="11" />
 </language>
diff --git a/neonContext/CampaignPlanning/CampaignPlanning.aod b/neonContext/CampaignPlanning/CampaignPlanning.aod
new file mode 100644
index 00000000000..dfa6d72ea22
--- /dev/null
+++ b/neonContext/CampaignPlanning/CampaignPlanning.aod
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<neonContext xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.0">
+  <name>CampaignPlanning</name>
+  <title>Campaign planning</title>
+  <majorModelMode>DISTRIBUTED</majorModelMode>
+  <mainview>CampaignPlanning_view</mainview>
+  <filterview>CampaignPlanning_view</filterview>
+  <entity>CampaignPlanning_entity</entity>
+  <references>
+    <neonViewReference>
+      <name>7bbaf727-c199-4810-83ed-dcf87416c5f8</name>
+      <view>CampaignPlanning_view</view>
+    </neonViewReference>
+  </references>
+</neonContext>
diff --git a/neonView/CampaignPlanning_view/CampaignPlanning_view.aod b/neonView/CampaignPlanning_view/CampaignPlanning_view.aod
new file mode 100644
index 00000000000..cc64b3fdce6
--- /dev/null
+++ b/neonView/CampaignPlanning_view/CampaignPlanning_view.aod
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.1">
+  <name>CampaignPlanning_view</name>
+  <title>Campaign planning</title>
+  <majorModelMode>DISTRIBUTED</majorModelMode>
+  <layout>
+    <boxLayout>
+      <name>layout</name>
+    </boxLayout>
+  </layout>
+  <children>
+    <ganttViewTemplate>
+      <name>CampaignPlanningGantt</name>
+      <beginDateField>DATE_START</beginDateField>
+      <endDateField>DATE_END</endDateField>
+      <titleField>STEP_NAME</titleField>
+      <descriptionField>STEP_DESCRIPTION</descriptionField>
+      <uidField>STEP_ID</uidField>
+      <stepPredecessorIdField>PREDECESSOR_STEP_ID</stepPredecessorIdField>
+      <groupedProjectIdField>CAMPAIGN_ID</groupedProjectIdField>
+      <groupedProjectNameField>CAMPAIGN_NAME</groupedProjectNameField>
+      <favoriteActionGroup2>NewGanttEntries</favoriteActionGroup2>
+      <entityField>#ENTITY</entityField>
+      <isCreatable v="true" />
+      <isEditable v="true" />
+      <isDeletable v="true" />
+      <title></title>
+    </ganttViewTemplate>
+  </children>
+</neonView>
diff --git a/process/Campaign_lib/process.js b/process/Campaign_lib/process.js
index 73354a0fe49..919065b5adf 100644
--- a/process/Campaign_lib/process.js
+++ b/process/Campaign_lib/process.js
@@ -172,6 +172,16 @@ CampaignUtils.openNewCampaignStepView = function(pCampaignId)
     neon.openContext("CampaignStep", "CampaignStepEdit_view", null, neon.OPERATINGSTATE_NEW, params);
 }
 
+/**
+ * Opens the view to create a new campaign
+ */
+CampaignUtils.openNewCampaignView = function()
+{
+    var params = {};
+    
+    neon.openContext("Campaign", "CampaignEdit_view", null, neon.OPERATINGSTATE_NEW, params);
+}
+
 /**
  * todo
  */
-- 
GitLab