Skip to content
Snippets Groups Projects
Commit 204e92e0 authored by Sebastian Pongratz's avatar Sebastian Pongratz :ping_pong:
Browse files

[Projekt: xRM-Sales][TicketNr.: 1082084][Exception bei "Show Classification"...

[Projekt: xRM-Sales][TicketNr.: 1082084][Exception bei "Show Classification" wenn keine Klassifizierung angelegt]
parent a3ca17c3
No related branches found
No related tags found
No related merge requests found
Showing
with 581 additions and 95 deletions
......@@ -20,6 +20,7 @@
<title>{$OBJECTLINK_TYPE}</title>
<consumer>Context</consumer>
<mandatory v="true" />
<stateProcess>%aditoprj%/entity/ActivityLink_entity/entityfields/object_type/stateProcess.js</stateProcess>
<displayValueProcess>%aditoprj%/entity/ActivityLink_entity/entityfields/object_type/displayValueProcess.js</displayValueProcess>
</entityField>
<entityField>
......@@ -28,6 +29,7 @@
<consumer>Objects</consumer>
<linkedContextProcess>%aditoprj%/entity/ActivityLink_entity/entityfields/object_rowid/linkedContextProcess.js</linkedContextProcess>
<mandatory v="true" />
<stateProcess>%aditoprj%/entity/ActivityLink_entity/entityfields/object_rowid/stateProcess.js</stateProcess>
<displayValueProcess>%aditoprj%/entity/ActivityLink_entity/entityfields/object_rowid/displayValueProcess.js</displayValueProcess>
</entityField>
<entityField>
......
......@@ -3,8 +3,11 @@ import("system.neon");
import("system.vars");
import("system.project");
if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$field.OBJECT_TYPE")) {
if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$field.OBJECT_TYPE"))
{
result.string("");
} else if (vars.exists("$field.OBJECT_TYPE") && vars.get("$field.OBJECT_TYPE")) {
}
else if (vars.exists("$field.OBJECT_TYPE") && vars.get("$field.OBJECT_TYPE"))
{
result.string(project.getDataModel(project.DATAMODEL_KIND_CONTEXT, vars.get("$field.OBJECT_TYPE"))[1]);
}
\ No newline at end of file
import("system.translate");
import("system.question");
import("system.neon");
import("ClassificationUpdate_lib");
import("system.vars");
var classificationData = ClassificationUtils.executeUpdating(false, vars.get("$field.CONTACTID"), "Organisation");
neon.openContext("Classification", "ClassificationTree_view", null, neon.OPERATINGSTATE_SEARCH, {"ClassificationContent_param": classificationData}, null);
\ No newline at end of file
if(classificationData["wrongConfiguration"])
{
question.showMessage(translate.text("Calculating the classification failed: the classification is probably configured the wrong way, contact an administrator."), question.ERROR, translate.text("Show Classification"));
}
else
{
neon.openContext("Classification", "ClassificationTree_view", null, neon.OPERATINGSTATE_SEARCH, {"ClassificationContent_param": classificationData}, null);
}
\ No newline at end of file
import("system.translate");
import("system.question");
import("system.neon");
import("ClassificationUpdate_lib");
import("system.vars");
var classificationData = ClassificationUtils.executeUpdating(false, vars.get("$field.SALESPROJECTID"), "Salesproject");
neon.openContext("Classification", "ClassificationTree_view", null, neon.OPERATINGSTATE_SEARCH, {"ClassificationContent_param": classificationData}, null);
\ No newline at end of file
if(classificationData["wrongConfiguration"])
{
question.showMessage(translate.text("Calculating the classification failed: the classification is probably configured the wrong way, contact an administrator."), question.ERROR, translate.text("Show Classification"));
}
else
{
neon.openContext("Classification", "ClassificationTree_view", null, neon.OPERATINGSTATE_SEARCH, {"ClassificationContent_param": classificationData}, null);
}
\ No newline at end of file
import("system.logging");
import("system.vars");
import("system.neon");
import("system.translate");
import("system.util");
import("system.mail");
import("IncomingEmailExecutor_lib");
import("system.vars");
import("system.plugin");
import("system.process");
import("system.project");
import("system.plugin");
import("system.logging");
import("system.question");
import("system.translate");
import("IncomingEmailExecutor_lib");
var isError = false;
var activityIDs = [];
var incomingMailExec, mailImportResult, mailObj;
var dbAlias = "Data_alias"; //hardcoded because of a lack of a recordcontainer
var files = vars.get("$local.value");
var status = {
activitiesCreated: 0,
unlinkedMailsCreated: 0,
otherImportedFiles: 0,
skippedFiles: 0
otherImportedFiles: 0
};
var activityIDs = [];
for (var i = 0, l = files.length; i < l; i++)
{
vars.set("$field.INFO", translate.withArguments("processing %0/%1", [i.toString(), l.toString()]) + " . . .");
vars.set("$field.INFO", translate.withArguments("processing %0/%1", [i.toString(), l.toString()]) + " ...");
switch (files[i].mimeType)
{
case "application/vnd.ms-outlook":
......@@ -29,31 +31,40 @@ for (var i = 0, l = files.length; i < l; i++)
case "message/rfc822":
case "text/html": //in some cases .eml-files are recognized as text/html, till this is fixed accept the text/html contents too
//todo: remove text/html workaround when #1056482 is fixed
var mailObj = _getMailObj(files[i]);
mailObj = _getMailObj(files[i]);
if (mailObj)
{
mailObj.filename = files[i].filename;
mailObj.filename = mailObj.filename.replace(/\.msg$/, ".eml");
var incomingMailExec = new IncomingEmailExecutor(mailObj);
incomingMailExec = new IncomingEmailExecutor(mailObj);
incomingMailExec.setAlias(dbAlias);
var mailImportResult = incomingMailExec.autoProcess()
if ((!mailImportResult.isUnlinkedMail) && mailImportResult.activityId)
mailImportResult = incomingMailExec.autoProcess()
if(!mailImportResult.isError)
{
status.activitiesCreated++;
else if (mailImportResult.isUnlinkedMail && mailImportResult.activityId)
status.unlinkedMailsCreated++;
else
status.skippedFiles++;
}
else
{
isError = true;
}
if (mailImportResult.activityId){
if (mailImportResult.activityId)
{
activityIDs.push(mailImportResult.activityId);
}
}
else
status.skippedFiles++;
{
isError = true;
}
break;
default:
status.skippedFiles++;
isError = true;
break;
}
}
......@@ -61,31 +72,70 @@ for (var i = 0, l = files.length; i < l; i++)
vars.set("$global.ACTIVITY_IDS", JSON.stringify(activityIDs)); //TODO: Änderung auf andere Variable #1057014
if (status.activitiesCreated > 0 || status.unlinkedMailsCreated > 0 || status.otherImportedFiles > 0)
neon.refreshAll();//this is needed for the dashboard: other elements are refreshed and display for example unlinkedMails
{
neon.refreshAll(); //this is needed for the dashboard: other elements are refreshed and display for example unlinkedMails
}
var messages = _getMessages(status);
if (messages.length)
{
vars.set("$field.INFO", translate.withArguments("processed %0/%1:", [i.toString(), l.toString()]) + "\n" + messages.join(", "));
}
if (isError)
{
question.showMessage(translate.text("During processing the e-mail an error has occurred.\nPlease contact an administrator."), question.ERROR,
translate.text("E-mail processing error"));
}
neon.refreshAll();
function _getMailObj(pDroppedFile)
{
var mailStr;
if (pDroppedFile.mimeType == "message/rfc822" || pDroppedFile.mimeType == "text/html")//todo: remove text/html workaround when #1056482 is fixed
mailStr = util.decodeBase64String(pDroppedFile.data);
if (pDroppedFile.mimeType == "message/rfc822" || pDroppedFile.mimeType == "text/html") //todo: remove text/html workaround when #1056482 is fixed
{
try
{
mailStr = util.decodeBase64String(pDroppedFile.data);
}
catch(pException)
{
logging.log(translate.text("An error occured during decoding the mails content."), logging.ERROR);
logging.log(pException, logging.ERROR);
}
}
else
{
try
{
mailStr = plugin.run(null, "de.adito.aditoweb.plugin.msg2rfc.Msg2RfcPlugin", [pDroppedFile.data])[0];
}
catch(ex)
catch(pException)
{
logging.log(ex);
logging.log(translate.text("An error occured during converting the msg file into an standardized mail."), logging.ERROR);
logging.log(pException, logging.ERROR);
}
}
if (mailStr)
return mail.parseRFC(mailStr);
{
let parsedMail;
try
{
parsedMail = mail.parseRFC(mailStr);
}
catch(pException)
{
logging.log(translate.text("An error occured during parsing imported mail."), logging.ERROR);
logging.log(pException, logging.ERROR);
}
return parsedMail;
}
return null;
}
......@@ -93,24 +143,42 @@ function _getMailObj(pDroppedFile)
function _getMessages(pStatus)
{
var res = [];
if (pStatus.skippedFiles == 1)
{
res.push(translate.text("one file ignored"));
}
else if (pStatus.skippedFiles > 1)
{
res.push(translate.withArguments("%0 files ignored", [pStatus.skippedFiles]));
}
if (pStatus.otherImportedFiles == 1)
{
res.push(translate.text("one file imported"));
}
else if (pStatus.otherImportedFiles > 1)
{
res.push(translate.withArguments("%0 files imported", [pStatus.otherImportedFiles]));
}
if (pStatus.activitiesCreated == 1)
{
res.push(translate.text("one actitiy from mail created"));
}
else if (pStatus.activitiesCreated > 1)
{
res.push(translate.withArguments("%0 activities from mails created", [pStatus.activitiesCreated]));
}
if (pStatus.unlinkedMailsCreated == 1)
{
res.push(translate.text("one mail could not be linked automatically"));
}
else if (pStatus.unlinkedMailsCreated > 1)
{
res.push(translate.withArguments("%0 mails could not be linked automatically", [pStatus.unlinkedMailsCreated]));
}
return res;
}
\ No newline at end of file
......@@ -8932,6 +8932,36 @@
<entry>
<key>Target amount</key>
</entry>
<entry>
<key>An error occured during converting the *.msg file into an standardized mail.</key>
</entry>
<entry>
<key>E-mail processing error</key>
</entry>
<entry>
<key>An error occured during processing the mail.</key>
</entry>
<entry>
<key>An error occured during parsing imported mail.</key>
</entry>
<entry>
<key>An error occured during decoding the mails content.</key>
</entry>
<entry>
<key>An error occured during checking whether at least one of the recipients is an internal user or not.</key>
</entry>
<entry>
<key>An error occured during checking whether the sender is an internal user or not.</key>
</entry>
<entry>
<key>DSGVO-Anonymisierung</key>
</entry>
<entry>
<key>privat</key>
</entry>
<entry>
<key>During processing the e-mail an error has occurred.\n Please contact an administrator</key>
</entry>
<entry>
<key>Approval</key>
</entry>
......
......@@ -11863,6 +11863,45 @@ Bitte Datumseingabe prüfen</value>
<entry>
<key>Shows device types used by bulkmail recipients</key>
</entry>
<entry>
<key>An error occured during parsing imported mail.</key>
<value>Ein Fehler trat auf, während dem Parsen einer importierten Mail.</value>
</entry>
<entry>
<key>An error occured during converting the *.msg file into an standardized mail.</key>
<value>Ein Fehler trat auf, während dem Konvertieren einer *.msg Datei zu einer standartisierten E-Mail.</value>
</entry>
<entry>
<key>An error occured during decoding the mails content.</key>
<value>Ein Fehler trat auf, während dem dekodieren des E-Mail Inhalts.</value>
</entry>
<entry>
<key>E-mail processing error</key>
<value>E-Mail-Verarbeitungsfehler</value>
</entry>
<entry>
<key>During processing the e-mail an error has occurred.\nPlease contact an administrator.</key>
<value>Bei der Verarbeitung der E-Mail ist ein Fehler aufgetreten.\nBitte kontaktieren Sie einen Administrator.</value>
</entry>
<entry>
<key>An error occured during checking whether the sender is an internal user or not.</key>
<value>Ein Fehler ist aufgetreten während der Überprüfung ob der Sender ein interner Nutzer ist oder nicht.</value>
</entry>
<entry>
<key>An error occured during checking whether at least one of the recipients is an internal user or not.</key>
<value>Ein Fehler ist aufgetreten während der Überprüfung ob mindestens einer der Empfänger ein interner Nutzer ist oder nicht.</value>
</entry>
<entry>
<key>GDPR-anonymization</key>
<value>DSGVO-Anonymisierung</value>
</entry>
<entry>
<key>private</key>
<value>privat</value>
</entry>
<entry>
<key>An error occured during processing the mail.</key>
</entry>
<entry>
<key>new Email</key>
</entry>
......
......@@ -9047,6 +9047,36 @@
<entry>
<key>Target amount</key>
</entry>
<entry>
<key>An error occured during converting the *.msg file into an standardized mail.</key>
</entry>
<entry>
<key>E-mail processing error</key>
</entry>
<entry>
<key>An error occured during processing the mail.</key>
</entry>
<entry>
<key>An error occured during parsing imported mail.</key>
</entry>
<entry>
<key>An error occured during decoding the mails content.</key>
</entry>
<entry>
<key>An error occured during checking whether at least one of the recipients is an internal user or not.</key>
</entry>
<entry>
<key>An error occured during checking whether the sender is an internal user or not.</key>
</entry>
<entry>
<key>DSGVO-Anonymisierung</key>
</entry>
<entry>
<key>privat</key>
</entry>
<entry>
<key>During processing the e-mail an error has occurred.\n Please contact an administrator</key>
</entry>
<entry>
<key>new Email</key>
</entry>
......
......@@ -47,10 +47,12 @@
<mailbridgeMailserver>
<name>abfa63d1-a47e-41f6-a87d-138bf04adc1e</name>
<enabled v="true" />
<bridgeName>Dev-Exchange</bridgeName>
<serverName>mailServerIMAP</serverName>
<timeout v="20000" />
<user>mailbridge</user>
<intervall v="5000" />
<bridgeMode v="1" />
<bridgeMode v="3" />
<flagMode v="2" />
<process>mailbridge</process>
<errorProcess></errorProcess>
......
......@@ -92,7 +92,11 @@ ClassificationUtils.executeUpdating = function(pRefreshAll, pSingleRefreshRowId,
stopper = true;
}
var returnAfterUpdate = ClassificationUpdateHelper._updateOutdatedDatasets(null, buildOutdatedStoredClassificationObjects, singleRefreshRowId, outputInfo);//run updating for this set of Datasets
if(returnAfterUpdate && returnAfterUpdate["outputInfo"])
if(returnAfterUpdate["wrongConfiguration"])
{
return returnAfterUpdate;
}
else if(returnAfterUpdate && returnAfterUpdate["outputInfo"])
{
outputInfo = returnAfterUpdate["outputInfo"];
}
......@@ -1638,6 +1642,10 @@ ClassificationUpdateHelper._updateOutdatedDatasets = function(pClassificationObj
{
filterFields = ["SALESPROJECTID", "CONTACT_ID", "ENDDATE", "INFO", "PHASE", "PROBABILITY", "PROJECTCODE", "PROJECTTITLE", "REASONS", "STARTDATE", "STATUS", "VOLUME"];
}
else if(pSingleRefreshRowId)
{
return {"wrongConfiguration": true};
}
else
{
throw new Error("updateClassifications_serverProcess: objectType doesn't exist or is not implemented correctly, contact an administrator.");
......
......@@ -744,6 +744,27 @@ ContactUtils.getCommFilter = function(pOperator, pRawvalue, pFilterOperatorName,
return resultSqlCond;
}
/**
* In case the given e-mail has an corresponding contact in the system, the contact id will be returned
* <u><i>otherwise</i></u> an empty array will be returned.
*
* @param {String} pEmail <p>
* The mail address which will be used to look up.
* @return {String} <p>
* In case the contact was found, the contact id will be returned.<br>
* If not an empty string will be returned.
*/
ContactUtils.getContactIdByEmail = function(pEmail)
{
var email = EmailUtils.extractAddress(pEmail).toUpperCase();
var contactId = newSelect("CONTACT.CONTACTID")
.from("COMMUNICATION")
.join("CONTACT", "COMMUNICATION.CONTACT_ID = CONTACT.CONTACTID")
.where("COMMUNICATION.ADDR", email, "upper(#) = ?")
.cell();
return contactId;
}
/**
* Checks all links to other entities, if none exist, the function returns true, otherwise false.
*
......
This diff is collapsed.
import("IncomingEmailExecutor_lib");
import("EmailFilterHandling_lib");
import("system.text");
import("system.vars");
import("system.mail");
import("system.logging");
import("IncomingEmailExecutor_lib");
var sender = text.decodeFirst(vars.getString("$local.sender"));
var recipients = text.decodeMS(vars.getString("$local.recipients"));
......
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