From e18e25b9a297b9efa76bce8f7cfaa61f2efb89cf Mon Sep 17 00:00:00 2001
From: Erika Rohrmeyer <e.rohrmeyer@adito.de>
Date: Fri, 28 May 2021 12:08:40 +0000
Subject: [PATCH] [Projekt: xRM-Sales][TicketNr.:
 1080673][Angebotsfreigabe-Workflow]

---
 .../Data_alias/basic/2021.1.0/changelog.xml   |   3 +
 .../add_ab_keyword_entry_activityCategory.xml |  17 +
 .../add_ab_keyword_entry_offerstatus.xml      |  27 ++
 .../offerWorkflow/alter_offer_approval.xml    |  11 +
 aliasDefinition/Data_alias/Data_alias.aod     |  28 ++
 entity/Offer_entity/Offer_entity.aod          | 115 ++++---
 .../approveoffer/onActionProcess.js           |  13 +
 .../entityfields/approveoffer/stateProcess.js |  20 ++
 .../entityfields/approveoffer/titleProcess.js |   7 +
 .../checkoffer/onActionProcess.js             |  20 ++
 .../entityfields/checkoffer/stateProcess.js   |  29 ++
 .../entityfields/checkoffer/titleProcess.js   |   8 +
 .../dispatchofferreport/stateProcess.js       |   6 +-
 .../recordcontainers/db/conditionProcess.js   |  13 +-
 .../_____LANGUAGE_EXTRA.aod                   |  54 +++
 .../_____LANGUAGE_de/_____LANGUAGE_de.aod     |  68 ++++
 .../_____LANGUAGE_en/_____LANGUAGE_en.aod     |  54 +++
 neonContext/Offer/Offer.aod                   |   3 +
 .../OfferFilter_view/OfferFilter_view.aod     |  47 +++
 others/AngebotFreigeben.bpmn20.xml            | 315 ++++++++++++++++++
 ...eOfferApprovedActivity_workflowService.aod |  11 +
 .../process.js                                |  24 ++
 .../serviceTaskParameterProcess.js            |   7 +
 ...erApprovedNotification_workflowService.aod |  10 +
 .../process.js                                |  35 ++
 ...ateOfferDeniedActivity_workflowService.aod |  11 +
 .../process.js                                |  74 ++++
 .../serviceTaskParameterProcess.js            |  17 +
 ...reateOfferNotification_workflowService.aod |  10 +
 .../process.js                                |  32 ++
 process/KeywordRegistry_basic/process.js      |   3 +
 .../UpdateOfferStatus_workflowService.aod     |  11 +
 .../process.js                                |   8 +
 .../serviceTaskParameterProcess.js            |  14 +
 process/Workflow_lib/process.js               |  28 ++
 .../PROJECT_Inspector1/PROJECT_Inspector1.aod |   5 +
 .../PROJECT_Inspector2/PROJECT_Inspector2.aod |   6 +
 37 files changed, 1122 insertions(+), 42 deletions(-)
 create mode 100644 .liquibase/Data_alias/basic/2021.1.0/offerWorkflow/add_ab_keyword_entry_activityCategory.xml
 create mode 100644 .liquibase/Data_alias/basic/2021.1.0/offerWorkflow/add_ab_keyword_entry_offerstatus.xml
 create mode 100644 .liquibase/Data_alias/basic/2021.1.0/offerWorkflow/alter_offer_approval.xml
 create mode 100644 entity/Offer_entity/entityfields/approveoffer/onActionProcess.js
 create mode 100644 entity/Offer_entity/entityfields/approveoffer/stateProcess.js
 create mode 100644 entity/Offer_entity/entityfields/approveoffer/titleProcess.js
 create mode 100644 entity/Offer_entity/entityfields/checkoffer/onActionProcess.js
 create mode 100644 entity/Offer_entity/entityfields/checkoffer/stateProcess.js
 create mode 100644 entity/Offer_entity/entityfields/checkoffer/titleProcess.js
 create mode 100644 others/AngebotFreigeben.bpmn20.xml
 create mode 100644 process/CreateOfferApprovedActivity_workflowService/CreateOfferApprovedActivity_workflowService.aod
 create mode 100644 process/CreateOfferApprovedActivity_workflowService/process.js
 create mode 100644 process/CreateOfferApprovedActivity_workflowService/serviceTaskParameterProcess.js
 create mode 100644 process/CreateOfferApprovedNotification/CreateOfferApprovedNotification_workflowService.aod
 create mode 100644 process/CreateOfferApprovedNotification_workflowService/process.js
 create mode 100644 process/CreateOfferDeniedActivity_workflowService/CreateOfferDeniedActivity_workflowService.aod
 create mode 100644 process/CreateOfferDeniedActivity_workflowService/process.js
 create mode 100644 process/CreateOfferDeniedActivity_workflowService/serviceTaskParameterProcess.js
 create mode 100644 process/CreateOfferNotification_workflowService/CreateOfferNotification_workflowService.aod
 create mode 100644 process/CreateOfferNotification_workflowService/process.js
 create mode 100644 process/UpdateOfferStatus_workflowService/UpdateOfferStatus_workflowService.aod
 create mode 100644 process/UpdateOfferStatus_workflowService/process.js
 create mode 100644 process/UpdateOfferStatus_workflowService/serviceTaskParameterProcess.js
 create mode 100644 role/PROJECT_Inspector1/PROJECT_Inspector1.aod
 create mode 100644 role/PROJECT_Inspector2/PROJECT_Inspector2.aod

diff --git a/.liquibase/Data_alias/basic/2021.1.0/changelog.xml b/.liquibase/Data_alias/basic/2021.1.0/changelog.xml
index 6819cd521a..3eed7dff70 100644
--- a/.liquibase/Data_alias/basic/2021.1.0/changelog.xml
+++ b/.liquibase/Data_alias/basic/2021.1.0/changelog.xml
@@ -2,5 +2,8 @@
 <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="alterPlanningMonthData.xml"/>
+    <include relativeToChangelogFile="true" file="offerWorkflow/alter_offer_approval.xml"/>
+    <include relativeToChangelogFile="true" file="offerWorkflow/add_ab_keyword_entry_offerstatus.xml"/>
+    <include relativeToChangelogFile="true" file="offerWorkflow/add_ab_keyword_entry_activityCategory.xml"/>
     <include relativeToChangelogFile="true" file="create_standardWorkflow.xml"/>
 </databaseChangeLog>
\ No newline at end of file
diff --git a/.liquibase/Data_alias/basic/2021.1.0/offerWorkflow/add_ab_keyword_entry_activityCategory.xml b/.liquibase/Data_alias/basic/2021.1.0/offerWorkflow/add_ab_keyword_entry_activityCategory.xml
new file mode 100644
index 0000000000..4d3f86db7d
--- /dev/null
+++ b/.liquibase/Data_alias/basic/2021.1.0/offerWorkflow/add_ab_keyword_entry_activityCategory.xml
@@ -0,0 +1,17 @@
+<?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 id="b8d9e809-b65e-1997-bd7b-183727ehabba" author="e.rohrmeyer">
+        <insert tableName="AB_KEYWORD_ENTRY">
+            <column name="AB_KEYWORD_ENTRYID" value="2e278ebd-5efe-40db-9ca0-2e8b08510003"/>
+            <column name="AB_KEYWORD_CATEGORY_ID" value="a5206aff-79f8-413e-a76d-4cb9d39694d3"/>
+            <column name="KEYID" value="APPROVAL"/>
+            <column name="TITLE" value="Approval"/>
+            <column name="CONTAINER" value="ActivityCategory"/>
+            <column name="SORTING" valueNumeric="7"/>
+            <column name="ISACTIVE" valueNumeric="1"/>
+            <column name="ISESSENTIAL" valueNumeric="0"/>
+        </insert>
+    </changeSet>
+</databaseChangeLog>
\ No newline at end of file
diff --git a/.liquibase/Data_alias/basic/2021.1.0/offerWorkflow/add_ab_keyword_entry_offerstatus.xml b/.liquibase/Data_alias/basic/2021.1.0/offerWorkflow/add_ab_keyword_entry_offerstatus.xml
new file mode 100644
index 0000000000..3d368b7a31
--- /dev/null
+++ b/.liquibase/Data_alias/basic/2021.1.0/offerWorkflow/add_ab_keyword_entry_offerstatus.xml
@@ -0,0 +1,27 @@
+<?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 id="b8d9e809-b65e-1997-bd7b-183727ehabba" author="e.rohrmeyer">
+        <insert tableName="AB_KEYWORD_ENTRY">
+            <column name="AB_KEYWORD_ENTRYID" value="2e7852c6-a957-45ca-b971-0a7841e2460b"/>
+            <column name="AB_KEYWORD_CATEGORY_ID" value="3b0a4044-9cfd-4466-9edd-50876a926e76"/>
+            <column name="KEYID" value="OFFERSTATAPPROVED"/>
+            <column name="TITLE" value="Approved"/>
+            <column name="CONTAINER" value="OfferStatus"/>
+            <column name="SORTING" valueNumeric="5"/>
+            <column name="ISACTIVE" valueNumeric="1"/>
+            <column name="ISESSENTIAL" valueNumeric="0"/>
+        </insert>
+        <insert tableName="AB_KEYWORD_ENTRY">
+            <column name="AB_KEYWORD_ENTRYID" value="347cad21-4a72-4df5-a8b1-3ed5005eb8e2"/>
+            <column name="AB_KEYWORD_CATEGORY_ID" value="3b0a4044-9cfd-4466-9edd-50876a926e76"/>
+            <column name="KEYID" value="OFFERSTATDENIED"/>
+            <column name="TITLE" value="Approval denied"/>
+            <column name="CONTAINER" value="OfferStatus"/>
+            <column name="SORTING" valueNumeric="6"/>
+            <column name="ISACTIVE" valueNumeric="1"/>
+            <column name="ISESSENTIAL" valueNumeric="0"/>
+        </insert>
+    </changeSet>
+</databaseChangeLog>
\ No newline at end of file
diff --git a/.liquibase/Data_alias/basic/2021.1.0/offerWorkflow/alter_offer_approval.xml b/.liquibase/Data_alias/basic/2021.1.0/offerWorkflow/alter_offer_approval.xml
new file mode 100644
index 0000000000..562c4ac797
--- /dev/null
+++ b/.liquibase/Data_alias/basic/2021.1.0/offerWorkflow/alter_offer_approval.xml
@@ -0,0 +1,11 @@
+<?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="e.rohrmeyer" id="b8d9e809-b65e-1997-bd7b-183727eeabba">
+        <addColumn tableName="OFFER">
+            <column name="ACTIONUSER" type="CHAR(36)"/>
+            <column name="APPROVAL" type="CHAR(1)"/>
+        </addColumn>
+    </changeSet>
+</databaseChangeLog>
\ No newline at end of file
diff --git a/aliasDefinition/Data_alias/Data_alias.aod b/aliasDefinition/Data_alias/Data_alias.aod
index 2bcf26f4db..85346acf26 100644
--- a/aliasDefinition/Data_alias/Data_alias.aod
+++ b/aliasDefinition/Data_alias/Data_alias.aod
@@ -3150,6 +3150,34 @@
                 <title></title>
                 <description></description>
               </entityFieldDb>
+              <entityFieldDb>
+                <name>APPROVAL</name>
+                <dbName></dbName>
+                <primaryKey v="false" />
+                <columnType v="1" />
+                <size v="1" />
+                <scale v="0" />
+                <notNull v="false" />
+                <isUnique v="false" />
+                <index v="false" />
+                <documentation></documentation>
+                <title></title>
+                <description></description>
+              </entityFieldDb>
+              <entityFieldDb>
+                <name>ACTIONUSER</name>
+                <dbName></dbName>
+                <primaryKey v="false" />
+                <columnType v="1" />
+                <size v="36" />
+                <scale v="0" />
+                <notNull v="false" />
+                <isUnique v="false" />
+                <index v="false" />
+                <documentation></documentation>
+                <title></title>
+                <description></description>
+              </entityFieldDb>
             </entityFields>
           </entityDb>
           <entityDb>
diff --git a/entity/Offer_entity/Offer_entity.aod b/entity/Offer_entity/Offer_entity.aod
index a16373ac50..c6ea3d5685 100644
--- a/entity/Offer_entity/Offer_entity.aod
+++ b/entity/Offer_entity/Offer_entity.aod
@@ -1004,6 +1004,56 @@
         </entityParameter>
       </children>
     </entityConsumer>
+    <entityConsumer>
+      <name>Orders</name>
+      <dependency>
+        <name>dependency</name>
+        <entityName>Order_entity</entityName>
+        <fieldName>#PROVIDER</fieldName>
+      </dependency>
+      <children>
+        <entityParameter>
+          <name>OfferId_param</name>
+          <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/orders/children/offerid_param/valueProcess.js</valueProcess>
+        </entityParameter>
+      </children>
+    </entityConsumer>
+    <entityParameter>
+      <name>ContactIds_param</name>
+      <expose v="true" />
+    </entityParameter>
+    <entityParameter>
+      <name>Info_param</name>
+      <expose v="true" />
+    </entityParameter>
+    <entityParameter>
+      <name>TaskId_param</name>
+      <expose v="true" />
+    </entityParameter>
+    <entityConsumer>
+      <name>KeywordProbabilityOffer</name>
+      <dependency>
+        <name>dependency</name>
+        <entityName>KeywordEntry_entity</entityName>
+        <fieldName>SpecificContainerKeywords</fieldName>
+      </dependency>
+      <children>
+        <entityParameter>
+          <name>ContainerName_param</name>
+          <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/keywordprobabilityoffer/children/containername_param/valueProcess.js</valueProcess>
+        </entityParameter>
+      </children>
+    </entityConsumer>
+    <entityField>
+      <name>APPROVAL</name>
+    </entityField>
+    <entityField>
+      <name>ACTIONUSER</name>
+    </entityField>
+    <entityParameter>
+      <name>Approval_param</name>
+      <expose v="true" />
+    </entityParameter>
     <entityActionGroup>
       <name>observeActionGroup</name>
       <children>
@@ -1086,6 +1136,23 @@
         </entityActionField>
       </children>
     </entityActionGroup>
+    <entityActionField>
+      <name>checkOffer</name>
+      <title>check offer</title>
+      <onActionProcess>%aditoprj%/entity/Offer_entity/entityfields/checkoffer/onActionProcess.js</onActionProcess>
+      <iconId>VAADIN:CLIPBOARD_CHECK</iconId>
+      <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/checkoffer/stateProcess.js</stateProcess>
+      <titleProcess>%aditoprj%/entity/Offer_entity/entityfields/checkoffer/titleProcess.js</titleProcess>
+    </entityActionField>
+    <entityActionField>
+      <name>approveOffer</name>
+      <title>approve/deny</title>
+      <onActionProcess>%aditoprj%/entity/Offer_entity/entityfields/approveoffer/onActionProcess.js</onActionProcess>
+      <iconId>NEON:MQC</iconId>
+      <usePermissions v="true" />
+      <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/approveoffer/stateProcess.js</stateProcess>
+      <titleProcess>%aditoprj%/entity/Offer_entity/entityfields/approveoffer/titleProcess.js</titleProcess>
+    </entityActionField>
     <entityActionField>
       <name>openAdminView</name>
       <title>Open admin view</title>
@@ -1093,46 +1160,6 @@
       <iconId>VAADIN:CURLY_BRACKETS</iconId>
       <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/openadminview/stateProcess.js</stateProcess>
     </entityActionField>
-    <entityConsumer>
-      <name>Orders</name>
-      <dependency>
-        <name>dependency</name>
-        <entityName>Order_entity</entityName>
-        <fieldName>#PROVIDER</fieldName>
-      </dependency>
-      <children>
-        <entityParameter>
-          <name>OfferId_param</name>
-          <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/orders/children/offerid_param/valueProcess.js</valueProcess>
-        </entityParameter>
-      </children>
-    </entityConsumer>
-    <entityParameter>
-      <name>ContactIds_param</name>
-      <expose v="true" />
-    </entityParameter>
-    <entityParameter>
-      <name>Info_param</name>
-      <expose v="true" />
-    </entityParameter>
-    <entityParameter>
-      <name>TaskId_param</name>
-      <expose v="true" />
-    </entityParameter>
-    <entityConsumer>
-      <name>KeywordProbabilityOffer</name>
-      <dependency>
-        <name>dependency</name>
-        <entityName>KeywordEntry_entity</entityName>
-        <fieldName>SpecificContainerKeywords</fieldName>
-      </dependency>
-      <children>
-        <entityParameter>
-          <name>ContainerName_param</name>
-          <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/keywordprobabilityoffer/children/containername_param/valueProcess.js</valueProcess>
-        </entityParameter>
-      </children>
-    </entityConsumer>
   </entityFields>
   <recordContainers>
     <dbRecordContainer>
@@ -1360,6 +1387,14 @@
           <recordfield>OFFER.PROBABILITY</recordfield>
           <aggregateType>AVG</aggregateType>
         </aggregateFieldDbMapping>
+        <dbRecordFieldMapping>
+          <name>ACTIONUSER.value</name>
+          <recordfield>OFFER.ACTIONUSER</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>APPROVAL.value</name>
+          <recordfield>OFFER.APPROVAL</recordfield>
+        </dbRecordFieldMapping>
       </recordFieldMappings>
       <linkInformation>
         <linkInformation>
diff --git a/entity/Offer_entity/entityfields/approveoffer/onActionProcess.js b/entity/Offer_entity/entityfields/approveoffer/onActionProcess.js
new file mode 100644
index 0000000000..4c386d3779
--- /dev/null
+++ b/entity/Offer_entity/entityfields/approveoffer/onActionProcess.js
@@ -0,0 +1,13 @@
+import("Employee_lib");
+import("Workflow_lib");
+import("system.neon");
+import("Sql_lib");
+import("Context_lib");
+import("system.vars");
+
+var offerId = vars.get("$field.OFFERID");
+var taskId = WorkflowUtils.getTaskId(offerId, ContextUtils.getCurrentContextId());
+
+newWhere("OFFER.OFFERID", offerId).updateFields({"ACTIONUSER" : EmployeeUtils.getCurrentContactId()});
+
+neon.openContext("WorkflowTask", "WorkflowTaskForm_view", [taskId], neon.OPERATINGSTATE_EDIT, null);
\ No newline at end of file
diff --git a/entity/Offer_entity/entityfields/approveoffer/stateProcess.js b/entity/Offer_entity/entityfields/approveoffer/stateProcess.js
new file mode 100644
index 0000000000..d44aa31f28
--- /dev/null
+++ b/entity/Offer_entity/entityfields/approveoffer/stateProcess.js
@@ -0,0 +1,20 @@
+import("system.tools");
+import("Workflow_lib");
+import("system.neon");
+import("system.result");
+import("Context_lib");
+import("system.vars");
+
+var offerId = vars.get("$field.OFFERID");
+var taskId = WorkflowUtils.getTaskId(offerId, ContextUtils.getCurrentContextId());
+var roleIf = tools.currentUserHasAnyRole(["PROJECT_Inspector1", "PROJECT_Inspector2"]);
+
+if (vars.get("$field.APPROVAL") == 2){
+    roleIf = tools.currentUserHasRole("PROJECT_Inspector2");
+}
+
+if (taskId != "" && roleIf) {
+    result.string(neon.COMPONENTSTATE_EDITABLE);
+} else {
+    result.string(neon.COMPONENTSTATE_INVISIBLE);
+}
diff --git a/entity/Offer_entity/entityfields/approveoffer/titleProcess.js b/entity/Offer_entity/entityfields/approveoffer/titleProcess.js
new file mode 100644
index 0000000000..e74ec5edc1
--- /dev/null
+++ b/entity/Offer_entity/entityfields/approveoffer/titleProcess.js
@@ -0,0 +1,7 @@
+import("system.translate");
+import("system.result");
+import("system.vars");
+
+if (vars.get("$field.APPROVAL") == 2) {
+    result.string(translate.text("approve/deny (2nd approval)"));
+}
\ No newline at end of file
diff --git a/entity/Offer_entity/entityfields/checkoffer/onActionProcess.js b/entity/Offer_entity/entityfields/checkoffer/onActionProcess.js
new file mode 100644
index 0000000000..65b29fcbc1
--- /dev/null
+++ b/entity/Offer_entity/entityfields/checkoffer/onActionProcess.js
@@ -0,0 +1,20 @@
+import("system.translate");
+import("system.question");
+import("system.neon");
+import("system.workflow");
+import("system.vars");
+import("Context_lib");
+
+var variables = {
+    "targetContext": ContextUtils.getCurrentContextId(),
+    "targetId": vars.get("$field.OFFERID"),
+    "approvalCount": 0,
+    "userNew": vars.get("$field.USER_NEW"),
+    "net": vars.get("$field.NET")
+};
+
+workflow.startProcessByKey("approveOffer", variables);
+
+question.showMessage(translate.text("Approval started"), question.INFORMATION, "");
+
+neon.refreshAll();
\ No newline at end of file
diff --git a/entity/Offer_entity/entityfields/checkoffer/stateProcess.js b/entity/Offer_entity/entityfields/checkoffer/stateProcess.js
new file mode 100644
index 0000000000..3c0c76db09
--- /dev/null
+++ b/entity/Offer_entity/entityfields/checkoffer/stateProcess.js
@@ -0,0 +1,29 @@
+import("Sql_lib");
+import("KeywordRegistry_basic");
+import("Workflow_lib");
+import("Context_lib");
+import("system.neon");
+import("system.result");
+import("system.vars");
+
+var offerId = vars.get("$field.OFFERID");
+var offerStatus = vars.get("$field.STATUS");
+var taskId = WorkflowUtils.getTaskId(offerId, ContextUtils.getCurrentContextId());
+var itemcount = newSelect("count(*)")
+                    .from("OFFERITEM")
+                    .whereIfSet("OFFERITEM.OFFER_ID", "$field.OFFERID")
+                    .cell(true, "0");
+
+if (taskId != "") 
+{
+    result.string(neon.COMPONENTSTATE_INVISIBLE);
+} 
+else if (offerStatus == $KeywordRegistry.offerStatus$sent() || offerStatus == $KeywordRegistry.offerStatus$approved() || itemcount == "0")
+{
+    result.string(neon.COMPONENTSTATE_DISABLED);
+}
+else
+{
+    result.string(neon.COMPONENTSTATE_EDITABLE);
+}
+
diff --git a/entity/Offer_entity/entityfields/checkoffer/titleProcess.js b/entity/Offer_entity/entityfields/checkoffer/titleProcess.js
new file mode 100644
index 0000000000..8127f6169b
--- /dev/null
+++ b/entity/Offer_entity/entityfields/checkoffer/titleProcess.js
@@ -0,0 +1,8 @@
+import("system.translate");
+import("system.result");
+import("KeywordRegistry_basic");
+import("system.vars");
+
+if (vars.get("$field.STATUS") == $KeywordRegistry.offerStatus$denied()) {
+    result.string(translate.text("check offer again"));
+}
\ No newline at end of file
diff --git a/entity/Offer_entity/entityfields/offerreportdispatch/children/dispatchofferreport/stateProcess.js b/entity/Offer_entity/entityfields/offerreportdispatch/children/dispatchofferreport/stateProcess.js
index 738545ff13..47d7dcf10f 100644
--- a/entity/Offer_entity/entityfields/offerreportdispatch/children/dispatchofferreport/stateProcess.js
+++ b/entity/Offer_entity/entityfields/offerreportdispatch/children/dispatchofferreport/stateProcess.js
@@ -1,3 +1,4 @@
+import("KeywordRegistry_basic");
 import("system.vars");
 import("system.neon");
 import("system.result");
@@ -6,4 +7,7 @@ import("Sql_lib");
 var offerStatus = newSelect("OFFER.STATUS").from("OFFER")
                     .where("OFFER.OFFERID", "$field.OFFERID").cell();
 
-if (offerStatus == "OFFERSTATSENT") result.string(neon.COMPONENTSTATE_DISABLED);
\ No newline at end of file
+if (offerStatus == $KeywordRegistry.offerStatus$sent() || offerStatus == $KeywordRegistry.offerStatus$toCheck() || offerStatus == $KeywordRegistry.offerStatus$denied())
+{
+    result.string(neon.COMPONENTSTATE_DISABLED);
+}
\ No newline at end of file
diff --git a/entity/Offer_entity/recordcontainers/db/conditionProcess.js b/entity/Offer_entity/recordcontainers/db/conditionProcess.js
index eabc7f2454..687c5f8bf9 100644
--- a/entity/Offer_entity/recordcontainers/db/conditionProcess.js
+++ b/entity/Offer_entity/recordcontainers/db/conditionProcess.js
@@ -3,7 +3,8 @@ import("system.db");
 import("system.result");
 import("Sql_lib");
 
-var cond = newWhere()
+var cond = newWhere();
+var approval = vars.get("$param.Approval_param");
 
 if(vars.exists("$param.ContactId_param") && vars.get("$param.ContactId_param"))
     cond.andIfSet("OFFER.CONTACT_ID", "$param.ContactId_param");
@@ -12,6 +13,16 @@ else {
     cond.andIfSet("OFFER.OBJECT_TYPE", "$param.ObjectType_param");
 }
 
+if (approval == 1)
+{
+    cond.andIfSet("OFFER.APPROVAL", "1");
+}
+else if(approval == 2)
+{
+    cond.andIfSet("OFFER.APPROVAL", "2");
+}
+
+
 cond.andIfSet("OFFER.STATUS", "$param.OfferStatus_param")
 
 result.string(cond.toString());
\ No newline at end of file
diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
index 83e6860df3..ee70a5fef3 100644
--- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
+++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
@@ -8581,6 +8581,60 @@
     <entry>
       <key>No advertising</key>
     </entry>
+    <entry>
+      <key>Approval started</key>
+    </entry>
+    <entry>
+      <key>approved</key>
+    </entry>
+    <entry>
+      <key>executives</key>
+    </entry>
+    <entry>
+      <key>approve/deny (2nd approval)</key>
+    </entry>
+    <entry>
+      <key>approve/deny</key>
+    </entry>
+    <entry>
+      <key>offer denied</key>
+    </entry>
+    <entry>
+      <key>check offer again</key>
+    </entry>
+    <entry>
+      <key>your offer \“%0\“ was %1 by \“%2\“</key>
+    </entry>
+    <entry>
+      <key>check offer</key>
+    </entry>
+    <entry>
+      <key>area manager</key>
+    </entry>
+    <entry>
+      <key>denied</key>
+    </entry>
+    <entry>
+      <key>offer approved</key>
+    </entry>
+    <entry>
+      <key>First Approval</key>
+    </entry>
+    <entry>
+      <key>show all offers with second approval</key>
+    </entry>
+    <entry>
+      <key>Second Approval</key>
+    </entry>
+    <entry>
+      <key>Approval denied</key>
+    </entry>
+    <entry>
+      <key>show all offers with first approval</key>
+    </entry>
+    <entry>
+      <key>No advertising</key>
+    </entry>
     <entry>
       <key>[TEST] Importer</key>
     </entry>
diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
index b49864ce47..21ed6ae8fe 100644
--- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
+++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
@@ -38,6 +38,10 @@
       <key>Opening Date</key>
       <value>Öffnungsdatum</value>
     </entry>
+    <entry>
+      <key>check offer</key>
+      <value>Freigabe anfordern</value>
+    </entry>
     <entry>
       <key>%0 out of %1 records were changed to \"%2\".\n %3 record/s could not be updated.</key>
       <value>%0 von %1 Datensätze wurden auf \"%2\" geändert.\n%3 Datensätze konnten nicht akutualisiert werden.</value>
@@ -50,6 +54,10 @@
       <key>Value is too big, the maximum is %0</key>
       <value>Wert ist zu groß, das Maximum ist %0</value>
     </entry>
+    <entry>
+      <key>Approval started</key>
+      <value>Freigabeprozess gestartet</value>
+    </entry>
     <entry>
       <key>Not enough room in campaignstep</key>
       <value>In der Kampagnenstufe ist nicht genug Platz vorhanden</value>
@@ -1147,6 +1155,10 @@
       <key>Status</key>
       <value>Status</value>
     </entry>
+    <entry>
+      <key>denied</key>
+      <value>abgelehnt</value>
+    </entry>
     <entry>
       <key>Deadline</key>
       <value>Frist</value>
@@ -1179,6 +1191,14 @@
       <key>Export letter for selection</key>
       <value>Brief für Auswahl exportieren</value>
     </entry>
+    <entry>
+      <key>your offer \“%0\“ was %1 by \“%2\“</key>
+      <value>Die Freigabe Ihres Angebots \“%0\“ wurde durch \“%2\“ %1</value>
+    </entry>
+    <entry>
+      <key>Approval denied</key>
+      <value>Freigabe abgelehnt</value>
+    </entry>
     <entry>
       <key>External Datasource</key>
       <value>Externe Datenquelle</value>
@@ -1191,6 +1211,10 @@
       <key>All of the chosen records are already in the campaignstep</key>
       <value>Alle ausgewählten Datensätze sind schon in der Kampagnenstufe.</value>
     </entry>
+    <entry>
+      <key>offer denied</key>
+      <value>Angebot abgelehnt</value>
+    </entry>
     <entry>
       <key>Days inactive</key>
       <value>Tage inaktiv</value>
@@ -1199,6 +1223,10 @@
       <key>Active</key>
       <value>Aktiv</value>
     </entry>
+    <entry>
+      <key>approve/deny (2nd approval)</key>
+      <value>Freigeben/Ablehnen (2. Freigabe)</value>
+    </entry>
     <entry>
       <key>Medium</key>
       <value>Medium</value>
@@ -1832,6 +1860,10 @@
       <key>Postponed</key>
       <value>Vertagt</value>
     </entry>
+    <entry>
+      <key>approve/deny</key>
+      <value>Freigeben/Ablehnen</value>
+    </entry>
     <entry>
       <key>Aborted</key>
       <value>Abgebrochen</value>
@@ -1883,6 +1915,10 @@
     <entry>
       <key>50 %</key>
     </entry>
+    <entry>
+      <key>check offer again</key>
+      <value>Freigabe erneut anfordern</value>
+    </entry>
     <entry>
       <key>Header</key>
       <value>Kopftext</value>
@@ -3823,6 +3859,10 @@
       <key>Euro</key>
       <value>Euro</value>
     </entry>
+    <entry>
+      <key>executives</key>
+      <value>Geschäftsführung</value>
+    </entry>
     <entry>
       <key>Product_GUI</key>
       <value>Produkt_GUI</value>
@@ -4259,6 +4299,10 @@
     <entry>
       <key>25%</key>
     </entry>
+    <entry>
+      <key>Second Approval</key>
+      <value>2. Freigabe</value>
+    </entry>
     <entry>
       <key>Sales forecast</key>
       <value>Umsatzprognose</value>
@@ -6838,6 +6882,14 @@
       <key>one file imported</key>
       <value>eine Datei importiert</value>
     </entry>
+    <entry>
+      <key>offer approved</key>
+      <value>Angebot freigegeben</value>
+    </entry>
+    <entry>
+      <key>approved</key>
+      <value>freigegeben</value>
+    </entry>
     <entry>
       <key>(or drop files here)</key>
       <value>(oder Dateien per Drag and Drop einfügen)</value>
@@ -8956,6 +9008,10 @@ Bitte Datumseingabe prüfen</value>
       <key>add new User Permission</key>
       <value>neue Userberechtigung hinzufügen</value>
     </entry>
+    <entry>
+      <key>show all offers with first approval</key>
+      <value>Alle Angebote mit 1. Freigabe anzeigen</value>
+    </entry>
     <entry>
       <key>Create new Visitreport</key>
       <value>Besuchsbericht erstellen</value>
@@ -9291,6 +9347,10 @@ Bitte Datumseingabe prüfen</value>
       <key>Unseen</key>
       <value>Neu</value>
     </entry>
+    <entry>
+      <key>show all offers with second approval</key>
+      <value>Alle Angebote mit 2. Freigabe anzeigen</value>
+    </entry>
     <entry>
       <key>To Delete</key>
       <value>Für Löschung vorgesehen</value>
@@ -9307,6 +9367,10 @@ Bitte Datumseingabe prüfen</value>
       <key>Create salesproject</key>
       <value>Vertriebsprojekt erstellen</value>
     </entry>
+    <entry>
+      <key>First Approval</key>
+      <value>1. Freigabe</value>
+    </entry>
     <entry>
       <key> number of connections</key>
       <value>Anzahl Verknüpfungen</value>
@@ -11144,6 +11208,10 @@ Bitte Datumseingabe prüfen</value>
       <key>Mark to Delete</key>
       <value>Markieren zum Löschen</value>
     </entry>
+    <entry>
+      <key>area manager</key>
+      <value>Bereichsleiter</value>
+    </entry>
     <entry>
       <key>Is an active employee</key>
       <value>Ist ein aktiver Mitarbeiter</value>
diff --git a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod
index 3cb99dc83e..67f5544e63 100644
--- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod
+++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod
@@ -8666,6 +8666,60 @@
     <entry>
       <key>No advertising</key>
     </entry>
+    <entry>
+      <key>Approval started</key>
+    </entry>
+    <entry>
+      <key>approved</key>
+    </entry>
+    <entry>
+      <key>executives</key>
+    </entry>
+    <entry>
+      <key>approve/deny (2nd approval)</key>
+    </entry>
+    <entry>
+      <key>approve/deny</key>
+    </entry>
+    <entry>
+      <key>offer denied</key>
+    </entry>
+    <entry>
+      <key>check offer again</key>
+    </entry>
+    <entry>
+      <key>your offer \“%0\“ was %1 by \“%2\“</key>
+    </entry>
+    <entry>
+      <key>check offer</key>
+    </entry>
+    <entry>
+      <key>area manager</key>
+    </entry>
+    <entry>
+      <key>denied</key>
+    </entry>
+    <entry>
+      <key>offer approved</key>
+    </entry>
+    <entry>
+      <key>First Approval</key>
+    </entry>
+    <entry>
+      <key>show all offers with second approval</key>
+    </entry>
+    <entry>
+      <key>Second Approval</key>
+    </entry>
+    <entry>
+      <key>Approval denied</key>
+    </entry>
+    <entry>
+      <key>show all offers with first approval</key>
+    </entry>
+    <entry>
+      <key>No advertising</key>
+    </entry>
     <entry>
       <key>[TEST] Importer</key>
     </entry>
diff --git a/neonContext/Offer/Offer.aod b/neonContext/Offer/Offer.aod
index 271bdfa9b4..9d43127e98 100644
--- a/neonContext/Offer/Offer.aod
+++ b/neonContext/Offer/Offer.aod
@@ -47,5 +47,8 @@
     <webserviceReference>
       <name>277d4493-9a49-4e68-b00c-29d3d0e0b9d2</name>
     </webserviceReference>
+    <neonViewReference>
+      <name>e664da63-c1c7-4def-ba7b-037cd8da6994</name>
+    </neonViewReference>
   </references>
 </neonContext>
diff --git a/neonView/OfferFilter_view/OfferFilter_view.aod b/neonView/OfferFilter_view/OfferFilter_view.aod
index f0ca240b04..c92b2a4e55 100644
--- a/neonView/OfferFilter_view/OfferFilter_view.aod
+++ b/neonView/OfferFilter_view/OfferFilter_view.aod
@@ -42,6 +42,53 @@
         </neonDashletCategory>
       </categories>
     </neonDashletConfiguration>
+    <neonDashletConfiguration>
+      <name>FirstApprovalDashlet</name>
+      <title>First Approval</title>
+      <description>show all offers with first approval</description>
+      <fragment>Offer/filter</fragment>
+      <singleton v="true" />
+      <storeRoles>
+        <element>PROJECT_Inspector1</element>
+        <element>PROJECT_Inspector2</element>
+      </storeRoles>
+      <icon>VAADIN:CLIPBOARD_CHECK</icon>
+      <categories>
+        <neonDashletCategory>
+          <name>sales</name>
+          <title>Sales</title>
+        </neonDashletCategory>
+      </categories>
+      <parameters>
+        <neonDashletParameter>
+          <name>Approval_param</name>
+          <value>1</value>
+        </neonDashletParameter>
+      </parameters>
+    </neonDashletConfiguration>
+    <neonDashletConfiguration>
+      <name>SecondApprovalDashlet</name>
+      <title>Second Approval</title>
+      <description>show all offers with second approval</description>
+      <fragment>Offer/filter</fragment>
+      <singleton v="true" />
+      <storeRoles>
+        <element>PROJECT_Inspector2</element>
+      </storeRoles>
+      <icon>VAADIN:CLIPBOARD_CHECK</icon>
+      <categories>
+        <neonDashletCategory>
+          <name>sales</name>
+          <title>Sales</title>
+        </neonDashletCategory>
+      </categories>
+      <parameters>
+        <neonDashletParameter>
+          <name>Approval_param</name>
+          <value>2</value>
+        </neonDashletParameter>
+      </parameters>
+    </neonDashletConfiguration>
   </dashletConfigurations>
   <layout>
     <groupLayout>
diff --git a/others/AngebotFreigeben.bpmn20.xml b/others/AngebotFreigeben.bpmn20.xml
new file mode 100644
index 0000000000..c19a1a663b
--- /dev/null
+++ b/others/AngebotFreigeben.bpmn20.xml
@@ -0,0 +1,315 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:flowable="http://flowable.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.flowable.org/processdef">
+  <process id="approveOffer" name="AngebotFreigeben" isExecutable="true">
+    <startEvent id="startEvent1" flowable:formFieldValidation="true"></startEvent>
+    <userTask id="sid-7EE94F7E-20DC-49DF-A751-7EC30166393B" name="Angebot freigeben" flowable:candidateGroups="PROJECT_Pruefer1,PROJECT_Pruefer2" flowable:formFieldValidation="true">
+      <extensionElements>
+        <flowable:formProperty id="approval" name="Angebot freigegeben?" type="boolean" variable="inspector1approval" required="true"></flowable:formProperty>
+        <flowable:formProperty id="reason" name="Begründung der Ablehnung" type="string" variable="reason" visibilityExpression="${currentValues.approval == false}"></flowable:formProperty>
+        <flowable:formProperty id="inspector2needed" name="2. Freigabe nötig?" type="boolean" expression="#{true}" variable="inspector2needed" visibilityExpression="${currentValues.approval == true}"></flowable:formProperty>
+        <modeler:group-info-name-PROJECT_Pruefer1 xmlns:modeler="http://flowable.org/modeler"><![CDATA[VT BL]]></modeler:group-info-name-PROJECT_Pruefer1>
+        <modeler:group-info-name-PROJECT_Pruefer2 xmlns:modeler="http://flowable.org/modeler"><![CDATA[GF/Leiter Vertrieb]]></modeler:group-info-name-PROJECT_Pruefer2>
+        <modeler:activiti-idm-candidate-group xmlns:modeler="http://flowable.org/modeler"><![CDATA[true]]></modeler:activiti-idm-candidate-group>
+        <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>
+      </extensionElements>
+    </userTask>
+    <exclusiveGateway id="sid-4D2A9C2D-5D5B-4D4E-8FD1-FBB630DF8295"></exclusiveGateway>
+    <sequenceFlow id="sid-24CE050E-5CA0-4410-9359-EAAA687200E3" sourceRef="sid-7EE94F7E-20DC-49DF-A751-7EC30166393B" targetRef="sid-4D2A9C2D-5D5B-4D4E-8FD1-FBB630DF8295"></sequenceFlow>
+    <serviceTask id="sid-8090E0D9-B068-4596-A6C6-8768C5803456" name="Angebot abgelehnt" flowable:class="de.adito.aditoweb.server.neon.workflow.WorkflowServiceTask">
+      <extensionElements>
+        <flowable:field name="jditoProcess">
+          <flowable:string><![CDATA[CreateOfferDeniedActivity_workflowService]]></flowable:string>
+        </flowable:field>
+        <flowable:field name="taskVariables">
+          <flowable:string><![CDATA[{"firstOrSecond":{"value":"1"}}]]></flowable:string>
+        </flowable:field>
+      </extensionElements>
+    </serviceTask>
+    <serviceTask id="sid-0DD45B2D-BF99-42FD-85E5-0991CBF13780" name="Angebot freigegeben" flowable:class="de.adito.aditoweb.server.neon.workflow.WorkflowServiceTask">
+      <extensionElements>
+        <flowable:field name="jditoProcess">
+          <flowable:string><![CDATA[CreateOfferApprovedActivity_workflowService]]></flowable:string>
+        </flowable:field>
+        <flowable:field name="taskVariables">
+          <flowable:string><![CDATA[{"description":{"value":""}}]]></flowable:string>
+        </flowable:field>
+      </extensionElements>
+    </serviceTask>
+    <userTask id="approvalTask2" name="Angebot freigeben (2. Freigabe)" flowable:candidateGroups="PROJECT_Pruefer2" flowable:formFieldValidation="true">
+      <extensionElements>
+        <flowable:formProperty id="approval2" name="Angebot freigegeben?" type="boolean" variable="approval2" required="true"></flowable:formProperty>
+        <flowable:formProperty id="reason2" name="Begründung der Ablehnung" type="string" variable="reason2" visibilityExpression="${currentValues.approval2 == false}"></flowable:formProperty>
+        <modeler:group-info-name-PROJECT_Pruefer2 xmlns:modeler="http://flowable.org/modeler"><![CDATA[GF/Leiter Vertrieb]]></modeler:group-info-name-PROJECT_Pruefer2>
+        <modeler:activiti-idm-candidate-group xmlns:modeler="http://flowable.org/modeler"><![CDATA[true]]></modeler:activiti-idm-candidate-group>
+        <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>
+      </extensionElements>
+    </userTask>
+    <serviceTask id="sid-BEB99CF9-21AB-422C-B5BA-C8F933C4A458" name="Angebot freigegeben (Zweite Freigabe erforderlich)" flowable:class="de.adito.aditoweb.server.neon.workflow.WorkflowServiceTask">
+      <extensionElements>
+        <flowable:field name="jditoProcess">
+          <flowable:string><![CDATA[CreateOfferApprovedActivity_workflowService]]></flowable:string>
+        </flowable:field>
+        <flowable:field name="taskVariables">
+          <flowable:string><![CDATA[{"description":{"value":"Zweite Freigabe erforderlich"},"approval":{"value":2}}]]></flowable:string>
+        </flowable:field>
+      </extensionElements>
+    </serviceTask>
+    <exclusiveGateway id="sid-2C59B75E-D7BA-415A-8AA4-96DF9D54560A"></exclusiveGateway>
+    <serviceTask id="sid-323AD77E-874D-4856-8E22-825D25989EE2" name="Angebot freigegeben" flowable:class="de.adito.aditoweb.server.neon.workflow.WorkflowServiceTask">
+      <extensionElements>
+        <flowable:field name="jditoProcess">
+          <flowable:string><![CDATA[CreateOfferApprovedActivity_workflowService]]></flowable:string>
+        </flowable:field>
+        <flowable:field name="taskVariables">
+          <flowable:string><![CDATA[{"description":{"value":""}}]]></flowable:string>
+        </flowable:field>
+      </extensionElements>
+    </serviceTask>
+    <serviceTask id="sid-EAE0F188-EA97-4818-B99D-70259F2307B0" name="Angebot abgelehnt" flowable:class="de.adito.aditoweb.server.neon.workflow.WorkflowServiceTask">
+      <extensionElements>
+        <flowable:field name="jditoProcess">
+          <flowable:string><![CDATA[CreateOfferDeniedActivity_workflowService]]></flowable:string>
+        </flowable:field>
+        <flowable:field name="taskVariables">
+          <flowable:string><![CDATA[{"firstOrSecond":{"value":"2"}}]]></flowable:string>
+        </flowable:field>
+      </extensionElements>
+    </serviceTask>
+    <sequenceFlow id="sid-8A3C7A28-71DD-47C8-9521-803C72A803E9" sourceRef="sid-4D2A9C2D-5D5B-4D4E-8FD1-FBB630DF8295" targetRef="sid-BEB99CF9-21AB-422C-B5BA-C8F933C4A458">
+      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${inspector1approval == true && inspector2needed == true}]]></conditionExpression>
+    </sequenceFlow>
+    <serviceTask id="sid-0ADBAADA-F257-4C7F-9AC1-9565AD03DEB7" name="Status ändern" flowable:class="de.adito.aditoweb.server.neon.workflow.WorkflowServiceTask">
+      <extensionElements>
+        <flowable:field name="jditoProcess">
+          <flowable:string><![CDATA[UpdateOfferStatus_workflowService]]></flowable:string>
+        </flowable:field>
+        <flowable:field name="taskVariables">
+          <flowable:string><![CDATA[{"status":{"value":"OFFERSTATTOCHECK"},"time":{"value":1}}]]></flowable:string>
+        </flowable:field>
+      </extensionElements>
+    </serviceTask>
+    <sequenceFlow id="sid-095E3C78-BB9A-4E49-944B-16F7ABA8F097" sourceRef="sid-0ADBAADA-F257-4C7F-9AC1-9565AD03DEB7" targetRef="sid-7EE94F7E-20DC-49DF-A751-7EC30166393B"></sequenceFlow>
+    <serviceTask id="sid-93501888-538B-4BAE-8AE6-711A3FECA4FE" name="Status zu 'Freigabe abgelehnt' ändern" flowable:class="de.adito.aditoweb.server.neon.workflow.WorkflowServiceTask">
+      <extensionElements>
+        <flowable:field name="jditoProcess">
+          <flowable:string><![CDATA[UpdateOfferStatus_workflowService]]></flowable:string>
+        </flowable:field>
+        <flowable:field name="taskVariables">
+          <flowable:string><![CDATA[{"status":{"value":"OFFERSTATDENIED"}}]]></flowable:string>
+        </flowable:field>
+      </extensionElements>
+    </serviceTask>
+    <endEvent id="sid-90F027C6-9870-40C1-8BCF-A96A25F76AF5"></endEvent>
+    <sequenceFlow id="sid-8142B71B-3DC1-4099-9F3A-F0DB9D0E59E3" sourceRef="sid-93501888-538B-4BAE-8AE6-711A3FECA4FE" targetRef="sid-90F027C6-9870-40C1-8BCF-A96A25F76AF5"></sequenceFlow>
+    <serviceTask id="sid-C4B0ADE8-A005-4AC8-8E47-1E223E2050F0" name="Status zu 'Freigegeben' ändern" flowable:class="de.adito.aditoweb.server.neon.workflow.WorkflowServiceTask">
+      <extensionElements>
+        <flowable:field name="jditoProcess">
+          <flowable:string><![CDATA[UpdateOfferStatus_workflowService]]></flowable:string>
+        </flowable:field>
+        <flowable:field name="taskVariables">
+          <flowable:string><![CDATA[{"status":{"value":"OFFERSTATAPPROVED"}}]]></flowable:string>
+        </flowable:field>
+      </extensionElements>
+    </serviceTask>
+    <endEvent id="sid-3B123F1B-D924-4EE3-99E7-B91E776A0F69"></endEvent>
+    <sequenceFlow id="sid-7133F014-E561-45C5-99A2-EF6398DA3E49" sourceRef="sid-C4B0ADE8-A005-4AC8-8E47-1E223E2050F0" targetRef="sid-3B123F1B-D924-4EE3-99E7-B91E776A0F69"></sequenceFlow>
+    <sequenceFlow id="sid-BC4E1929-6C63-42F3-8086-A671EAA09D2E" sourceRef="sid-BEB99CF9-21AB-422C-B5BA-C8F933C4A458" targetRef="approvalTask2"></sequenceFlow>
+    <sequenceFlow id="sid-E529BD6B-1A6A-44AF-A487-5B47D641D22D" sourceRef="approvalTask2" targetRef="sid-2C59B75E-D7BA-415A-8AA4-96DF9D54560A"></sequenceFlow>
+    <sequenceFlow id="sid-57A915C4-CDCE-4D1F-AFEF-B61495262C8C" sourceRef="startEvent1" targetRef="sid-0ADBAADA-F257-4C7F-9AC1-9565AD03DEB7"></sequenceFlow>
+    <sequenceFlow id="sid-F53A65E8-181B-44FD-BCA3-38F530D6C717" sourceRef="sid-2C59B75E-D7BA-415A-8AA4-96DF9D54560A" targetRef="sid-323AD77E-874D-4856-8E22-825D25989EE2">
+      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${approval2 == true}]]></conditionExpression>
+    </sequenceFlow>
+    <sequenceFlow id="sid-4A941651-157C-4676-BA3D-ECF897AF0FCD" sourceRef="sid-2C59B75E-D7BA-415A-8AA4-96DF9D54560A" targetRef="sid-EAE0F188-EA97-4818-B99D-70259F2307B0">
+      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${approval2 == false}]]></conditionExpression>
+    </sequenceFlow>
+    <sequenceFlow id="sid-41EB3FF5-F96D-49CE-8813-5B36FA4392BB" sourceRef="sid-4D2A9C2D-5D5B-4D4E-8FD1-FBB630DF8295" targetRef="sid-0DD45B2D-BF99-42FD-85E5-0991CBF13780">
+      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${inspector1approval == true && inspector2needed == false}]]></conditionExpression>
+    </sequenceFlow>
+    <sequenceFlow id="sid-422FE8C4-DC10-467D-A400-EA087E865F74" sourceRef="sid-4D2A9C2D-5D5B-4D4E-8FD1-FBB630DF8295" targetRef="sid-8090E0D9-B068-4596-A6C6-8768C5803456">
+      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${inspector1approval == false}]]></conditionExpression>
+    </sequenceFlow>
+    <serviceTask id="sid-309E736B-EF85-4334-965B-DB8974B26011" name="Angebot abgelehnt (Benachrichtigung)" flowable:class="de.adito.aditoweb.server.neon.workflow.WorkflowServiceTask">
+      <extensionElements>
+        <flowable:field name="jditoProcess">
+          <flowable:string><![CDATA[CreateOfferNotification_workflowService]]></flowable:string>
+        </flowable:field>
+      </extensionElements>
+    </serviceTask>
+    <serviceTask id="sid-64F6F0E9-85B8-43C7-84A8-F29A4C31D81F" name="Angebot freigegeben (Benachrichtigung)" flowable:class="de.adito.aditoweb.server.neon.workflow.WorkflowServiceTask">
+      <extensionElements>
+        <flowable:field name="jditoProcess">
+          <flowable:string><![CDATA[CreateOfferApprovedNotification_workflowService]]></flowable:string>
+        </flowable:field>
+      </extensionElements>
+    </serviceTask>
+    <serviceTask id="sid-C375332E-BD9B-44E5-8498-61736B7E806C" name="Angebot freigegeben (Benachrichtigung)" flowable:class="de.adito.aditoweb.server.neon.workflow.WorkflowServiceTask">
+      <extensionElements>
+        <flowable:field name="jditoProcess">
+          <flowable:string><![CDATA[CreateOfferApprovedNotification_workflowService]]></flowable:string>
+        </flowable:field>
+      </extensionElements>
+    </serviceTask>
+    <serviceTask id="sid-13EC2DCF-F704-4F8F-A333-5C18C78B231F" name="Angebot abgelehnt (Benachrichtigung)" flowable:class="de.adito.aditoweb.server.neon.workflow.WorkflowServiceTask">
+      <extensionElements>
+        <flowable:field name="jditoProcess">
+          <flowable:string><![CDATA[CreateOfferNotification_workflowService]]></flowable:string>
+        </flowable:field>
+      </extensionElements>
+    </serviceTask>
+    <sequenceFlow id="sid-12B876BD-B89E-4E27-84F4-2A3E9D33AE36" sourceRef="sid-EAE0F188-EA97-4818-B99D-70259F2307B0" targetRef="sid-13EC2DCF-F704-4F8F-A333-5C18C78B231F"></sequenceFlow>
+    <sequenceFlow id="sid-DA26ED45-18EB-4C4E-A087-63F5FF8FBC80" sourceRef="sid-323AD77E-874D-4856-8E22-825D25989EE2" targetRef="sid-C375332E-BD9B-44E5-8498-61736B7E806C"></sequenceFlow>
+    <sequenceFlow id="sid-830D5DD8-CA32-4A5C-929C-86DBFD5CF289" sourceRef="sid-0DD45B2D-BF99-42FD-85E5-0991CBF13780" targetRef="sid-64F6F0E9-85B8-43C7-84A8-F29A4C31D81F"></sequenceFlow>
+    <sequenceFlow id="sid-E6F2BF23-4ACB-4426-BB61-AEA55BA6691E" sourceRef="sid-8090E0D9-B068-4596-A6C6-8768C5803456" targetRef="sid-309E736B-EF85-4334-965B-DB8974B26011"></sequenceFlow>
+    <sequenceFlow id="sid-4CB7BA5A-CD2E-4C92-A18B-A9AA73EFAE30" sourceRef="sid-309E736B-EF85-4334-965B-DB8974B26011" targetRef="sid-93501888-538B-4BAE-8AE6-711A3FECA4FE"></sequenceFlow>
+    <sequenceFlow id="sid-F9ABC3A1-CC1C-4884-A1DE-E8807C0AEB39" sourceRef="sid-64F6F0E9-85B8-43C7-84A8-F29A4C31D81F" targetRef="sid-C4B0ADE8-A005-4AC8-8E47-1E223E2050F0"></sequenceFlow>
+    <sequenceFlow id="sid-891A4694-41D0-4F9B-9D91-5C51520C308C" sourceRef="sid-13EC2DCF-F704-4F8F-A333-5C18C78B231F" targetRef="sid-93501888-538B-4BAE-8AE6-711A3FECA4FE"></sequenceFlow>
+    <sequenceFlow id="sid-73E245F8-F8AC-4EFC-A339-7B3716A67C0D" sourceRef="sid-C375332E-BD9B-44E5-8498-61736B7E806C" targetRef="sid-C4B0ADE8-A005-4AC8-8E47-1E223E2050F0"></sequenceFlow>
+  </process>
+  <bpmndi:BPMNDiagram id="BPMNDiagram_approveOffer">
+    <bpmndi:BPMNPlane bpmnElement="approveOffer" id="BPMNPlane_approveOffer">
+      <bpmndi:BPMNShape bpmnElement="startEvent1" id="BPMNShape_startEvent1">
+        <omgdc:Bounds height="30.0" width="30.0" x="30.0" y="408.8636382847777"></omgdc:Bounds>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape bpmnElement="sid-7EE94F7E-20DC-49DF-A751-7EC30166393B" id="BPMNShape_sid-7EE94F7E-20DC-49DF-A751-7EC30166393B">
+        <omgdc:Bounds height="80.0" width="100.0" x="255.0" y="383.8636382847777"></omgdc:Bounds>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape bpmnElement="sid-4D2A9C2D-5D5B-4D4E-8FD1-FBB630DF8295" id="BPMNShape_sid-4D2A9C2D-5D5B-4D4E-8FD1-FBB630DF8295">
+        <omgdc:Bounds height="40.0" width="40.0" x="420.0" y="403.8636382847777"></omgdc:Bounds>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape bpmnElement="sid-8090E0D9-B068-4596-A6C6-8768C5803456" id="BPMNShape_sid-8090E0D9-B068-4596-A6C6-8768C5803456">
+        <omgdc:Bounds height="80.0" width="100.0" x="510.0" y="210.0"></omgdc:Bounds>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape bpmnElement="sid-0DD45B2D-BF99-42FD-85E5-0991CBF13780" id="BPMNShape_sid-0DD45B2D-BF99-42FD-85E5-0991CBF13780">
+        <omgdc:Bounds height="80.0" width="100.0" x="510.0" y="383.8636382847777"></omgdc:Bounds>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape bpmnElement="approvalTask2" id="BPMNShape_approvalTask2">
+        <omgdc:Bounds height="80.0" width="100.0" x="255.0" y="664.0"></omgdc:Bounds>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape bpmnElement="sid-BEB99CF9-21AB-422C-B5BA-C8F933C4A458" id="BPMNShape_sid-BEB99CF9-21AB-422C-B5BA-C8F933C4A458">
+        <omgdc:Bounds height="80.0" width="99.99999999999997" x="101.42750037460016" y="664.0"></omgdc:Bounds>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape bpmnElement="sid-2C59B75E-D7BA-415A-8AA4-96DF9D54560A" id="BPMNShape_sid-2C59B75E-D7BA-415A-8AA4-96DF9D54560A">
+        <omgdc:Bounds height="40.0" width="40.0" x="420.0" y="684.0"></omgdc:Bounds>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape bpmnElement="sid-323AD77E-874D-4856-8E22-825D25989EE2" id="BPMNShape_sid-323AD77E-874D-4856-8E22-825D25989EE2">
+        <omgdc:Bounds height="80.0" width="100.0" x="510.0" y="664.0"></omgdc:Bounds>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape bpmnElement="sid-EAE0F188-EA97-4818-B99D-70259F2307B0" id="BPMNShape_sid-EAE0F188-EA97-4818-B99D-70259F2307B0">
+        <omgdc:Bounds height="80.0" width="100.0" x="510.0" y="825.0"></omgdc:Bounds>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape bpmnElement="sid-0ADBAADA-F257-4C7F-9AC1-9565AD03DEB7" id="BPMNShape_sid-0ADBAADA-F257-4C7F-9AC1-9565AD03DEB7">
+        <omgdc:Bounds height="80.0" width="100.0" x="105.0" y="383.8636382847777"></omgdc:Bounds>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape bpmnElement="sid-93501888-538B-4BAE-8AE6-711A3FECA4FE" id="BPMNShape_sid-93501888-538B-4BAE-8AE6-711A3FECA4FE">
+        <omgdc:Bounds height="80.0" width="100.0" x="930.0" y="525.0"></omgdc:Bounds>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape bpmnElement="sid-90F027C6-9870-40C1-8BCF-A96A25F76AF5" id="BPMNShape_sid-90F027C6-9870-40C1-8BCF-A96A25F76AF5">
+        <omgdc:Bounds height="28.0" width="28.0" x="1065.0" y="551.0"></omgdc:Bounds>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape bpmnElement="sid-C4B0ADE8-A005-4AC8-8E47-1E223E2050F0" id="BPMNShape_sid-C4B0ADE8-A005-4AC8-8E47-1E223E2050F0">
+        <omgdc:Bounds height="80.0" width="100.0" x="690.0" y="525.0"></omgdc:Bounds>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape bpmnElement="sid-3B123F1B-D924-4EE3-99E7-B91E776A0F69" id="BPMNShape_sid-3B123F1B-D924-4EE3-99E7-B91E776A0F69">
+        <omgdc:Bounds height="28.0" width="28.0" x="825.0" y="551.0"></omgdc:Bounds>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape bpmnElement="sid-309E736B-EF85-4334-965B-DB8974B26011" id="BPMNShape_sid-309E736B-EF85-4334-965B-DB8974B26011">
+        <omgdc:Bounds height="80.0" width="100.0" x="690.0" y="209.0"></omgdc:Bounds>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape bpmnElement="sid-64F6F0E9-85B8-43C7-84A8-F29A4C31D81F" id="BPMNShape_sid-64F6F0E9-85B8-43C7-84A8-F29A4C31D81F">
+        <omgdc:Bounds height="80.0" width="100.0" x="690.0" y="383.8636382847777"></omgdc:Bounds>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape bpmnElement="sid-C375332E-BD9B-44E5-8498-61736B7E806C" id="BPMNShape_sid-C375332E-BD9B-44E5-8498-61736B7E806C">
+        <omgdc:Bounds height="80.0" width="100.0" x="690.0" y="664.0"></omgdc:Bounds>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape bpmnElement="sid-13EC2DCF-F704-4F8F-A333-5C18C78B231F" id="BPMNShape_sid-13EC2DCF-F704-4F8F-A333-5C18C78B231F">
+        <omgdc:Bounds height="80.0" width="100.0" x="690.0" y="825.0"></omgdc:Bounds>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge bpmnElement="sid-891A4694-41D0-4F9B-9D91-5C51520C308C" id="BPMNEdge_sid-891A4694-41D0-4F9B-9D91-5C51520C308C">
+        <omgdi:waypoint x="789.9499999999999" y="865.0"></omgdi:waypoint>
+        <omgdi:waypoint x="980.0" y="865.0"></omgdi:waypoint>
+        <omgdi:waypoint x="980.0" y="604.9499999999999"></omgdi:waypoint>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge bpmnElement="sid-4CB7BA5A-CD2E-4C92-A18B-A9AA73EFAE30" id="BPMNEdge_sid-4CB7BA5A-CD2E-4C92-A18B-A9AA73EFAE30">
+        <omgdi:waypoint x="789.9499999999477" y="249.0"></omgdi:waypoint>
+        <omgdi:waypoint x="980.0" y="249.0"></omgdi:waypoint>
+        <omgdi:waypoint x="980.0" y="525.0"></omgdi:waypoint>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge bpmnElement="sid-57A915C4-CDCE-4D1F-AFEF-B61495262C8C" id="BPMNEdge_sid-57A915C4-CDCE-4D1F-AFEF-B61495262C8C">
+        <omgdi:waypoint x="59.9499984899576" y="423.8636382847777"></omgdi:waypoint>
+        <omgdi:waypoint x="105.0" y="423.8636382847777"></omgdi:waypoint>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge bpmnElement="sid-41EB3FF5-F96D-49CE-8813-5B36FA4392BB" id="BPMNEdge_sid-41EB3FF5-F96D-49CE-8813-5B36FA4392BB">
+        <omgdi:waypoint x="459.941694421308" y="423.8636382847777"></omgdi:waypoint>
+        <omgdi:waypoint x="509.9999999999096" y="423.8636382847777"></omgdi:waypoint>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge bpmnElement="sid-8142B71B-3DC1-4099-9F3A-F0DB9D0E59E3" id="BPMNEdge_sid-8142B71B-3DC1-4099-9F3A-F0DB9D0E59E3">
+        <omgdi:waypoint x="1029.9499999998811" y="565.0"></omgdi:waypoint>
+        <omgdi:waypoint x="1065.0" y="565.0"></omgdi:waypoint>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge bpmnElement="sid-E529BD6B-1A6A-44AF-A487-5B47D641D22D" id="BPMNEdge_sid-E529BD6B-1A6A-44AF-A487-5B47D641D22D">
+        <omgdi:waypoint x="354.9499999999327" y="704.0"></omgdi:waypoint>
+        <omgdi:waypoint x="420.0" y="704.0"></omgdi:waypoint>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge bpmnElement="sid-73E245F8-F8AC-4EFC-A339-7B3716A67C0D" id="BPMNEdge_sid-73E245F8-F8AC-4EFC-A339-7B3716A67C0D">
+        <omgdi:waypoint x="740.0" y="664.0"></omgdi:waypoint>
+        <omgdi:waypoint x="740.0" y="604.9499999999999"></omgdi:waypoint>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge bpmnElement="sid-422FE8C4-DC10-467D-A400-EA087E865F74" id="BPMNEdge_sid-422FE8C4-DC10-467D-A400-EA087E865F74">
+        <omgdi:waypoint x="440.0" y="403.8636382847777"></omgdi:waypoint>
+        <omgdi:waypoint x="440.0" y="250.0"></omgdi:waypoint>
+        <omgdi:waypoint x="509.9999999999779" y="250.0"></omgdi:waypoint>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge bpmnElement="sid-DA26ED45-18EB-4C4E-A087-63F5FF8FBC80" id="BPMNEdge_sid-DA26ED45-18EB-4C4E-A087-63F5FF8FBC80">
+        <omgdi:waypoint x="609.9499999999998" y="704.0"></omgdi:waypoint>
+        <omgdi:waypoint x="690.0" y="704.0"></omgdi:waypoint>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge bpmnElement="sid-830D5DD8-CA32-4A5C-929C-86DBFD5CF289" id="BPMNEdge_sid-830D5DD8-CA32-4A5C-929C-86DBFD5CF289">
+        <omgdi:waypoint x="609.9499999999431" y="423.8636382847777"></omgdi:waypoint>
+        <omgdi:waypoint x="689.9999999996652" y="423.8636382847777"></omgdi:waypoint>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge bpmnElement="sid-7133F014-E561-45C5-99A2-EF6398DA3E49" id="BPMNEdge_sid-7133F014-E561-45C5-99A2-EF6398DA3E49">
+        <omgdi:waypoint x="789.9499999998811" y="565.0"></omgdi:waypoint>
+        <omgdi:waypoint x="825.0" y="565.0"></omgdi:waypoint>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge bpmnElement="sid-F9ABC3A1-CC1C-4884-A1DE-E8807C0AEB39" id="BPMNEdge_sid-F9ABC3A1-CC1C-4884-A1DE-E8807C0AEB39">
+        <omgdi:waypoint x="740.0" y="463.81363828477777"></omgdi:waypoint>
+        <omgdi:waypoint x="740.0" y="525.0"></omgdi:waypoint>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge bpmnElement="sid-8A3C7A28-71DD-47C8-9521-803C72A803E9" id="BPMNEdge_sid-8A3C7A28-71DD-47C8-9521-803C72A803E9">
+        <omgdi:waypoint x="440.0" y="443.8012062654454"></omgdi:waypoint>
+        <omgdi:waypoint x="440.0" y="504.0"></omgdi:waypoint>
+        <omgdi:waypoint x="151.0" y="504.0"></omgdi:waypoint>
+        <omgdi:waypoint x="151.3420002996801" y="664.0"></omgdi:waypoint>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge bpmnElement="sid-F53A65E8-181B-44FD-BCA3-38F530D6C717" id="BPMNEdge_sid-F53A65E8-181B-44FD-BCA3-38F530D6C717">
+        <omgdi:waypoint x="459.9416944213154" y="704.0"></omgdi:waypoint>
+        <omgdi:waypoint x="510.0" y="704.0"></omgdi:waypoint>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge bpmnElement="sid-095E3C78-BB9A-4E49-944B-16F7ABA8F097" id="BPMNEdge_sid-095E3C78-BB9A-4E49-944B-16F7ABA8F097">
+        <omgdi:waypoint x="204.95" y="423.8636382847777"></omgdi:waypoint>
+        <omgdi:waypoint x="255.0" y="423.8636382847777"></omgdi:waypoint>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge bpmnElement="sid-4A941651-157C-4676-BA3D-ECF897AF0FCD" id="BPMNEdge_sid-4A941651-157C-4676-BA3D-ECF897AF0FCD">
+        <omgdi:waypoint x="440.0" y="723.9438081936685"></omgdi:waypoint>
+        <omgdi:waypoint x="440.0" y="865.0"></omgdi:waypoint>
+        <omgdi:waypoint x="509.9999999998528" y="865.0"></omgdi:waypoint>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge bpmnElement="sid-24CE050E-5CA0-4410-9359-EAAA687200E3" id="BPMNEdge_sid-24CE050E-5CA0-4410-9359-EAAA687200E3">
+        <omgdi:waypoint x="354.94999999972237" y="423.8636382847777"></omgdi:waypoint>
+        <omgdi:waypoint x="420.0" y="423.8636382847777"></omgdi:waypoint>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge bpmnElement="sid-BC4E1929-6C63-42F3-8086-A671EAA09D2E" id="BPMNEdge_sid-BC4E1929-6C63-42F3-8086-A671EAA09D2E">
+        <omgdi:waypoint x="201.37750037447097" y="704.0"></omgdi:waypoint>
+        <omgdi:waypoint x="255.0" y="704.0"></omgdi:waypoint>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge bpmnElement="sid-E6F2BF23-4ACB-4426-BB61-AEA55BA6691E" id="BPMNEdge_sid-E6F2BF23-4ACB-4426-BB61-AEA55BA6691E">
+        <omgdi:waypoint x="609.9499999999981" y="249.72222222222223"></omgdi:waypoint>
+        <omgdi:waypoint x="690.0" y="249.2775"></omgdi:waypoint>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge bpmnElement="sid-12B876BD-B89E-4E27-84F4-2A3E9D33AE36" id="BPMNEdge_sid-12B876BD-B89E-4E27-84F4-2A3E9D33AE36">
+        <omgdi:waypoint x="609.9499999999998" y="865.0"></omgdi:waypoint>
+        <omgdi:waypoint x="690.0" y="865.0"></omgdi:waypoint>
+      </bpmndi:BPMNEdge>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</definitions>
\ No newline at end of file
diff --git a/process/CreateOfferApprovedActivity_workflowService/CreateOfferApprovedActivity_workflowService.aod b/process/CreateOfferApprovedActivity_workflowService/CreateOfferApprovedActivity_workflowService.aod
new file mode 100644
index 0000000000..7e7f4e23c7
--- /dev/null
+++ b/process/CreateOfferApprovedActivity_workflowService/CreateOfferApprovedActivity_workflowService.aod
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<process xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.2.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.2.2">
+  <name>CreateOfferApprovedActivity_workflowService</name>
+  <majorModelMode>DISTRIBUTED</majorModelMode>
+  <process>%aditoprj%/process/CreateOfferApprovedActivity_workflowService/process.js</process>
+  <alias>Data_alias</alias>
+  <serviceTaskParameterProcess>%aditoprj%/process/CreateOfferApprovedActivity_workflowService/serviceTaskParameterProcess.js</serviceTaskParameterProcess>
+  <variants>
+    <element>WORKFLOW</element>
+  </variants>
+</process>
diff --git a/process/CreateOfferApprovedActivity_workflowService/process.js b/process/CreateOfferApprovedActivity_workflowService/process.js
new file mode 100644
index 0000000000..cdb5ca147a
--- /dev/null
+++ b/process/CreateOfferApprovedActivity_workflowService/process.js
@@ -0,0 +1,24 @@
+import("system.translate");
+import("ActivityTask_lib");
+import("system.datetime");
+import("KeywordRegistry_basic");
+import("Sql_lib");
+import("system.vars");
+
+var variables = JSON.parse(vars.get("$local.value"));
+var user = newSelect("OFFER.ACTIONUSER").from("OFFER").where("OFFER.OFFERID", variables.targetId).cell();
+
+var activityData = {
+    directionKeywordId : $KeywordRegistry.activityDirection$internal(),
+    categoryKeywordId : $KeywordRegistry.activityCategory$approval(),
+    entrydate : datetime.date(),
+    content : variables.description,
+    subject : "Angebot freigegeben", //translation doesn't work
+    userNew : vars.get("$sys.user"),
+    responsibleContactId: user
+};
+
+var links = [[variables.targetContext, variables.targetId]];
+var activity = ActivityUtils.insertNewActivity(activityData, links);
+
+newWhere("OFFER.OFFERID", variables.targetId).updateFields({"APPROVAL" : variables.approval});
\ No newline at end of file
diff --git a/process/CreateOfferApprovedActivity_workflowService/serviceTaskParameterProcess.js b/process/CreateOfferApprovedActivity_workflowService/serviceTaskParameterProcess.js
new file mode 100644
index 0000000000..273a35fba1
--- /dev/null
+++ b/process/CreateOfferApprovedActivity_workflowService/serviceTaskParameterProcess.js
@@ -0,0 +1,7 @@
+import("system.result");
+import("Workflow_lib");
+
+result.object([
+    new WorkflowServiceTaskParameter("description", "Beschreibung", WorkflowServiceTaskParameter.STRING()),
+    new WorkflowServiceTaskParameter("approval", "Freigabe", WorkflowServiceTaskParameter.NUMBER())
+]);
\ No newline at end of file
diff --git a/process/CreateOfferApprovedNotification/CreateOfferApprovedNotification_workflowService.aod b/process/CreateOfferApprovedNotification/CreateOfferApprovedNotification_workflowService.aod
new file mode 100644
index 0000000000..256a186b59
--- /dev/null
+++ b/process/CreateOfferApprovedNotification/CreateOfferApprovedNotification_workflowService.aod
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<process xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.2.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.2.2">
+  <name>CreateOfferApprovedNotification_workflowService</name>
+  <majorModelMode>DISTRIBUTED</majorModelMode>
+  <process>%aditoprj%/process/CreateOfferApprovedNotification_workflowService/process.js</process>
+  <alias>Data_alias</alias>
+  <variants>
+    <element>WORKFLOW</element>
+  </variants>
+</process>
diff --git a/process/CreateOfferApprovedNotification_workflowService/process.js b/process/CreateOfferApprovedNotification_workflowService/process.js
new file mode 100644
index 0000000000..de4c733c1f
--- /dev/null
+++ b/process/CreateOfferApprovedNotification_workflowService/process.js
@@ -0,0 +1,35 @@
+import("Keyword_lib");
+import("system.translate");
+import("Contact_lib");
+import("Sql_lib");
+import("system.tools");
+import("KeywordRegistry_basic");
+import("system.text");
+import("system.vars");
+import("system.notification");
+
+var variables = JSON.parse(vars.get("$local.value"));
+var userNewId = tools.getUserByAttribute([tools.TITLE], variables.userNew, tools.PROFILE_FULL)[tools.NAME];
+
+var offerData = newSelect([
+    "OFFER.ACTIONUSER",
+    "concat(OFFER.OFFERCODE, '-', OFFER.VERSNR)",
+    "OFFER.STATUS"
+]).from("OFFER")
+.where("OFFER.OFFERID", variables.targetId)
+.arrayRow();
+var offername = offerData[1] + " | " + KeywordUtils.getViewValue($KeywordRegistry.offerStatus(), offerData[2]);
+var user = ContactUtils.getTitleByContactId(offerData[0]);
+
+var config = notification.createConfig()
+    .notificationType("WorkflowNotification")
+    .caption("Angebot freigegeben") //translation doesn't work
+    .description("Die Freigabe Ihres Angebots \"" + offername + "\" wurde durch \"" + user + "\" freigegeben") //translation doesn't work
+    .addUsersWithIds([userNewId])
+    .forcedPriority(notification.PRIO_NORMAL)
+    .linkInfo(text.encodeMS([variables.targetContext, variables.targetId]))
+    .daysToLive(1);
+    
+notification.addNotificationWith(config);
+
+newWhere("OFFER.OFFERID", variables.targetId).updateFields({"ACTIONUSER": ""});
\ No newline at end of file
diff --git a/process/CreateOfferDeniedActivity_workflowService/CreateOfferDeniedActivity_workflowService.aod b/process/CreateOfferDeniedActivity_workflowService/CreateOfferDeniedActivity_workflowService.aod
new file mode 100644
index 0000000000..520a973407
--- /dev/null
+++ b/process/CreateOfferDeniedActivity_workflowService/CreateOfferDeniedActivity_workflowService.aod
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<process xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.2.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.2.2">
+  <name>CreateOfferDeniedActivity_workflowService</name>
+  <majorModelMode>DISTRIBUTED</majorModelMode>
+  <process>%aditoprj%/process/CreateOfferDeniedActivity_workflowService/process.js</process>
+  <alias>Data_alias</alias>
+  <serviceTaskParameterProcess>%aditoprj%/process/CreateOfferDeniedActivity_workflowService/serviceTaskParameterProcess.js</serviceTaskParameterProcess>
+  <variants>
+    <element>WORKFLOW</element>
+  </variants>
+</process>
diff --git a/process/CreateOfferDeniedActivity_workflowService/process.js b/process/CreateOfferDeniedActivity_workflowService/process.js
new file mode 100644
index 0000000000..1caa7274d4
--- /dev/null
+++ b/process/CreateOfferDeniedActivity_workflowService/process.js
@@ -0,0 +1,74 @@
+import("system.translate");
+import("system.entities");
+import("system.tools");
+import("system.workflow");
+import("ActivityTask_lib");
+import("KeywordRegistry_basic");
+import("system.datetime");
+import("Sql_lib");
+import("system.vars");
+
+var variables = JSON.parse(vars.get("$local.value"));
+
+newWhere("OFFER.OFFERID", variables.targetId).updateFields({"APPROVAL" : 0});
+
+var user = newSelect("OFFER.ACTIONUSER").from("OFFER").where("OFFER.OFFERID", variables.targetId).cell();
+var today = datetime.date();
+var subject = "Angebot abgelehnt"; //translation doesn't work
+var reason;
+
+if (variables.firstOrSecond == "1") {
+    reason = variables.reason;
+} else {
+    reason = variables.reason2;
+}
+
+var activityData = {
+    directionKeywordId : $KeywordRegistry.activityDirection$internal(),
+    categoryKeywordId : $KeywordRegistry.activityCategory$approval(),
+    entrydate : today,
+    content : reason,
+    subject : subject,
+    userNew : vars.get("$sys.user"),
+    responsibleContactId: user
+};
+
+var links = [[variables.targetContext, variables.targetId]];
+var activity = ActivityUtils.insertNewActivity(activityData, links);
+
+var loadConfig = workflow.createConfigForLoadingTasks();
+loadConfig.processInstanceId(vars.get("$local.uid"));
+var tasks = JSON.parse(workflow.getTasks(loadConfig));
+
+var requestor;
+
+tasks.forEach(function (task){
+    requestor = tools.getUserByAttribute(tools.NAME, task.assignee, tools.PROFILE_FULL)[tools.PARAMS][tools.CONTACTID];
+});
+
+var configLink = entities.createConfigForAddingRows();
+configLink.entity("TaskLink_entity");
+configLink.fieldValues({
+    "OBJECT_TYPE": variables.targetContext,
+    "OBJECT_ROWID": variables.targetId
+});
+
+var userNewContactId = tools.getUserByAttribute([tools.TITLE], variables.userNew, tools.PROFILE_FULL)[tools.PARAMS][tools.CONTACTID];
+
+var config = entities.createConfigForAddingRows();
+config.entity("Task_entity");
+config.fieldValues({
+    "SUBJECT": subject,
+    "REQUESTOR_CONTACT_ID": requestor,
+    "EDITOR_CONTACT_ID": userNewContactId, 
+    "TYPE": $KeywordRegistry.taskType$task(),
+    "STATUS": $KeywordRegistry.taskStatus$assigned(),
+    "PRIORITY": $KeywordRegistry.taskPriority$low(),
+    "DESCRIPTION": reason,
+    "START_DATE": today,
+    "PROGRESS": $KeywordRegistry.taskProgress$0(),
+    "Links": configLink
+});
+config.user("Admin");
+
+entities.createRow(config);
\ No newline at end of file
diff --git a/process/CreateOfferDeniedActivity_workflowService/serviceTaskParameterProcess.js b/process/CreateOfferDeniedActivity_workflowService/serviceTaskParameterProcess.js
new file mode 100644
index 0000000000..76f283b6e2
--- /dev/null
+++ b/process/CreateOfferDeniedActivity_workflowService/serviceTaskParameterProcess.js
@@ -0,0 +1,17 @@
+import("Workflow_lib");
+import("system.result");
+
+var items = [
+    {
+        id: "1",
+        name: "Erste Begründung"
+    },
+    {
+        id: "2",
+        name: "Zweite Begründung"
+    }
+]
+
+result.object([
+    new WorkflowServiceTaskParameter("firstOrSecond", "Erste oder Zweite Begründung", WorkflowServiceTaskParameter.ENUM(), items)
+]);
diff --git a/process/CreateOfferNotification_workflowService/CreateOfferNotification_workflowService.aod b/process/CreateOfferNotification_workflowService/CreateOfferNotification_workflowService.aod
new file mode 100644
index 0000000000..d2860a2a5f
--- /dev/null
+++ b/process/CreateOfferNotification_workflowService/CreateOfferNotification_workflowService.aod
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<process xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.2.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.2.2">
+  <name>CreateOfferNotification_workflowService</name>
+  <majorModelMode>DISTRIBUTED</majorModelMode>
+  <process>%aditoprj%/process/CreateOfferNotification_workflowService/process.js</process>
+  <alias>Data_alias</alias>
+  <variants>
+    <element>WORKFLOW</element>
+  </variants>
+</process>
diff --git a/process/CreateOfferNotification_workflowService/process.js b/process/CreateOfferNotification_workflowService/process.js
new file mode 100644
index 0000000000..d6a3583a95
--- /dev/null
+++ b/process/CreateOfferNotification_workflowService/process.js
@@ -0,0 +1,32 @@
+import("Keyword_lib");
+import("system.translate");
+import("Contact_lib");
+import("Sql_lib");
+import("system.tools");
+import("KeywordRegistry_basic");
+import("system.text");
+import("system.vars");
+import("system.notification");
+
+var variables = JSON.parse(vars.get("$local.value"));
+var userNewId = tools.getUserByAttribute([tools.TITLE], variables.userNew, tools.PROFILE_FULL)[tools.NAME];
+
+var offerData = newSelect([
+    "OFFER.ACTIONUSER",
+    "concat(OFFER.OFFERCODE, '-', OFFER.VERSNR)"
+]).from("OFFER")
+.where("OFFER.OFFERID", variables.targetId)
+.arrayRow();
+var offername = offerData[1];
+var user = ContactUtils.getTitleByContactId(offerData[0]);
+
+var config = notification.createConfig()
+    .notificationType("WorkflowNotification")
+    .caption("Angebot abgelehnt") //translation doesn't work
+    .description("Die Freigabe Ihres Angebots \"" + offername + "\" wurde durch \"" + user + "\" abgelehnt") //translation doesn't work
+    .addUsersWithIds([userNewId])
+    .forcedPriority(notification.PRIO_NORMAL)
+    .linkInfo(text.encodeMS([variables.targetContext, variables.targetId]))
+    .daysToLive(1);
+    
+notification.addNotificationWith(config);
\ No newline at end of file
diff --git a/process/KeywordRegistry_basic/process.js b/process/KeywordRegistry_basic/process.js
index 8906c9fcaf..480fe7ab1f 100644
--- a/process/KeywordRegistry_basic/process.js
+++ b/process/KeywordRegistry_basic/process.js
@@ -56,6 +56,8 @@ $KeywordRegistry.offerStatus$sent = function(){return "OFFERSTATSENT";};
 $KeywordRegistry.offerStatus$won = function(){return "OFFERSTATWON";};
 $KeywordRegistry.offerStatus$lost = function(){return "OFFERSTATLOST";};
 $KeywordRegistry.offerStatus$toCheck = function(){return "OFFERSTATTOCHECK";};
+$KeywordRegistry.offerStatus$denied = function(){return "OFFERSTATDENIED";};
+$KeywordRegistry.offerStatus$approved = function(){return "OFFERSTATAPPROVED";};
 
 $KeywordRegistry.organisationType = function(){return "OrganisationType";};
 $KeywordRegistry.organisationType$manufacturer = function(){return "ORGMANUF";};
@@ -114,6 +116,7 @@ $KeywordRegistry.activityCategory$letter = function(){return "LETTER";};
 $KeywordRegistry.activityCategory$visit = function(){return "VISIT";};
 $KeywordRegistry.activityCategory$phone = function(){return "PHONE";};
 $KeywordRegistry.activityCategory$onlineMeeting = function(){return "ONLINE-MEETING";};
+$KeywordRegistry.activityCategory$approval = function(){return "APPROVAL";};
 
 $KeywordRegistry.addressType = function(){return "AddressType";};
 $KeywordRegistry.addressType$private = function(){return "HOMEADDR";};
diff --git a/process/UpdateOfferStatus_workflowService/UpdateOfferStatus_workflowService.aod b/process/UpdateOfferStatus_workflowService/UpdateOfferStatus_workflowService.aod
new file mode 100644
index 0000000000..45d94d6c13
--- /dev/null
+++ b/process/UpdateOfferStatus_workflowService/UpdateOfferStatus_workflowService.aod
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<process xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.2.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.2.2">
+  <name>UpdateOfferStatus_workflowService</name>
+  <majorModelMode>DISTRIBUTED</majorModelMode>
+  <process>%aditoprj%/process/UpdateOfferStatus_workflowService/process.js</process>
+  <alias>Data_alias</alias>
+  <serviceTaskParameterProcess>%aditoprj%/process/UpdateOfferStatus_workflowService/serviceTaskParameterProcess.js</serviceTaskParameterProcess>
+  <variants>
+    <element>WORKFLOW</element>
+  </variants>
+</process>
diff --git a/process/UpdateOfferStatus_workflowService/process.js b/process/UpdateOfferStatus_workflowService/process.js
new file mode 100644
index 0000000000..18596c5690
--- /dev/null
+++ b/process/UpdateOfferStatus_workflowService/process.js
@@ -0,0 +1,8 @@
+import("system.result");
+import("system.datetime");
+import("Sql_lib");
+import("system.vars");
+
+var variables = JSON.parse(vars.get("$local.value"));
+
+newWhere("OFFER.OFFERID", variables.targetId).updateFields({"STATUS" : variables.status, "APPROVAL" : variables.time});
\ No newline at end of file
diff --git a/process/UpdateOfferStatus_workflowService/serviceTaskParameterProcess.js b/process/UpdateOfferStatus_workflowService/serviceTaskParameterProcess.js
new file mode 100644
index 0000000000..5fe0b0f9a0
--- /dev/null
+++ b/process/UpdateOfferStatus_workflowService/serviceTaskParameterProcess.js
@@ -0,0 +1,14 @@
+import("KeywordData_lib");
+import("KeywordRegistry_basic");
+import("Workflow_lib");
+import("system.result");
+
+result.object([
+    new WorkflowServiceTaskParameter("status", "Status", WorkflowServiceTaskParameter.ENUM(), _getKeywords($KeywordRegistry.offerStatus())),
+    new WorkflowServiceTaskParameter("time", "Time", WorkflowServiceTaskParameter.NUMBER())
+]);
+
+function _getKeywords (pContainer)
+{
+    return KeywordData.getSimpleData(pContainer).map(function (item) {return {id : item[0], name : item[1]};});
+}
\ No newline at end of file
diff --git a/process/Workflow_lib/process.js b/process/Workflow_lib/process.js
index 5d05eedb80..3965813e2b 100644
--- a/process/Workflow_lib/process.js
+++ b/process/Workflow_lib/process.js
@@ -112,6 +112,34 @@ WorkflowUtils.getModelerUrl = function (pModelId, pIsEditor)
     return modelerUrl;
 }
 
+/**
+ * Gets the WorkflowTask ID by by comparing the given instance ID
+ * with the ID in the variable 'targetId'
+ * 
+ * @param {String} pTargetId the instance id which the workflow is started from
+ * @param {String} pTargetContext the context which the workflow is started from
+ * 
+ * @return {String} returns the taskId
+ */
+WorkflowUtils.getTaskId = function (pTargetId, pTargetContext)
+{
+    var res = "";
+    var loadConfig = workflow.createConfigForLoadingTask();
+    loadConfig.variables({
+        targetId: pTargetId.toString(),
+        targetContext: pTargetContext.toString()
+    });
+    
+    var task = JSON.parse(workflow.getTask(loadConfig));
+    
+    if (task)
+    {
+        res = task.id;
+    }
+    
+    return res;
+}
+
 /**
  * provides functions for working with workflow signals
  */
diff --git a/role/PROJECT_Inspector1/PROJECT_Inspector1.aod b/role/PROJECT_Inspector1/PROJECT_Inspector1.aod
new file mode 100644
index 0000000000..73d6e71c56
--- /dev/null
+++ b/role/PROJECT_Inspector1/PROJECT_Inspector1.aod
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<role xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.2.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/role/1.2.0">
+  <name>PROJECT_Inspector1</name>
+  <majorModelMode>DISTRIBUTED</majorModelMode>
+</role>
diff --git a/role/PROJECT_Inspector2/PROJECT_Inspector2.aod b/role/PROJECT_Inspector2/PROJECT_Inspector2.aod
new file mode 100644
index 0000000000..94c0fd7004
--- /dev/null
+++ b/role/PROJECT_Inspector2/PROJECT_Inspector2.aod
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<role xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.2.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/role/1.2.0">
+  <name>PROJECT_Inspector2</name>
+  <title>executives</title>
+  <majorModelMode>DISTRIBUTED</majorModelMode>
+</role>
-- 
GitLab