From bbc46ab163ebac0027be07dd2c24f8e4346c22e4 Mon Sep 17 00:00:00 2001
From: "j.goderbauer" <j.goderbauer@adito.de>
Date: Fri, 1 Mar 2019 15:45:14 +0100
Subject: [PATCH] =?UTF-8?q?[Projekt:=20Entwicklung=20-=20Neon][TicketNr.:?=
 =?UTF-8?q?=201032312][Keywords=20f=C3=BCr=20bestehende=20Module=20anlegen?=
 =?UTF-8?q?]=20Bugfix:=20SalesprojectCompetition?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../SalesprojectCompetition_entity.aod        |   4 +
 .../phase.displayvalue/expression.js          |   2 +-
 .../status.displayvalue/expression.js         |   6 +
 .../2019.2/SalesProjectCompetitionPhase.xml   | 146 ++++++++++++++++++
 .../data_alias/basic/2019.2/changelog.xml     |   1 +
 process/KeywordRegistry_basic/process.js      |   2 +-
 6 files changed, 159 insertions(+), 2 deletions(-)
 create mode 100644 entity/SalesprojectCompetition_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js
 create mode 100644 others/db_changes/data_alias/basic/2019.2/SalesProjectCompetitionPhase.xml

diff --git a/entity/SalesprojectCompetition_entity/SalesprojectCompetition_entity.aod b/entity/SalesprojectCompetition_entity/SalesprojectCompetition_entity.aod
index df1653e530..9b126ea630 100644
--- a/entity/SalesprojectCompetition_entity/SalesprojectCompetition_entity.aod
+++ b/entity/SalesprojectCompetition_entity/SalesprojectCompetition_entity.aod
@@ -319,6 +319,10 @@
           <name>PHASE.displayValue</name>
           <expression>%aditoprj%/entity/SalesprojectCompetition_entity/recordcontainers/db/recordfieldmappings/phase.displayvalue/expression.js</expression>
         </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>STATUS.displayValue</name>
+          <expression>%aditoprj%/entity/SalesprojectCompetition_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js</expression>
+        </dbRecordFieldMapping>
       </recordFieldMappings>
     </dbRecordContainer>
   </recordContainers>
diff --git a/entity/SalesprojectCompetition_entity/recordcontainers/db/recordfieldmappings/phase.displayvalue/expression.js b/entity/SalesprojectCompetition_entity/recordcontainers/db/recordfieldmappings/phase.displayvalue/expression.js
index 09107aba69..37acff54f1 100644
--- a/entity/SalesprojectCompetition_entity/recordcontainers/db/recordfieldmappings/phase.displayvalue/expression.js
+++ b/entity/SalesprojectCompetition_entity/recordcontainers/db/recordfieldmappings/phase.displayvalue/expression.js
@@ -2,5 +2,5 @@ import("system.result");
 import("Keyword_lib");
 import("KeywordRegistry_basic");
 
-var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.salesprojectPhase(), "SALESPROJECT.PHASE");
+var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.salesprojectPhase(), "SALESPROJECT_COMPETITION.PHASE");
 result.string(sql);
\ No newline at end of file
diff --git a/entity/SalesprojectCompetition_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js b/entity/SalesprojectCompetition_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js
new file mode 100644
index 0000000000..2461e0e69c
--- /dev/null
+++ b/entity/SalesprojectCompetition_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js
@@ -0,0 +1,6 @@
+import("system.result");
+import("Keyword_lib");
+import("KeywordRegistry_basic");
+
+var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.salesprojectCompetitionState(), "SALESPROJECT_COMPETITION.STATUS");
+result.string(sql);
diff --git a/others/db_changes/data_alias/basic/2019.2/SalesProjectCompetitionPhase.xml b/others/db_changes/data_alias/basic/2019.2/SalesProjectCompetitionPhase.xml
new file mode 100644
index 0000000000..cc89e52952
--- /dev/null
+++ b/others/db_changes/data_alias/basic/2019.2/SalesProjectCompetitionPhase.xml
@@ -0,0 +1,146 @@
+<?xml version="1.1" encoding="UTF-8" standalone="no"?>
+<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
+    <changeSet author="a.voegl" id="d3255092-9908-46da-aa7f-923f58cf5d68">
+        <renameColumn newColumnName="PHASE_OLD" oldColumnName="PHASE" tableName="SALESPROJECT_COMPETITION"/>
+	<addColumn tableName="SALESPROJECT_COMPETITION">
+            <column name="PHASE" type="CHAR(36)"/>
+	</addColumn> 
+        <update tableName="SALESPROJECT_COMPETITION">
+            <column name="PHASE" value="9f7d1fa9-7c09-4037-8f7c-8458def14d89"/>
+            <where>PHASE_OLD = 1</where>
+        </update>
+        <update tableName="SALESPROJECT_COMPETITION">
+            <column name="PHASE" value="292628f1-d9a5-432d-8130-f6690c14a5d4"/>
+            <where>PHASE_OLD = 2</where>
+        </update>
+        <update tableName="SALESPROJECT_COMPETITION">
+            <column name="PHASE" value="4467b33c-3a68-4c8b-ba4a-1eb666a6c774"/>
+            <where>PHASE_OLD = 3</where>
+        </update>
+        <update tableName="SALESPROJECT_COMPETITION">
+            <column name="PHASE" value="1e42f183-fb97-415f-9917-b43ca159fde4"/>
+            <where>PHASE_OLD = 4</where>
+        </update>
+        <update tableName="SALESPROJECT_COMPETITION">
+            <column name="PHASE" value="972a41dc-a8ae-43cd-a03b-522ea84efbfb"/>
+            <where>PHASE_OLD = 5</where>
+        </update>
+        <update tableName="SALESPROJECT_COMPETITION">
+            <column name="PHASE" value="60d09bb1-7e02-4003-99bf-18b739a577ad"/>
+            <where>PHASE_OLD = 6</where>
+        </update>
+        <update tableName="SALESPROJECT_COMPETITION">
+            <column name="PHASE" value="213c8184-f930-457e-8605-703baaf21d4a"/>
+            <where>PHASE_OLD = 7</where>
+        </update>
+        <update tableName="SALESPROJECT_COMPETITION">
+            <column name="PHASE" value="4eb20149-3a76-4f5d-b8b7-9b529d8d564d"/>
+            <where>PHASE_OLD = 8</where>
+        </update>
+        <update tableName="SALESPROJECT_COMPETITION">
+            <column name="PHASE" value="00a104d7-3af4-4250-bad3-1288b9df8152"/>
+            <where>PHASE_OLD = 9</where>
+        </update>
+        <update tableName="SALESPROJECT_COMPETITION">
+            <column name="PHASE" value="ae5ecf72-3146-4d75-a7ff-7b628868672f"/>
+            <where>PHASE_OLD = 10</where>
+        </update>
+        <update tableName="SALESPROJECT_COMPETITION">
+            <column name="PHASE" value="2f2afad4-6f1f-47f9-9830-4cbae67f9dc1"/>
+            <where>PHASE_OLD = 11</where>
+        </update>
+        <update tableName="SALESPROJECT_COMPETITION">
+            <column name="PHASE" value="a6f57de3-02c2-44a8-9821-975b3a807b46"/>
+            <where>PHASE_OLD = 12</where>
+        </update>
+        <update tableName="SALESPROJECT_COMPETITION">
+            <column name="PHASE" value="a6205bc6-e80f-41fb-9686-2940703eac96"/>
+            <where>PHASE_OLD = 13</where>
+        </update>
+        <update tableName="SALESPROJECT_COMPETITION">
+            <column name="PHASE" value="8ae1d693-667f-4412-aa1b-eb45c5437aa6"/>
+            <where>PHASE_OLD = 14</where>
+        </update>
+        <update tableName="SALESPROJECT_COMPETITION">
+            <column name="PHASE" value="874efae4-aae1-467f-896c-09d8ffe1e7af"/>
+            <where>PHASE_OLD = 15</where>
+        </update>
+        <update tableName="SALESPROJECT_COMPETITION">
+            <column name="PHASE" value="11a3e3d1-aad0-4673-982d-e2533b0b4de6"/>
+            <where>PHASE_OLD = 16</where>
+        </update>
+        <dropColumn tableName="SALESPROJECT_COMPETITION" columnName="PHASE_OLD"/>
+ 
+        <rollback>
+            <renameColumn newColumnName="PHASE_OLD" oldColumnName="PHASE" tableName="SALESPROJECT_COMPETITION"/>
+            <addColumn tableName="SALESPROJECT_COMPETITION">
+                <column name="PHASE" type="INTEGER"/>
+            </addColumn>   
+            <update tableName="SALESPROJECT_COMPETITION">
+                <column name="PHASE" valueNumeric="1"/>
+                <where>PHASE_OLD = '9f7d1fa9-7c09-4037-8f7c-8458def14d89'</where>
+            </update>
+            <update tableName="SALESPROJECT_COMPETITION">
+                <column name="PHASE" valueNumeric="2"/>
+                <where>PHASE_OLD = '292628f1-d9a5-432d-8130-f6690c14a5d4'</where>
+            </update>
+            <update tableName="SALESPROJECT_COMPETITION">
+                <column name="PHASE" valueNumeric="3"/>
+                <where>PHASE_OLD = '4467b33c-3a68-4c8b-ba4a-1eb666a6c774'</where>
+            </update>
+            <update tableName="SALESPROJECT_COMPETITION">
+                <column name="PHASE" valueNumeric="4"/>
+                <where>PHASE_OLD = '1e42f183-fb97-415f-9917-b43ca159fde4'</where>
+            </update>
+            <update tableName="SALESPROJECT_COMPETITION">
+                <column name="PHASE" valueNumeric="5"/>
+                <where>PHASE_OLD = '972a41dc-a8ae-43cd-a03b-522ea84efbfb'</where>
+            </update>
+            <update tableName="SALESPROJECT_COMPETITION">
+                <column name="PHASE" valueNumeric="6"/>
+                <where>PHASE_OLD = '60d09bb1-7e02-4003-99bf-18b739a577ad'</where>
+            </update>
+            <update tableName="SALESPROJECT_COMPETITION">
+                <column name="PHASE" valueNumeric="7"/>
+                <where>PHASE_OLD = '213c8184-f930-457e-8605-703baaf21d4a'</where>
+            </update>
+            <update tableName="SALESPROJECT_COMPETITION">
+                <column name="PHASE" valueNumeric="8"/>
+                <where>PHASE_OLD = '4eb20149-3a76-4f5d-b8b7-9b529d8d564d'</where>
+            </update>
+            <update tableName="SALESPROJECT_COMPETITION">
+                <column name="PHASE" valueNumeric="9"/>
+                <where>PHASE_OLD = '00a104d7-3af4-4250-bad3-1288b9df8152'</where>
+            </update>
+            <update tableName="SALESPROJECT_COMPETITION">
+                <column name="PHASE" valueNumeric="10"/>
+                <where>PHASE_OLD = 'ae5ecf72-3146-4d75-a7ff-7b628868672f'</where>
+            </update>
+            <update tableName="SALESPROJECT_COMPETITION">
+                <column name="PHASE" valueNumeric="11"/>
+                <where>PHASE_OLD = '2f2afad4-6f1f-47f9-9830-4cbae67f9dc1'</where>
+            </update>
+            <update tableName="SALESPROJECT_COMPETITION">
+                <column name="PHASE" valueNumeric="12"/>
+                <where>PHASE_OLD = 'a6f57de3-02c2-44a8-9821-975b3a807b46'</where>
+            </update>
+            <update tableName="SALESPROJECT_COMPETITION">
+                <column name="PHASE" valueNumeric="13"/>
+                <where>PHASE_OLD = 'a6205bc6-e80f-41fb-9686-2940703eac96'</where>
+            </update>
+            <update tableName="SALESPROJECT_COMPETITION">
+                <column name="PHASE" valueNumeric="14"/>
+                <where>PHASE_OLD = '8ae1d693-667f-4412-aa1b-eb45c5437aa6'</where>
+            </update>
+            <update tableName="SALESPROJECT_COMPETITION">
+                <column name="PHASE" valueNumeric="15"/>
+                <where>PHASE_OLD = '874efae4-aae1-467f-896c-09d8ffe1e7af'</where>
+            </update>
+            <update tableName="SALESPROJECT_COMPETITION">
+                <column name="PHASE" valueNumeric="16"/>
+                <where>PHASE_OLD = '11a3e3d1-aad0-4673-982d-e2533b0b4de6'</where>
+            </update>
+            <dropColumn tableName="SALESPROJECT_COMPETITION" columnName="PHASE_OLD"/>
+        </rollback>
+    </changeSet>
+</databaseChangeLog>
\ No newline at end of file
diff --git a/others/db_changes/data_alias/basic/2019.2/changelog.xml b/others/db_changes/data_alias/basic/2019.2/changelog.xml
index 97e48770aa..80b5f1a6c1 100644
--- a/others/db_changes/data_alias/basic/2019.2/changelog.xml
+++ b/others/db_changes/data_alias/basic/2019.2/changelog.xml
@@ -72,4 +72,5 @@
     <include relativeToChangelogFile="true" file="AditoBasic/init_SalesProjectPhase.xml"/>
     <include relativeToChangelogFile="true" file="AditoBasic/init_TaskPriority.xml"/>
     <include relativeToChangelogFile="true" file="AditoBasic/init_SalesprojectCompetitionState.xml"/>
+    <include relativeToChangelogFile="true" file="SalesProjectCompetitionPhase.xml"/>
 </databaseChangeLog>
diff --git a/process/KeywordRegistry_basic/process.js b/process/KeywordRegistry_basic/process.js
index 6683936201..bbeda2b0ea 100644
--- a/process/KeywordRegistry_basic/process.js
+++ b/process/KeywordRegistry_basic/process.js
@@ -55,4 +55,4 @@ $KeywordRegistry.salesprojectStrenght = function(){return "SalesprojectStrenght"
 $KeywordRegistry.salesprojectState = function(){return "SalesprojectState"};
 $KeywordRegistry.salesprojectPhase = function(){return "SalesprojectPhase"};
 $KeywordRegistry.taskPriority = function(){return "TaskPriority"};
-$KeywordRegistry.taskPriority = function(){return "SalesprojectCompetitionState"};
\ No newline at end of file
+$KeywordRegistry.salesprojectCompetitionState = function(){return "SalesprojectCompetitionState"};
\ No newline at end of file
-- 
GitLab