Skip to content
Snippets Groups Projects
Commit 70c19550 authored by Benjamin Ulrich's avatar Benjamin Ulrich :speech_balloon:
Browse files

Merge branch '1046799_orgActivityPrintedTwice' into '2020.0'

[Projekt: Entwicklung - Neon][TicketNr.: 1046799][Firma - Kundenstammblatt -...

See merge request xrm/basic!123
parents 106f356f 43eb37e5
No related branches found
No related tags found
No related merge requests found
...@@ -298,6 +298,7 @@ ...@@ -298,6 +298,7 @@
</entityProvider> </entityProvider>
<entityField> <entityField>
<name>RESPONSIBLE</name> <name>RESPONSIBLE</name>
<documentation>%aditoprj%/entity/Activity_entity/entityfields/responsible/documentation.adoc</documentation>
<title>Responsible</title> <title>Responsible</title>
<consumer>Employees</consumer> <consumer>Employees</consumer>
<linkedContext>Person</linkedContext> <linkedContext>Person</linkedContext>
......
Contact_ID from Employee as responsible
\ No newline at end of file
import("system.vars"); import("system.vars");
import("Organisation_lib"); import("Organisation_lib");
OrgUtils.openOrgReport(vars.get("$field.ORGANISATIONID")); OrgUtils.openOrgReport(vars.get("$field.ORGANISATIONID"), vars.get("$field.CONTACTID"));
\ No newline at end of file \ No newline at end of file
...@@ -96,11 +96,10 @@ OrgUtils.removeImage = function(pOrgId) ...@@ -96,11 +96,10 @@ OrgUtils.removeImage = function(pOrgId)
* opens the org-report * opens the org-report
* *
* @param {String} pOrgId the id of the organization * @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 //org info
var info = newSelect("ORGANISATION.INFO") var info = newSelect("ORGANISATION.INFO")
.from("ORGANISATION") .from("ORGANISATION")
...@@ -110,7 +109,7 @@ OrgUtils.openOrgReport = function(pOrgId) ...@@ -110,7 +109,7 @@ OrgUtils.openOrgReport = function(pOrgId)
//communication data of the organization //communication data of the organization
var commData = newSelect("MEDIUM_ID, ADDR") var commData = newSelect("MEDIUM_ID, ADDR")
.from("COMMUNICATION") .from("COMMUNICATION")
.where("COMMUNICATION.CONTACT_ID", relationId) .where("COMMUNICATION.CONTACT_ID", pContactId)
.and("ISSTANDARD = 1") .and("ISSTANDARD = 1")
.table(); .table();
...@@ -141,17 +140,19 @@ OrgUtils.openOrgReport = function(pOrgId) ...@@ -141,17 +140,19 @@ OrgUtils.openOrgReport = function(pOrgId)
} }
persData = ReportData.begin(["PERSNAMECOMPLETE", "PERSFUNCTION", "PERSDEPARTMENT", "PERSCOMM", "ORGANISATION_ID", "CONTACT_ID"]).add(persData); 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") .from("ACTIVITY")
.join("ACTIVITYLINK", "ACTIVITYLINK.ACTIVITY_ID = ACTIVITYID") .join("ACTIVITYLINK", "ACTIVITYLINK.ACTIVITY_ID = ACTIVITYID")
.join("CONTACT", "ACTIVITYLINK.OBJECT_ROWID = CONTACTID") .leftJoin("CONTACT", "ACTIVITY.RESPONSIBLE = CONTACTID")
.leftJoin("PERSON", "CONTACT.PERSON_ID = PERSONID") .leftJoin("PERSON", "CONTACT.PERSON_ID = PERSONID")
.where("CONTACT.ORGANISATION_ID", pOrgId) //= all activities linked to the organization or an employee .where("ACTIVITYLINK.OBJECT_ROWID", pContactId)
.orderBy("ENTRYDATE desc") .and("ACTIVITYLINK.OBJECT_TYPE", "Organisation")
.table(); .orderBy("ENTRYDATE desc");
var activityData = activityQuery.table()
var dateFormat = translate.text("dd.MM.yyyy"); var dateFormat = translate.text("dd.MM.yyyy");
histData.forEach(function (row) activityData.forEach(function (row)
{ {
row[0] = datetime.toDate(row[0], dateFormat); row[0] = datetime.toDate(row[0], dateFormat);
// convert html to text // convert html to text
...@@ -160,7 +161,7 @@ OrgUtils.openOrgReport = function(pOrgId) ...@@ -160,7 +161,7 @@ OrgUtils.openOrgReport = function(pOrgId)
row[1] = KeywordUtils.getViewValue($KeywordRegistry.activityCategory(), row[1]); row[1] = KeywordUtils.getViewValue($KeywordRegistry.activityCategory(), row[1]);
_joinArrayVals(row, 2, 2); _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) var attr = new AttributeRelationQuery(pOrgId)
.includeDisplayValue() .includeDisplayValue()
...@@ -185,7 +186,7 @@ OrgUtils.openOrgReport = function(pOrgId) ...@@ -185,7 +186,7 @@ OrgUtils.openOrgReport = function(pOrgId)
taskData = ReportData.begin(["SUBJECT", "INFOTEXT", "STATUS", "RESPONSIBLE"]).add(taskData); taskData = ReportData.begin(["SUBJECT", "INFOTEXT", "STATUS", "RESPONSIBLE"]).add(taskData);
var params = { 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, "ORGAttr" : attr,
"INFO" : info "INFO" : info
}; };
...@@ -195,7 +196,7 @@ OrgUtils.openOrgReport = function(pOrgId) ...@@ -195,7 +196,7 @@ OrgUtils.openOrgReport = function(pOrgId)
//add subreport data //add subreport data
orgReport.addSubReportData("subdataComm", commData); orgReport.addSubReportData("subdataComm", commData);
orgReport.addSubReportData("subdataPers", persData); orgReport.addSubReportData("subdataPers", persData);
orgReport.addSubReportData("subdataHist", histData); orgReport.addSubReportData("subdataHist", activityData);
orgReport.addSubReportData("subdataTask", taskData); orgReport.addSubReportData("subdataTask", taskData);
//add logo //add logo
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment