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

Merge branch 'cm_1085591_ModularCommunicationFix' into '2021.1'

Cm 1085591 modular communication fix

See merge request xrm/basic!1193
parents e1210d62 d9e61704
No related branches found
No related tags found
No related merge requests found
......@@ -12,7 +12,8 @@ DuplicateScannerUtils.deleteHasDuplicateEntries(EntityUtils.getCurrentEntitytId(
new AttributeRelationQuery(contactId, null, ContextUtils.getCurrentContextId())
.deleteAllAttributes();
newWhere("COMMUNICATION.CONTACT_ID", contactId).deleteData();
newWhere("COMMUNICATION.OBJECT_ROWID", contactId)
.and("COMMUNICATION.OBJECT_TYPE", "Contact").deleteData();
newWhere("ADDRESS.CONTACT_ID", contactId).deleteData();
newWhere("COMMUNICATIONSETTINGS.CONTACT_ID", contactId).deleteData();
newWhere("CLASSIFICATIONSTORAGE.OBJECT_ROWID", contactId).deleteData();
......
......@@ -768,7 +768,7 @@ ContactUtils.getContactIdByEmail = function(pEmail)
var email = EmailUtils.extractAddress(pEmail).toUpperCase();
var contactId = newSelect("CONTACT.CONTACTID")
.from("COMMUNICATION")
.join("CONTACT", "COMMUNICATION.CONTACT_ID = CONTACT.CONTACTID")
.join("CONTACT", newWhere("COMMUNICATION.OBEJCT_ROWID = CONTACT.CONTACTID").and("COMMUNICATION.OBJECT_TYPE", "Contact"))
.where("COMMUNICATION.ADDR", email, "upper(#) = ?")
.cell();
return contactId;
......
......@@ -124,9 +124,10 @@ IncomingEmailFilterProcessor.prototype.checkBodyForIds = function (pEmail)
//if no maillog was found at least match the mailaddress to a contact
if(!mailLogId && mailAddress)
{
contactId = newSelect("COMMUNICATION.CONTACT_ID")
contactId = newSelect("COMMUNICATION.OBJECT_ROWID")
.from("COMMUNICATION")
.where("COMMUNICATION.ADDR",mailAddress)
.and("COMMUNICATION.OBJECT_TYPE", "Contact")
.cell()
}
......
......@@ -48,7 +48,7 @@ function _findPerson(pFirstname, pLastname, pMailAddress)
var contactId = newSelect("CONTACT.CONTACTID")
.from("CONTACT")
.join("PERSON","CONTACT.PERSON_ID = PERSON.PERSONID")
.join("COMMUNICATION","COMMUNICATION.CONTACT_ID = CONTACT.CONTACTID")
.join("COMMUNICATION",newWhere("COMMUNICATION.OBJECT_ROWID = CONTACT.CONTACTID").and("COMMUNICATION.OBJECT_TYPE", "Contact"))
.whereIfSet("PERSON.FIRSTNAME",pFirstname)
.andIfSet("PERSON.LASTNAME",pLastname)
.and("COMMUNICATION.MEDIUM_ID",$KeywordRegistry.communicationMedium$mail())
......@@ -58,7 +58,7 @@ function _findPerson(pFirstname, pLastname, pMailAddress)
if (!contactId){
contactId = newSelect("CONTACT.CONTACTID")
.from("CONTACT")
.join("COMMUNICATION","COMMUNICATION.CONTACT_ID = CONTACT.CONTACTID")
.join("COMMUNICATION",newWhere("COMMUNICATION.OBJECT_ROWID = CONTACT.CONTACTID").and("COMMUNICATION.OBJECT_TYPE", "Contact"))
.where("COMMUNICATION.MEDIUM_ID",$KeywordRegistry.communicationMedium$mail())
.and("COMMUNICATION.ADDR",pMailAddress)
.and("CONTACT.PERSON_ID is not null")
......@@ -109,12 +109,13 @@ function _insertPerson(pFirstname, pLastname, pMailAddress, pSalutation)
.tableName("COMMUNICATION")
.insertFields({
"COMMUNICATIONID": util.getNewUUID(),
"CONTACT_ID" : contactId,
"OBJECT_ROWID" : contactId,
"MEDIUM_ID": $KeywordRegistry.communicationMedium$mail(),
"ADDR": pMailAddress,
"ISSTANDARD" : "1",
"USER_NEW": "register_rest",
"DATE_NEW": vars.get("$sys.date")
"DATE_NEW": vars.get("$sys.date"),
"OBJECT_TYPE" : "Contact"
});
return contactId;
......
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