Skip to content
Snippets Groups Projects
Commit 7a44b81f authored by Johannes Goderbauer's avatar Johannes Goderbauer
Browse files

Merge branch '#1052913-mailbridge_HTML' into '2020.1.0'

#1052913-mailbridge_HTML Bug behoben

See merge request xrm/basic!232
parents 459d4170 c3367b0b
No related branches found
No related tags found
No related merge requests found
......@@ -35,9 +35,9 @@ for (var i = 0, l = files.length; i < l; i++)
var incomingMailExec = new IncomingEmailExecutor(mailObj);
incomingMailExec.setAlias(dbAlias);
var mailImportResult = incomingMailExec.autoProcess()
if ((!mailImportResult.unlinkedMailId) && mailImportResult.activityId)
if ((!mailImportResult.isUnlinkedMail) && mailImportResult.activityId)
status.activitiesCreated++;
else if (mailImportResult.unlinkedMailId && mailImportResult.activityId)
else if (mailImportResult.isUnlinkedMail && mailImportResult.activityId)
status.unlinkedMailsCreated++;
else
status.skippedFiles++;
......
......@@ -109,6 +109,11 @@ IncomingEmailExecutor.prototype.getMailtextAsHtml = function()
}
textInfos.push(attachmentHtml);
}
textInfos = textInfos.map(function (el)
{
return "<p>" + el + "</p><br>";
});
//since the activity has always and only a HTML-content-field we need to ensure that there will be always a HTML-content
if (this.rawMail[mail.MAIL_HTMLTEXT])
......@@ -116,11 +121,10 @@ IncomingEmailExecutor.prototype.getMailtextAsHtml = function()
else
textInfos.push("<br/>\n" + text.text2html(this.rawMail[mail.MAIL_TEXT], true));
var res = textInfos.join("<br/>\n");
var res = textInfos.join("\n");
return res;
}
IncomingEmailExecutor.prototype.getSenderInfo = function()
{
if (this._senderInfo == null)
......@@ -212,14 +216,14 @@ IncomingEmailExecutor.prototype.deleteUnlinkedMail = function (pUnlinkedMailId)
IncomingEmailExecutor.prototype.autoProcess = function(pUnlinkedMailId)
{
let tempResult = {};
tempResult.isUnlinkedMail = false;
if (this.isUnlinkable())
{
tempResult.isUnlinkedMail = true;
if (pUnlinkedMailId)
return {
unlinkedMailId: pUnlinkedMailId
};
else
tempResult.unlinkedMailId = this.insertUnlinkedMail();
}
tempResult.activityId = this.createActivity().activityId;
......
import("system.logging");
import("system.db");
import("Sql_lib");
var activities = new SqlBuilder().select(["ACTIVITY.INFO", "ACTIVITY.ACTIVITYID"]).from("ACTIVITY").where("ACTIVITY.CATEGORY", "MAIL").and("ACTIVITY.INFO", "<%", SqlBuilder.NOT_LIKE()).and("ACTIVITY.INFO","%<html>%", SqlBuilder.LIKE()).table();
activities.forEach(function (row) {
let columnsToUpdate = ["INFO"];
let newValue = row[0].split("<br/>\n").map(function (el)
{
if (el == "")
return "<br>";
else if (el.startsWith("<html>"))
return el;
else
return "<p>" + el + "</p><br>";
}).join("\n");
let projectIdCondition = SqlCondition.equals("ACTIVITY.ACTIVITYID", row[1], "1=2");
db.updateData("ACTIVITY", columnsToUpdate, null, [newValue], projectIdCondition);
});
\ No newline at end of file
<?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.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.2.1">
<name>updateActivities_serverProzess</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<process>%aditoprj%/process/updateActivities_serverProzess/process.js</process>
<restrictedRoles />
<alias>Data_alias</alias>
<variants>
<element>EXECUTABLE</element>
</variants>
</process>
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