From 43eb37e5bcbe4f489f8fb47cb8c45216085df217 Mon Sep 17 00:00:00 2001 From: Benjamin Ulrich <b.ulrich@adito.de> Date: Wed, 19 Feb 2020 13:16:39 +0000 Subject: [PATCH] =?UTF-8?q?[Projekt:=20Entwicklung=20-=20Neon][TicketNr.:?= =?UTF-8?q?=201046799][Firma=20-=20Kundenstammblatt=20-=20Aktivit=C3=A4ten?= =?UTF-8?q?=20werden=20doppelt=20angedruckt]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entity/Activity_entity/Activity_entity.aod | 1 + .../responsible/documentation.adoc | 1 + .../entityfields/orgreport/onActionProcess.js | 2 +- process/Organisation_lib/process.js | 27 ++++++++++--------- 4 files changed, 17 insertions(+), 14 deletions(-) create mode 100644 entity/Activity_entity/entityfields/responsible/documentation.adoc diff --git a/entity/Activity_entity/Activity_entity.aod b/entity/Activity_entity/Activity_entity.aod index a305558353d..39e32d11ea6 100644 --- a/entity/Activity_entity/Activity_entity.aod +++ b/entity/Activity_entity/Activity_entity.aod @@ -298,6 +298,7 @@ </entityProvider> <entityField> <name>RESPONSIBLE</name> + <documentation>%aditoprj%/entity/Activity_entity/entityfields/responsible/documentation.adoc</documentation> <title>Responsible</title> <consumer>Employees</consumer> <linkedContext>Person</linkedContext> diff --git a/entity/Activity_entity/entityfields/responsible/documentation.adoc b/entity/Activity_entity/entityfields/responsible/documentation.adoc new file mode 100644 index 00000000000..49366ee1d02 --- /dev/null +++ b/entity/Activity_entity/entityfields/responsible/documentation.adoc @@ -0,0 +1 @@ +Contact_ID from Employee as responsible \ No newline at end of file diff --git a/entity/Organisation_entity/entityfields/orgreport/onActionProcess.js b/entity/Organisation_entity/entityfields/orgreport/onActionProcess.js index 1e5bcbc94ce..64b6512c914 100644 --- a/entity/Organisation_entity/entityfields/orgreport/onActionProcess.js +++ b/entity/Organisation_entity/entityfields/orgreport/onActionProcess.js @@ -1,4 +1,4 @@ import("system.vars"); import("Organisation_lib"); -OrgUtils.openOrgReport(vars.get("$field.ORGANISATIONID")); \ No newline at end of file +OrgUtils.openOrgReport(vars.get("$field.ORGANISATIONID"), vars.get("$field.CONTACTID")); \ No newline at end of file diff --git a/process/Organisation_lib/process.js b/process/Organisation_lib/process.js index cc8c3aa4476..ac47bd04009 100644 --- a/process/Organisation_lib/process.js +++ b/process/Organisation_lib/process.js @@ -96,11 +96,10 @@ OrgUtils.removeImage = function(pOrgId) * opens the org-report * * @param {String} pOrgId the id of the organization + * @param {String} pContactId the OrganisationContactId */ -OrgUtils.openOrgReport = function(pOrgId) +OrgUtils.openOrgReport = function(pOrgId, pContactId) { - var relationId = pOrgId; - //org info var info = newSelect("ORGANISATION.INFO") .from("ORGANISATION") @@ -110,7 +109,7 @@ OrgUtils.openOrgReport = function(pOrgId) //communication data of the organization var commData = newSelect("MEDIUM_ID, ADDR") .from("COMMUNICATION") - .where("COMMUNICATION.CONTACT_ID", relationId) + .where("COMMUNICATION.CONTACT_ID", pContactId) .and("ISSTANDARD = 1") .table(); @@ -141,17 +140,19 @@ OrgUtils.openOrgReport = function(pOrgId) } persData = ReportData.begin(["PERSNAMECOMPLETE", "PERSFUNCTION", "PERSDEPARTMENT", "PERSCOMM", "ORGANISATION_ID", "CONTACT_ID"]).add(persData); - var histData = newSelect("ENTRYDATE, CATEGORY, FIRSTNAME, LASTNAME, INFO") + var activityQuery = newSelect("ENTRYDATE, CATEGORY, FIRSTNAME, LASTNAME, INFO") .from("ACTIVITY") .join("ACTIVITYLINK", "ACTIVITYLINK.ACTIVITY_ID = ACTIVITYID") - .join("CONTACT", "ACTIVITYLINK.OBJECT_ROWID = CONTACTID") + .leftJoin("CONTACT", "ACTIVITY.RESPONSIBLE = CONTACTID") .leftJoin("PERSON", "CONTACT.PERSON_ID = PERSONID") - .where("CONTACT.ORGANISATION_ID", pOrgId) //= all activities linked to the organization or an employee - .orderBy("ENTRYDATE desc") - .table(); + .where("ACTIVITYLINK.OBJECT_ROWID", pContactId) + .and("ACTIVITYLINK.OBJECT_TYPE", "Organisation") + .orderBy("ENTRYDATE desc"); + +var activityData = activityQuery.table() var dateFormat = translate.text("dd.MM.yyyy"); - histData.forEach(function (row) + activityData.forEach(function (row) { row[0] = datetime.toDate(row[0], dateFormat); // convert html to text @@ -160,7 +161,7 @@ OrgUtils.openOrgReport = function(pOrgId) row[1] = KeywordUtils.getViewValue($KeywordRegistry.activityCategory(), row[1]); _joinArrayVals(row, 2, 2); }); - histData = ReportData.begin(["ENTRYDATE", "MEDIUM", "LOGIN", "INFO"]).add(histData); + activityData = ReportData.begin(["ENTRYDATE", "MEDIUM", "LOGIN", "INFO"]).add(activityData); var attr = new AttributeRelationQuery(pOrgId) .includeDisplayValue() @@ -185,7 +186,7 @@ OrgUtils.openOrgReport = function(pOrgId) taskData = ReportData.begin(["SUBJECT", "INFOTEXT", "STATUS", "RESPONSIBLE"]).add(taskData); var params = { - "ORGAddr" : AddressUtils.getAddress(relationId).toString(), //TODO: use new address logic when available + "ORGAddr" : AddressUtils.getAddress(pContactId).toString(), //TODO: use new address logic when available "ORGAttr" : attr, "INFO" : info }; @@ -195,7 +196,7 @@ OrgUtils.openOrgReport = function(pOrgId) //add subreport data orgReport.addSubReportData("subdataComm", commData); orgReport.addSubReportData("subdataPers", persData); - orgReport.addSubReportData("subdataHist", histData); + orgReport.addSubReportData("subdataHist", activityData); orgReport.addSubReportData("subdataTask", taskData); //add logo -- GitLab