From 2f9f8dcc7abaa16fd2a60d5f3f415fc3f7f9e11f Mon Sep 17 00:00:00 2001
From: Johannes Hoermann <j.hoermann@adito.de>
Date: Mon, 18 Nov 2019 14:18:43 +0100
Subject: [PATCH] use state processes of all fields in offer instead of the
 grantUpdateProcess

---
 entity/Offer_entity/Offer_entity.aod           | 18 ++++++++++++++++++
 .../entityfields/address/stateProcess.js       |  6 ++++++
 .../choosentexfooter/stateProcess.js           |  6 ++++++
 .../choosentexheader/stateProcess.js           |  6 ++++++
 .../choosetexheader/stateProcess.js            |  6 ++++++
 .../entityfields/chosenaddress/stateProcess.js |  5 +++--
 .../entityfields/contact_id/stateProcess.js    |  7 +++++--
 .../contact_org_id/stateProcess.js             |  6 ++++++
 .../contact_person_id/stateProcess.js          |  6 ++++++
 .../entityfields/currency/stateProcess.js      |  6 ++++++
 .../entityfields/deliveryterms/stateProcess.js |  6 ++++++
 .../entityfields/footer/stateProcess.js        |  6 ++++++
 .../entityfields/header/stateProcess.js        |  6 ++++++
 .../entityfields/info/stateProcess.js          |  6 ++++++
 .../entityfields/isolanguage/stateProcess.js   |  3 ++-
 .../lettersalutation/stateProcess.js           |  6 ++++++
 .../entityfields/object_rowid/stateProcess.js  |  5 ++++-
 .../entityfields/offer_id/stateProcess.js      |  6 ++++++
 .../entityfields/offerdate/stateProcess.js     |  6 ++++++
 .../entityfields/offerid/stateProcess.js       |  6 ++++++
 .../entityfields/paymentterms/stateProcess.js  |  6 ++++++
 .../entityfields/probability/stateProcess.js   |  6 ++++++
 .../entityfields/status/stateProcess.js        |  7 +++++++
 entity/Offer_entity/grantUpdateProcess.js      |  7 ++-----
 process/Offer_lib/process.js                   |  2 +-
 25 files changed, 144 insertions(+), 12 deletions(-)
 create mode 100644 entity/Offer_entity/entityfields/address/stateProcess.js
 create mode 100644 entity/Offer_entity/entityfields/choosentexfooter/stateProcess.js
 create mode 100644 entity/Offer_entity/entityfields/choosentexheader/stateProcess.js
 create mode 100644 entity/Offer_entity/entityfields/choosetexheader/stateProcess.js
 create mode 100644 entity/Offer_entity/entityfields/contact_org_id/stateProcess.js
 create mode 100644 entity/Offer_entity/entityfields/contact_person_id/stateProcess.js
 create mode 100644 entity/Offer_entity/entityfields/currency/stateProcess.js
 create mode 100644 entity/Offer_entity/entityfields/deliveryterms/stateProcess.js
 create mode 100644 entity/Offer_entity/entityfields/footer/stateProcess.js
 create mode 100644 entity/Offer_entity/entityfields/header/stateProcess.js
 create mode 100644 entity/Offer_entity/entityfields/info/stateProcess.js
 create mode 100644 entity/Offer_entity/entityfields/lettersalutation/stateProcess.js
 create mode 100644 entity/Offer_entity/entityfields/offer_id/stateProcess.js
 create mode 100644 entity/Offer_entity/entityfields/offerdate/stateProcess.js
 create mode 100644 entity/Offer_entity/entityfields/offerid/stateProcess.js
 create mode 100644 entity/Offer_entity/entityfields/paymentterms/stateProcess.js
 create mode 100644 entity/Offer_entity/entityfields/probability/stateProcess.js
 create mode 100644 entity/Offer_entity/entityfields/status/stateProcess.js

diff --git a/entity/Offer_entity/Offer_entity.aod b/entity/Offer_entity/Offer_entity.aod
index 9d6a57ef2c..3eef0efb48 100644
--- a/entity/Offer_entity/Offer_entity.aod
+++ b/entity/Offer_entity/Offer_entity.aod
@@ -31,6 +31,7 @@
       <title>Currency</title>
       <consumer>KeywordCurrencies</consumer>
       <mandatory v="true" />
+      <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/currency/stateProcess.js</stateProcess>
       <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/currency/valueProcess.js</valueProcess>
       <displayValueProcess>%aditoprj%/entity/Offer_entity/entityfields/currency/displayValueProcess.js</displayValueProcess>
     </entityField>
@@ -50,11 +51,13 @@
       <outputFormat>dd.MM.yyyy</outputFormat>
       <inputFormat>dd.MM.yyyy</inputFormat>
       <mandatory v="true" />
+      <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/offerdate/stateProcess.js</stateProcess>
       <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/offerdate/valueProcess.js</valueProcess>
     </entityField>
     <entityField>
       <name>OFFERID</name>
       <title>OFFERID (UID)</title>
+      <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/offerid/stateProcess.js</stateProcess>
       <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/offerid/valueProcess.js</valueProcess>
     </entityField>
     <entityField>
@@ -62,6 +65,7 @@
       <title>Probability</title>
       <consumer>KeywordProbabilities</consumer>
       <contentType>NUMBER</contentType>
+      <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/probability/stateProcess.js</stateProcess>
       <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/probability/valueProcess.js</valueProcess>
       <displayValueProcess>%aditoprj%/entity/Offer_entity/entityfields/probability/displayValueProcess.js</displayValueProcess>
     </entityField>
@@ -70,6 +74,7 @@
       <title>Status</title>
       <consumer>KeywordOfferStates</consumer>
       <mandatory v="true" />
+      <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/status/stateProcess.js</stateProcess>
       <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/status/valueProcess.js</valueProcess>
       <displayValueProcess>%aditoprj%/entity/Offer_entity/entityfields/status/displayValueProcess.js</displayValueProcess>
     </entityField>
@@ -91,6 +96,7 @@
       <name>HEADER</name>
       <title>Header text</title>
       <contentType>LONG_TEXT</contentType>
+      <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/header/stateProcess.js</stateProcess>
       <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/header/valueProcess.js</valueProcess>
     </entityField>
     <entityConsumer>
@@ -181,6 +187,7 @@
       <name>OFFER_ID</name>
       <documentation>%aditoprj%/entity/Offer_entity/entityfields/offer_id/documentation.adoc</documentation>
       <title>OFFER_ID</title>
+      <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/offer_id/stateProcess.js</stateProcess>
     </entityField>
     <entityFieldGroup>
       <name>OfferCode_VersNr_fieldgroup</name>
@@ -209,10 +216,12 @@
     <entityField>
       <name>CONTACT_ORG_ID</name>
       <title>Company</title>
+      <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/contact_org_id/stateProcess.js</stateProcess>
     </entityField>
     <entityField>
       <name>CONTACT_PERSON_ID</name>
       <title>Person</title>
+      <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/contact_person_id/stateProcess.js</stateProcess>
     </entityField>
     <entityConsumer>
       <name>AnyContacts</name>
@@ -274,6 +283,7 @@
       <description></description>
       <contentType>LONG_TEXT</contentType>
       <mandatory v="true" />
+      <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/address/stateProcess.js</stateProcess>
       <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/address/valueProcess.js</valueProcess>
     </entityField>
     <entityField>
@@ -503,6 +513,7 @@
       <name>PAYMENTTERMS</name>
       <title>Payment term</title>
       <consumer>KeywordPaymentTerm</consumer>
+      <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/paymentterms/stateProcess.js</stateProcess>
       <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/paymentterms/valueProcess.js</valueProcess>
       <displayValueProcess>%aditoprj%/entity/Offer_entity/entityfields/paymentterms/displayValueProcess.js</displayValueProcess>
     </entityField>
@@ -510,6 +521,7 @@
       <name>DELIVERYTERMS</name>
       <title>Delivery specification</title>
       <consumer>KeywordDeliveryTerm</consumer>
+      <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/deliveryterms/stateProcess.js</stateProcess>
       <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/deliveryterms/valueProcess.js</valueProcess>
       <displayValueProcess>%aditoprj%/entity/Offer_entity/entityfields/deliveryterms/displayValueProcess.js</displayValueProcess>
     </entityField>
@@ -568,6 +580,7 @@
       <name>INFO</name>
       <title>Information</title>
       <contentType>LONG_TEXT</contentType>
+      <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/info/stateProcess.js</stateProcess>
     </entityField>
     <entityConsumer>
       <name>Attributes</name>
@@ -643,6 +656,7 @@
       <name>ChoosenTEXHeader</name>
       <title>Choose Header</title>
       <consumer>DocumentTemplateTexHeader</consumer>
+      <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/choosentexheader/stateProcess.js</stateProcess>
     </entityField>
     <entityField>
       <name>OBJECT_ROWID</name>
@@ -787,6 +801,7 @@
     <entityField>
       <name>chooseTEXHeader</name>
       <consumer>DocumentTemplateTex</consumer>
+      <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/choosetexheader/stateProcess.js</stateProcess>
     </entityField>
     <entityConsumer>
       <name>DocumentTemplateTexHeader</name>
@@ -824,6 +839,7 @@
       <name>FOOTER</name>
       <title>Footer text</title>
       <contentType>LONG_TEXT</contentType>
+      <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/footer/stateProcess.js</stateProcess>
       <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/footer/valueProcess.js</valueProcess>
     </entityField>
     <entityParameter>
@@ -835,6 +851,7 @@
       <name>ChoosenTEXFooter</name>
       <title>Choose Footer</title>
       <consumer>DocumentTemplateTexFooter</consumer>
+      <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/choosentexfooter/stateProcess.js</stateProcess>
     </entityField>
     <entityConsumer>
       <name>DocumentTemplateTexFooter</name>
@@ -891,6 +908,7 @@
     <entityField>
       <name>LETTERSALUTATION</name>
       <title>Letter salutation</title>
+      <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/lettersalutation/stateProcess.js</stateProcess>
       <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/lettersalutation/valueProcess.js</valueProcess>
     </entityField>
     <entityActionField>
diff --git a/entity/Offer_entity/entityfields/address/stateProcess.js b/entity/Offer_entity/entityfields/address/stateProcess.js
new file mode 100644
index 0000000000..3625a84172
--- /dev/null
+++ b/entity/Offer_entity/entityfields/address/stateProcess.js
@@ -0,0 +1,6 @@
+import("system.vars");
+import("system.result");
+import("system.neon");
+import("Offer_lib");
+
+result.string(OfferUtils.isEditable(vars.get("$field.STATUS")) ? neon.COMPONENTSTATE_AUTO : neon.COMPONENTSTATE_DISABLED);
\ No newline at end of file
diff --git a/entity/Offer_entity/entityfields/choosentexfooter/stateProcess.js b/entity/Offer_entity/entityfields/choosentexfooter/stateProcess.js
new file mode 100644
index 0000000000..3625a84172
--- /dev/null
+++ b/entity/Offer_entity/entityfields/choosentexfooter/stateProcess.js
@@ -0,0 +1,6 @@
+import("system.vars");
+import("system.result");
+import("system.neon");
+import("Offer_lib");
+
+result.string(OfferUtils.isEditable(vars.get("$field.STATUS")) ? neon.COMPONENTSTATE_AUTO : neon.COMPONENTSTATE_DISABLED);
\ No newline at end of file
diff --git a/entity/Offer_entity/entityfields/choosentexheader/stateProcess.js b/entity/Offer_entity/entityfields/choosentexheader/stateProcess.js
new file mode 100644
index 0000000000..3625a84172
--- /dev/null
+++ b/entity/Offer_entity/entityfields/choosentexheader/stateProcess.js
@@ -0,0 +1,6 @@
+import("system.vars");
+import("system.result");
+import("system.neon");
+import("Offer_lib");
+
+result.string(OfferUtils.isEditable(vars.get("$field.STATUS")) ? neon.COMPONENTSTATE_AUTO : neon.COMPONENTSTATE_DISABLED);
\ No newline at end of file
diff --git a/entity/Offer_entity/entityfields/choosetexheader/stateProcess.js b/entity/Offer_entity/entityfields/choosetexheader/stateProcess.js
new file mode 100644
index 0000000000..3625a84172
--- /dev/null
+++ b/entity/Offer_entity/entityfields/choosetexheader/stateProcess.js
@@ -0,0 +1,6 @@
+import("system.vars");
+import("system.result");
+import("system.neon");
+import("Offer_lib");
+
+result.string(OfferUtils.isEditable(vars.get("$field.STATUS")) ? neon.COMPONENTSTATE_AUTO : neon.COMPONENTSTATE_DISABLED);
\ No newline at end of file
diff --git a/entity/Offer_entity/entityfields/chosenaddress/stateProcess.js b/entity/Offer_entity/entityfields/chosenaddress/stateProcess.js
index 8553fd8936..a495512699 100644
--- a/entity/Offer_entity/entityfields/chosenaddress/stateProcess.js
+++ b/entity/Offer_entity/entityfields/chosenaddress/stateProcess.js
@@ -1,8 +1,9 @@
-import("system.vars");
+import("Offer_lib");
 import("system.result");
 import("system.neon");
+import("system.vars");
 
 if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_VIEW)
     result.string(neon.COMPONENTSTATE_INVISIBLE);
 else
-    result.string(neon.COMPONENTSTATE_EDITABLE);
\ No newline at end of file
+    result.string(OfferUtils.isEditable(vars.get("$field.STATUS")) ? neon.COMPONENTSTATE_EDITABLE : neon.COMPONENTSTATE_DISABLED);
\ No newline at end of file
diff --git a/entity/Offer_entity/entityfields/contact_id/stateProcess.js b/entity/Offer_entity/entityfields/contact_id/stateProcess.js
index f246db1172..e64c4d20ac 100644
--- a/entity/Offer_entity/entityfields/contact_id/stateProcess.js
+++ b/entity/Offer_entity/entityfields/contact_id/stateProcess.js
@@ -1,7 +1,10 @@
+import("Offer_lib");
 import("system.result");
-import("system.vars");
 import("system.neon");
+import("system.vars");
 
 if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT || 
         (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.ContactId_param") && vars.get("$param.ContactId_param")))
-    result.string(neon.COMPONENTSTATE_READONLY);
\ No newline at end of file
+    result.string(neon.COMPONENTSTATE_READONLY);
+else
+    result.string(OfferUtils.isEditable(vars.get("$field.STATUS")) ? neon.COMPONENTSTATE_AUTO : neon.COMPONENTSTATE_DISABLED);
\ No newline at end of file
diff --git a/entity/Offer_entity/entityfields/contact_org_id/stateProcess.js b/entity/Offer_entity/entityfields/contact_org_id/stateProcess.js
new file mode 100644
index 0000000000..3625a84172
--- /dev/null
+++ b/entity/Offer_entity/entityfields/contact_org_id/stateProcess.js
@@ -0,0 +1,6 @@
+import("system.vars");
+import("system.result");
+import("system.neon");
+import("Offer_lib");
+
+result.string(OfferUtils.isEditable(vars.get("$field.STATUS")) ? neon.COMPONENTSTATE_AUTO : neon.COMPONENTSTATE_DISABLED);
\ No newline at end of file
diff --git a/entity/Offer_entity/entityfields/contact_person_id/stateProcess.js b/entity/Offer_entity/entityfields/contact_person_id/stateProcess.js
new file mode 100644
index 0000000000..3625a84172
--- /dev/null
+++ b/entity/Offer_entity/entityfields/contact_person_id/stateProcess.js
@@ -0,0 +1,6 @@
+import("system.vars");
+import("system.result");
+import("system.neon");
+import("Offer_lib");
+
+result.string(OfferUtils.isEditable(vars.get("$field.STATUS")) ? neon.COMPONENTSTATE_AUTO : neon.COMPONENTSTATE_DISABLED);
\ No newline at end of file
diff --git a/entity/Offer_entity/entityfields/currency/stateProcess.js b/entity/Offer_entity/entityfields/currency/stateProcess.js
new file mode 100644
index 0000000000..3625a84172
--- /dev/null
+++ b/entity/Offer_entity/entityfields/currency/stateProcess.js
@@ -0,0 +1,6 @@
+import("system.vars");
+import("system.result");
+import("system.neon");
+import("Offer_lib");
+
+result.string(OfferUtils.isEditable(vars.get("$field.STATUS")) ? neon.COMPONENTSTATE_AUTO : neon.COMPONENTSTATE_DISABLED);
\ No newline at end of file
diff --git a/entity/Offer_entity/entityfields/deliveryterms/stateProcess.js b/entity/Offer_entity/entityfields/deliveryterms/stateProcess.js
new file mode 100644
index 0000000000..3625a84172
--- /dev/null
+++ b/entity/Offer_entity/entityfields/deliveryterms/stateProcess.js
@@ -0,0 +1,6 @@
+import("system.vars");
+import("system.result");
+import("system.neon");
+import("Offer_lib");
+
+result.string(OfferUtils.isEditable(vars.get("$field.STATUS")) ? neon.COMPONENTSTATE_AUTO : neon.COMPONENTSTATE_DISABLED);
\ No newline at end of file
diff --git a/entity/Offer_entity/entityfields/footer/stateProcess.js b/entity/Offer_entity/entityfields/footer/stateProcess.js
new file mode 100644
index 0000000000..3625a84172
--- /dev/null
+++ b/entity/Offer_entity/entityfields/footer/stateProcess.js
@@ -0,0 +1,6 @@
+import("system.vars");
+import("system.result");
+import("system.neon");
+import("Offer_lib");
+
+result.string(OfferUtils.isEditable(vars.get("$field.STATUS")) ? neon.COMPONENTSTATE_AUTO : neon.COMPONENTSTATE_DISABLED);
\ No newline at end of file
diff --git a/entity/Offer_entity/entityfields/header/stateProcess.js b/entity/Offer_entity/entityfields/header/stateProcess.js
new file mode 100644
index 0000000000..3625a84172
--- /dev/null
+++ b/entity/Offer_entity/entityfields/header/stateProcess.js
@@ -0,0 +1,6 @@
+import("system.vars");
+import("system.result");
+import("system.neon");
+import("Offer_lib");
+
+result.string(OfferUtils.isEditable(vars.get("$field.STATUS")) ? neon.COMPONENTSTATE_AUTO : neon.COMPONENTSTATE_DISABLED);
\ No newline at end of file
diff --git a/entity/Offer_entity/entityfields/info/stateProcess.js b/entity/Offer_entity/entityfields/info/stateProcess.js
new file mode 100644
index 0000000000..3625a84172
--- /dev/null
+++ b/entity/Offer_entity/entityfields/info/stateProcess.js
@@ -0,0 +1,6 @@
+import("system.vars");
+import("system.result");
+import("system.neon");
+import("Offer_lib");
+
+result.string(OfferUtils.isEditable(vars.get("$field.STATUS")) ? neon.COMPONENTSTATE_AUTO : neon.COMPONENTSTATE_DISABLED);
\ No newline at end of file
diff --git a/entity/Offer_entity/entityfields/isolanguage/stateProcess.js b/entity/Offer_entity/entityfields/isolanguage/stateProcess.js
index 05ceada3a3..060fbc1396 100644
--- a/entity/Offer_entity/entityfields/isolanguage/stateProcess.js
+++ b/entity/Offer_entity/entityfields/isolanguage/stateProcess.js
@@ -1,10 +1,11 @@
+import("Offer_lib");
 import("system.result");
 import("system.neon");
 import("system.vars");
 
 if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW)
 {
-    result.string(neon.COMPONENTSTATE_EDITABLE);
+    result.string(OfferUtils.isEditable(vars.get("$field.STATUS")) ? neon.COMPONENTSTATE_EDITABLE : neon.COMPONENTSTATE_DISABLED);
 }
 else
 {
diff --git a/entity/Offer_entity/entityfields/lettersalutation/stateProcess.js b/entity/Offer_entity/entityfields/lettersalutation/stateProcess.js
new file mode 100644
index 0000000000..3625a84172
--- /dev/null
+++ b/entity/Offer_entity/entityfields/lettersalutation/stateProcess.js
@@ -0,0 +1,6 @@
+import("system.vars");
+import("system.result");
+import("system.neon");
+import("Offer_lib");
+
+result.string(OfferUtils.isEditable(vars.get("$field.STATUS")) ? neon.COMPONENTSTATE_AUTO : neon.COMPONENTSTATE_DISABLED);
\ No newline at end of file
diff --git a/entity/Offer_entity/entityfields/object_rowid/stateProcess.js b/entity/Offer_entity/entityfields/object_rowid/stateProcess.js
index a69c939f7d..f1db45bc94 100644
--- a/entity/Offer_entity/entityfields/object_rowid/stateProcess.js
+++ b/entity/Offer_entity/entityfields/object_rowid/stateProcess.js
@@ -1,3 +1,4 @@
+import("Offer_lib");
 import("system.neon");
 import("system.result");
 import("system.vars");
@@ -15,4 +16,6 @@ switch (vars.get("$sys.recordstate"))
     default:
         result.object(neon.COMPONENTSTATE_READONLY);
 }
-*/
\ No newline at end of file
+*/
+
+result.string(OfferUtils.isEditable(vars.get("$field.STATUS")) ? neon.COMPONENTSTATE_AUTO : neon.COMPONENTSTATE_DISABLED);
\ No newline at end of file
diff --git a/entity/Offer_entity/entityfields/offer_id/stateProcess.js b/entity/Offer_entity/entityfields/offer_id/stateProcess.js
new file mode 100644
index 0000000000..3625a84172
--- /dev/null
+++ b/entity/Offer_entity/entityfields/offer_id/stateProcess.js
@@ -0,0 +1,6 @@
+import("system.vars");
+import("system.result");
+import("system.neon");
+import("Offer_lib");
+
+result.string(OfferUtils.isEditable(vars.get("$field.STATUS")) ? neon.COMPONENTSTATE_AUTO : neon.COMPONENTSTATE_DISABLED);
\ No newline at end of file
diff --git a/entity/Offer_entity/entityfields/offerdate/stateProcess.js b/entity/Offer_entity/entityfields/offerdate/stateProcess.js
new file mode 100644
index 0000000000..3625a84172
--- /dev/null
+++ b/entity/Offer_entity/entityfields/offerdate/stateProcess.js
@@ -0,0 +1,6 @@
+import("system.vars");
+import("system.result");
+import("system.neon");
+import("Offer_lib");
+
+result.string(OfferUtils.isEditable(vars.get("$field.STATUS")) ? neon.COMPONENTSTATE_AUTO : neon.COMPONENTSTATE_DISABLED);
\ No newline at end of file
diff --git a/entity/Offer_entity/entityfields/offerid/stateProcess.js b/entity/Offer_entity/entityfields/offerid/stateProcess.js
new file mode 100644
index 0000000000..3625a84172
--- /dev/null
+++ b/entity/Offer_entity/entityfields/offerid/stateProcess.js
@@ -0,0 +1,6 @@
+import("system.vars");
+import("system.result");
+import("system.neon");
+import("Offer_lib");
+
+result.string(OfferUtils.isEditable(vars.get("$field.STATUS")) ? neon.COMPONENTSTATE_AUTO : neon.COMPONENTSTATE_DISABLED);
\ No newline at end of file
diff --git a/entity/Offer_entity/entityfields/paymentterms/stateProcess.js b/entity/Offer_entity/entityfields/paymentterms/stateProcess.js
new file mode 100644
index 0000000000..3625a84172
--- /dev/null
+++ b/entity/Offer_entity/entityfields/paymentterms/stateProcess.js
@@ -0,0 +1,6 @@
+import("system.vars");
+import("system.result");
+import("system.neon");
+import("Offer_lib");
+
+result.string(OfferUtils.isEditable(vars.get("$field.STATUS")) ? neon.COMPONENTSTATE_AUTO : neon.COMPONENTSTATE_DISABLED);
\ No newline at end of file
diff --git a/entity/Offer_entity/entityfields/probability/stateProcess.js b/entity/Offer_entity/entityfields/probability/stateProcess.js
new file mode 100644
index 0000000000..3625a84172
--- /dev/null
+++ b/entity/Offer_entity/entityfields/probability/stateProcess.js
@@ -0,0 +1,6 @@
+import("system.vars");
+import("system.result");
+import("system.neon");
+import("Offer_lib");
+
+result.string(OfferUtils.isEditable(vars.get("$field.STATUS")) ? neon.COMPONENTSTATE_AUTO : neon.COMPONENTSTATE_DISABLED);
\ No newline at end of file
diff --git a/entity/Offer_entity/entityfields/status/stateProcess.js b/entity/Offer_entity/entityfields/status/stateProcess.js
new file mode 100644
index 0000000000..2f47d5d101
--- /dev/null
+++ b/entity/Offer_entity/entityfields/status/stateProcess.js
@@ -0,0 +1,7 @@
+import("system.vars");
+import("system.result");
+import("system.neon");
+import("Offer_lib");
+import("KeywordRegistry_basic");
+
+result.string(OfferUtils.isEditable(vars.get("$field.STATUS")) || vars.get("$field.STATUS") == $KeywordRegistry.offerStatus$sent() ? neon.COMPONENTSTATE_AUTO : neon.COMPONENTSTATE_DISABLED);
\ No newline at end of file
diff --git a/entity/Offer_entity/grantUpdateProcess.js b/entity/Offer_entity/grantUpdateProcess.js
index 1a954c9426..f022059101 100644
--- a/entity/Offer_entity/grantUpdateProcess.js
+++ b/entity/Offer_entity/grantUpdateProcess.js
@@ -1,5 +1,2 @@
-import("system.vars");
-import("system.result");
-import("Offer_lib");
-
-result.string(OfferUtils.isEditable(vars.get("$field.STATUS")));
\ No newline at end of file
+// as one field (status) should be editable if status is sent and all other not, it is done by a state process in each field.
+// using the grant update would also disable the status field.
\ No newline at end of file
diff --git a/process/Offer_lib/process.js b/process/Offer_lib/process.js
index c9372d0b94..91ca23abe7 100644
--- a/process/Offer_lib/process.js
+++ b/process/Offer_lib/process.js
@@ -61,7 +61,7 @@ OfferUtils.getOfferNumberValidationFailString = function() {
 OfferUtils.isEditable = function(status) {
     // TODO: Administrator darf immer ändern, warten auf neue Berechtigungslogik?
     // Offer should be editable if offer state not equals "Sent", "Won" or "Lost"
-    return status != $KeywordRegistry.offerStatus$won() && status != $KeywordRegistry.offerStatus$lost();
+    return status != $KeywordRegistry.offerStatus$sent() && status != $KeywordRegistry.offerStatus$won() && status != $KeywordRegistry.offerStatus$lost();
 }
 
 OfferUtils.isDeletable = function(status) {
-- 
GitLab