diff --git a/entity/Person_entity/Person_entity.aod b/entity/Person_entity/Person_entity.aod index 42bc254b23471603d246964e525167ed556d79f2..6f2ffba89cf9161d967d9036618617996720f14a 100644 --- a/entity/Person_entity/Person_entity.aod +++ b/entity/Person_entity/Person_entity.aod @@ -327,6 +327,10 @@ <name>AssignmentTable_param</name> <valueProcess>%aditoprj%/entity/Person_entity/entityfields/documents/children/assignmenttable_param/valueProcess.js</valueProcess> </entityParameter> + <entityParameter> + <name>DisallowCreate_param</name> + <valueProcess>%aditoprj%/entity/Person_entity/entityfields/documents/children/disallowcreate_param/valueProcess.js</valueProcess> + </entityParameter> </children> </entityConsumer> <entityParameter> diff --git a/entity/Person_entity/entityfields/documents/children/disallowcreate_param/valueProcess.js b/entity/Person_entity/entityfields/documents/children/disallowcreate_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..e0f3ec47e2b963a577204e41d9847dd6ad0725a8 --- /dev/null +++ b/entity/Person_entity/entityfields/documents/children/disallowcreate_param/valueProcess.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.string(false); \ No newline at end of file diff --git a/process/DuplicateScanner_lib/process.js b/process/DuplicateScanner_lib/process.js index 8e2635b7c0aacaa2deb22d475eb0f386d893bf83..b8df3fa9c76eab5b57a23dfaac1ff5a4afe8c3b7 100644 --- a/process/DuplicateScanner_lib/process.js +++ b/process/DuplicateScanner_lib/process.js @@ -667,11 +667,16 @@ DuplicateScannerUtils.MergePerson = function(pSourceContactId, pTargetContactId) deleteStatements.push(["CONTACT", newWhere("CONTACT.CONTACTID", pSourceContactId).build()]); deleteStatements = deleteStatements.concat(_DuplicateScannerUtils._buildDeleteCachedUnrelatedDuplicateQuery(pSourceContactId)); - for (var i = 0; i < updateStatementsCurrentAlias.length; i++) { - if(updateStatementsCurrentAlias[i][0] == "RemoveThisItem") + for (var i = 0; i < updateStatementsCurrentAlias.length; i++) { + if(updateStatementsCurrentAlias[i][0] == "RemoveThisItem") //see _DuplicateScannerUtils._buildUpdateContactIdStatements for further information 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 affectedRowsSystemAlias = db.updates(updateStatementsSystemAlias, SqlUtils.getSystemAlias()); var deletedRows = db.deletes(deleteStatements) @@ -1242,7 +1247,7 @@ _DuplicateScannerUtils._buildUpdateContactIdStatements = function(pTableInfos, p .from("CONTACT") .where("CONTACT.CONTACTID", pSourceContactId) .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 */ _DuplicateScannerUtils._getMergeUpdateTableInfosCurrentAlias = function() { - return [ - ["AB_APPOINTMENTLINK", "OBJECT_ROWID", ""], - ["AB_CTILOG", "CONTACT_ID", ""], - ["AB_OBJECTRELATION", "AB_OBJECTRELATIONID", ""], - ["AB_OBJECTRELATION", "OBJECT1_ROWID", ""], - ["AB_OBJECTRELATION", "OBJECT2_ROWID", ""], - ["AB_LOGHISTORY", "TABLENAMEID", ""], - ["ADDRESS", "CONTACT_ID", ""], - ["BULKMAILRECIPIENT", "CONTACT_ID", ""], - ["BULKMAIL", "TESTING_CONTACT_ID", ""], - ["CAMPAIGN", "EMPLOYEE_CONTACT_ID", ""], - ["CAMPAIGNSTEP", "EMPLOYEE_CONTACT_ID", ""], - ["COMMRESTRICTION", "CONTACT_ID", ""], - ["COMMRESTRICTION", "EMPLOYEE_INVOLVED", ""], - ["COMMUNICATION", "CONTACT_ID", ""], - ["COMPETITION", "CONTACT_ID", ""], - ["CONTRACT", "CONTACT_ID", ""], - ["LETTERRECIPIENT", "CONTACT_ID", ""], - ["OBJECTMEMBER", "CONTACT_ID", ""], - ["OFFER", "CONTACT_ID", ""], - ["PRODUCT", "CONTACT_ID", ""], - ["PRODUCTPRICE", "CONTACT_ID", ""], - ["SALESORDER", "CONTACT_ID", ""], - ["SALESPROJECT", "CONTACT_ID", ""], - ["TASK", "REQUESTOR_CONTACT_ID", ""], - ["TASK", "EDITOR_CONTACT_ID", ""], - ["TASKLINK", "OBJECT_ROWID", ""], - ["ACTIVITY", "RESPONSIBLE", ""], - ["DSGVO", "CONTACT_ID", ""], - ["DSGVOINFO", "CONTACT_ID", ""], - ["TIMETRACKING", "CONTACT_ID", ""], - ["ACTIVITYLINK", "OBJECT_ROWID", ""], - ["AB_ATTRIBUTERELATION", "OBJECT_ROWID", ""] - ]; + return[ + ["AB_APPOINTMENTLINK", "OBJECT_ROWID", ""], + ["AB_CTILOG", "CONTACT_ID", ""], + ["AB_OBJECTRELATION", "AB_OBJECTRELATIONID", ""], + ["AB_OBJECTRELATION", "OBJECT1_ROWID", ""], + ["AB_OBJECTRELATION", "OBJECT2_ROWID", ""], + ["AB_LOGHISTORY", "TABLENAMEID", ""], + ["ADDRESS", "CONTACT_ID", ""], + ["BULKMAILRECIPIENT", "CONTACT_ID", ""], + ["BULKMAIL", "TESTING_CONTACT_ID", ""], + ["CAMPAIGN", "EMPLOYEE_CONTACT_ID", ""], + ["CAMPAIGNSTEP", "EMPLOYEE_CONTACT_ID", ""], + ["COMMRESTRICTION", "CONTACT_ID", ""], + ["COMMRESTRICTION", "EMPLOYEE_INVOLVED", ""], + ["COMMUNICATION", "CONTACT_ID", ""], + ["COMPETITION", "CONTACT_ID", ""], + ["CONTRACT", "CONTACT_ID", ""], + ["LETTERRECIPIENT", "CONTACT_ID", ""], + ["OBJECTMEMBER", "CONTACT_ID", ""], + ["OFFER", "CONTACT_ID", ""], + ["PRODUCT", "CONTACT_ID", ""], + ["PRODUCTPRICE", "CONTACT_ID", ""], + ["SALESORDER", "CONTACT_ID", ""], + ["SALESPROJECT", "CONTACT_ID", ""], + ["TASK", "REQUESTOR_CONTACT_ID", ""], + ["TASK", "EDITOR_CONTACT_ID", ""], + ["TASKLINK", "OBJECT_ROWID", ""], + ["ACTIVITY", "RESPONSIBLE", ""], + ["DSGVO", "CONTACT_ID", ""], + ["DSGVOINFO", "CONTACT_ID", ""], + ["TIMETRACKING", "CONTACT_ID", ""], + ["ACTIVITYLINK", "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 + * 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] */ _DuplicateScannerUtils._getMergeUpdateTableInfosSystemAlias = function() { - return [ - ["ASYS_CALENDARLINK", "DBID", ""], - ["ASYS_BINARIES", "ROW_ID", "TABLENAME = 'CONTACT'"] - ]; + return [["ASYS_CALENDARLINK", "DBID", ""]]; } /*