From 7d737e8faca70de4bfeceaf9d7bd3c75c99a29ae Mon Sep 17 00:00:00 2001
From: "c.wimmer" <c.wimmer@cwimmer-nb.aditosoftware.local>
Date: Mon, 16 Nov 2020 17:32:33 +0100
Subject: [PATCH] [Projekt: Crowd-Development / Besuch vor Ort][TicketNr.:
 1068874][[Bug] Action "Neuer Wochenplaneintrag " in Firma & Kontakt kann nich
 gespeichert werden]

---
 .../entityfields/newvisitplanentry/onActionProcess.js         | 2 +-
 .../entityfields/contact_id/valueProcess.js                   | 2 +-
 .../entityfields/organisation_contact_id/valueProcess.js      | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/entity/Organisation_entity/entityfields/newvisitplanentry/onActionProcess.js b/entity/Organisation_entity/entityfields/newvisitplanentry/onActionProcess.js
index a4b75c6537..f32b45bbbf 100644
--- a/entity/Organisation_entity/entityfields/newvisitplanentry/onActionProcess.js
+++ b/entity/Organisation_entity/entityfields/newvisitplanentry/onActionProcess.js
@@ -4,6 +4,6 @@ import("system.vars");
 var params = {};
 
 params["NoVisitPlanEmployeeWeek_param"] = true;
-params["OrganisationId_param"] = vars.get("$field.CONTACTID");
+params["ContactId_param"] = vars.get("$field.CONTACTID");
 
 neon.openContext("VisitPlanEntry", "VisitPlanEntryEdit_view", null, neon.OPERATINGSTATE_NEW, params);
\ No newline at end of file
diff --git a/entity/VisitPlanEntry_entity/entityfields/contact_id/valueProcess.js b/entity/VisitPlanEntry_entity/entityfields/contact_id/valueProcess.js
index 357a962388..5219318029 100644
--- a/entity/VisitPlanEntry_entity/entityfields/contact_id/valueProcess.js
+++ b/entity/VisitPlanEntry_entity/entityfields/contact_id/valueProcess.js
@@ -10,7 +10,7 @@ if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && (vars.get("$this.
 {
     var isPersonContact = newSelect("PERSON.PERSONID").from("PERSON")
         .join("CONTACT", "PERSON.PERSONID = CONTACT.PERSON_ID")
-        .where("CONTACT.CONTACTID", vars.get("$param.ContactId_param")).cell()
+        .whereIfSet("CONTACT.CONTACTID", vars.get("$param.ContactId_param")).cell()
 
     if(isPersonContact)
         result.string(vars.get("$param.ContactId_param"));
diff --git a/entity/VisitPlanEntry_entity/entityfields/organisation_contact_id/valueProcess.js b/entity/VisitPlanEntry_entity/entityfields/organisation_contact_id/valueProcess.js
index 2b90b66856..ac8c851516 100644
--- a/entity/VisitPlanEntry_entity/entityfields/organisation_contact_id/valueProcess.js
+++ b/entity/VisitPlanEntry_entity/entityfields/organisation_contact_id/valueProcess.js
@@ -4,11 +4,11 @@ import("system.result");
 import("system.vars");
 
 if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null 
-    && vars.exists("$param.OrganisationId_param") && vars.get("$param.OrganisationId_param"))
+    && vars.exists("$param.ContactId_param") && vars.get("$param.ContactId_param"))
 {
     
     var OrgId = newSelect("CONTACT.ORGANISATION_ID").from("CONTACT")
-        .where("CONTACT.CONTACTID", vars.get("$param.OrganisationId_param"))
+        .where("CONTACT.CONTACTID", vars.get("$param.ContactId_param"))
         .cell()
     
     var contactIdWithoutPerson = newSelect("CONTACT.CONTACTID").from("CONTACT")
-- 
GitLab