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

Merge branch '1064215_FixDuplicateAsysBinariesHardCodedSystemalias' into '2020.2.0'

[Projekt: Entwicklung - Neon][TicketNr.: 1064215][Dublettenzusammenführung,...

See merge request xrm/basic!376
parents 8a16fb07 c12cd14f
No related branches found
No related tags found
No related merge requests found
...@@ -327,6 +327,10 @@ ...@@ -327,6 +327,10 @@
<name>AssignmentTable_param</name> <name>AssignmentTable_param</name>
<valueProcess>%aditoprj%/entity/Person_entity/entityfields/documents/children/assignmenttable_param/valueProcess.js</valueProcess> <valueProcess>%aditoprj%/entity/Person_entity/entityfields/documents/children/assignmenttable_param/valueProcess.js</valueProcess>
</entityParameter> </entityParameter>
<entityParameter>
<name>DisallowCreate_param</name>
<valueProcess>%aditoprj%/entity/Person_entity/entityfields/documents/children/disallowcreate_param/valueProcess.js</valueProcess>
</entityParameter>
</children> </children>
</entityConsumer> </entityConsumer>
<entityParameter> <entityParameter>
......
import("system.result");
result.string(false);
\ No newline at end of file
...@@ -667,11 +667,16 @@ DuplicateScannerUtils.MergePerson = function(pSourceContactId, pTargetContactId) ...@@ -667,11 +667,16 @@ DuplicateScannerUtils.MergePerson = function(pSourceContactId, pTargetContactId)
deleteStatements.push(["CONTACT", newWhere("CONTACT.CONTACTID", pSourceContactId).build()]); deleteStatements.push(["CONTACT", newWhere("CONTACT.CONTACTID", pSourceContactId).build()]);
deleteStatements = deleteStatements.concat(_DuplicateScannerUtils._buildDeleteCachedUnrelatedDuplicateQuery(pSourceContactId)); deleteStatements = deleteStatements.concat(_DuplicateScannerUtils._buildDeleteCachedUnrelatedDuplicateQuery(pSourceContactId));
for (var i = 0; i < updateStatementsCurrentAlias.length; i++) { for (var i = 0; i < updateStatementsCurrentAlias.length; i++) {
if(updateStatementsCurrentAlias[i][0] == "RemoveThisItem") if(updateStatementsCurrentAlias[i][0] == "RemoveThisItem") //see _DuplicateScannerUtils._buildUpdateContactIdStatements for further information
updateStatementsCurrentAlias.splice(i,1); updateStatementsCurrentAlias.splice(i,1);
} }
//update binary
var metaData = db.getBinaryMetadata("CONTACT", "DOCUMENT", pSourceContactId, true, SqlUtils.getBinariesAlias());
for (let i = 0; i < metaData.length; i++) {
var updateBinary = db.updateBinaryAssignment(metaData[i]["id"], "CONTACT", "DOCUMENT", pTargetContactId, SqlUtils.getBinariesAlias());
}
var affectedRowsCurrentAlias = db.updates(updateStatementsCurrentAlias); var affectedRowsCurrentAlias = db.updates(updateStatementsCurrentAlias);
var affectedRowsSystemAlias = db.updates(updateStatementsSystemAlias, SqlUtils.getSystemAlias()); var affectedRowsSystemAlias = db.updates(updateStatementsSystemAlias, SqlUtils.getSystemAlias());
var deletedRows = db.deletes(deleteStatements) var deletedRows = db.deletes(deleteStatements)
...@@ -1242,7 +1247,7 @@ _DuplicateScannerUtils._buildUpdateContactIdStatements = function(pTableInfos, p ...@@ -1242,7 +1247,7 @@ _DuplicateScannerUtils._buildUpdateContactIdStatements = function(pTableInfos, p
.from("CONTACT") .from("CONTACT")
.where("CONTACT.CONTACTID", pSourceContactId) .where("CONTACT.CONTACTID", pSourceContactId)
.cell(); .cell();
newWhere("CONTACT.CONTACTID", pTargetContactId).updateData(true, "CONTACT", ["ADDRESS_ID"], null, sourceStandard); newWhere("CONTACT.CONTACTID", pTargetContactId).updateData(true, "CONTACT", ["ADDRESS_ID"], null, [sourceStandard]);
} }
} }
...@@ -1267,53 +1272,52 @@ _DuplicateScannerUtils._buildUpdateContactIdStatements = function(pTableInfos, p ...@@ -1267,53 +1272,52 @@ _DuplicateScannerUtils._buildUpdateContactIdStatements = function(pTableInfos, p
*/ */
_DuplicateScannerUtils._getMergeUpdateTableInfosCurrentAlias = function() _DuplicateScannerUtils._getMergeUpdateTableInfosCurrentAlias = function()
{ {
return [ return[
["AB_APPOINTMENTLINK", "OBJECT_ROWID", ""], ["AB_APPOINTMENTLINK", "OBJECT_ROWID", ""],
["AB_CTILOG", "CONTACT_ID", ""], ["AB_CTILOG", "CONTACT_ID", ""],
["AB_OBJECTRELATION", "AB_OBJECTRELATIONID", ""], ["AB_OBJECTRELATION", "AB_OBJECTRELATIONID", ""],
["AB_OBJECTRELATION", "OBJECT1_ROWID", ""], ["AB_OBJECTRELATION", "OBJECT1_ROWID", ""],
["AB_OBJECTRELATION", "OBJECT2_ROWID", ""], ["AB_OBJECTRELATION", "OBJECT2_ROWID", ""],
["AB_LOGHISTORY", "TABLENAMEID", ""], ["AB_LOGHISTORY", "TABLENAMEID", ""],
["ADDRESS", "CONTACT_ID", ""], ["ADDRESS", "CONTACT_ID", ""],
["BULKMAILRECIPIENT", "CONTACT_ID", ""], ["BULKMAILRECIPIENT", "CONTACT_ID", ""],
["BULKMAIL", "TESTING_CONTACT_ID", ""], ["BULKMAIL", "TESTING_CONTACT_ID", ""],
["CAMPAIGN", "EMPLOYEE_CONTACT_ID", ""], ["CAMPAIGN", "EMPLOYEE_CONTACT_ID", ""],
["CAMPAIGNSTEP", "EMPLOYEE_CONTACT_ID", ""], ["CAMPAIGNSTEP", "EMPLOYEE_CONTACT_ID", ""],
["COMMRESTRICTION", "CONTACT_ID", ""], ["COMMRESTRICTION", "CONTACT_ID", ""],
["COMMRESTRICTION", "EMPLOYEE_INVOLVED", ""], ["COMMRESTRICTION", "EMPLOYEE_INVOLVED", ""],
["COMMUNICATION", "CONTACT_ID", ""], ["COMMUNICATION", "CONTACT_ID", ""],
["COMPETITION", "CONTACT_ID", ""], ["COMPETITION", "CONTACT_ID", ""],
["CONTRACT", "CONTACT_ID", ""], ["CONTRACT", "CONTACT_ID", ""],
["LETTERRECIPIENT", "CONTACT_ID", ""], ["LETTERRECIPIENT", "CONTACT_ID", ""],
["OBJECTMEMBER", "CONTACT_ID", ""], ["OBJECTMEMBER", "CONTACT_ID", ""],
["OFFER", "CONTACT_ID", ""], ["OFFER", "CONTACT_ID", ""],
["PRODUCT", "CONTACT_ID", ""], ["PRODUCT", "CONTACT_ID", ""],
["PRODUCTPRICE", "CONTACT_ID", ""], ["PRODUCTPRICE", "CONTACT_ID", ""],
["SALESORDER", "CONTACT_ID", ""], ["SALESORDER", "CONTACT_ID", ""],
["SALESPROJECT", "CONTACT_ID", ""], ["SALESPROJECT", "CONTACT_ID", ""],
["TASK", "REQUESTOR_CONTACT_ID", ""], ["TASK", "REQUESTOR_CONTACT_ID", ""],
["TASK", "EDITOR_CONTACT_ID", ""], ["TASK", "EDITOR_CONTACT_ID", ""],
["TASKLINK", "OBJECT_ROWID", ""], ["TASKLINK", "OBJECT_ROWID", ""],
["ACTIVITY", "RESPONSIBLE", ""], ["ACTIVITY", "RESPONSIBLE", ""],
["DSGVO", "CONTACT_ID", ""], ["DSGVO", "CONTACT_ID", ""],
["DSGVOINFO", "CONTACT_ID", ""], ["DSGVOINFO", "CONTACT_ID", ""],
["TIMETRACKING", "CONTACT_ID", ""], ["TIMETRACKING", "CONTACT_ID", ""],
["ACTIVITYLINK", "OBJECT_ROWID", ""], ["ACTIVITYLINK", "OBJECT_ROWID", ""],
["AB_ATTRIBUTERELATION", "OBJECT_ROWID", ""] ["AB_ATTRIBUTERELATION", "OBJECT_ROWID", ""]
]; ];
} }
/* /*
* Contains all Tables and their fields which may contain the contact id to be replaced for the system alias * Contains all Tables and their fields which may contain the contact id to be replaced for the system alias
* in the past ASYS_BINARY had also been updated like this, but know we are using
* the function db.updateBinaryAssignment (see also DuplicateScannerUtils.MergePerson).
* *
* @returns {String[[]]} Array in the format [TableName, ContactIdColumnName, AdditionalCondition] * @returns {String[[]]} Array in the format [TableName, ContactIdColumnName, AdditionalCondition]
*/ */
_DuplicateScannerUtils._getMergeUpdateTableInfosSystemAlias = function() _DuplicateScannerUtils._getMergeUpdateTableInfosSystemAlias = function()
{ {
return [ return [["ASYS_CALENDARLINK", "DBID", ""]];
["ASYS_CALENDARLINK", "DBID", ""],
["ASYS_BINARIES", "ROW_ID", "TABLENAME = 'CONTACT'"]
];
} }
/* /*
......
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