Skip to content
Snippets Groups Projects
Commit 7a12e83c authored by David Büchler's avatar David Büchler
Browse files

Update/Delete Anweisungen wurden falsch kombiniert

parent e1eb398f
No related branches found
No related tags found
No related merge requests found
import("system.logging");
import("system.vars");
import("system.neon");
import("DuplicateScanner_lib");
let targetContactId = vars.get("$field.CONTACTID");
let sourceContactId = vars.get("$sys.selection");
logging.log("targetContactId -> " + targetContactId);
logging.log("sourceContactId -> "+ sourceContactId);
//todo the actual merge ought to happen in a separate view where the contact infos can be merged manually by the user.
let mergeSuccess = DuplicateScannerUtils.MergePerson(sourceContactId, targetContactId);
......
......@@ -183,13 +183,13 @@ DuplicateScannerUtils.MergePerson = function(pSourceContactId, pTargetContactId)
var sourcePersonId = db.cell("select PERSON_ID from CONTACT where CONTACTID = '" + pSourceContactId + "'");
var tableInfos = _DuplicateScannerUtils._getMergeUpdateTableInfos();
updateStatements.push(_DuplicateScannerUtils._buildUpdateContactIdStatements(tableInfos, pSourceContactId, pTargetContactId));
updateStatements.push(_DuplicateScannerUtils._buildUpdateAttachParticipantsToNewContactQuery("CAMPAIGNPARTICIPANT", "CONTACT_ID", "CAMPAIGN_ID", pSourceContactId, pTargetContactId));
updateStatements.concat(_DuplicateScannerUtils._buildUpdateContactIdStatements(tableInfos, pSourceContactId, pTargetContactId));
updateStatements.concat(_DuplicateScannerUtils._buildUpdateAttachParticipantsToNewContactQuery("CAMPAIGNPARTICIPANT", "CONTACT_ID", "CAMPAIGN_ID", pSourceContactId, pTargetContactId));
deleteStatements.push(_DuplicateScannerUtils._buildDeleteRemoveObsoleteParticipantsRecordsQuery("CAMPAIGNPARTICIPANT", "CONTACT_ID", "CAMPAIGN_ID", pSourceContactId, pTargetContactId));
deleteStatements.concat(_DuplicateScannerUtils._buildDeleteRemoveObsoleteParticipantsRecordsQuery("CAMPAIGNPARTICIPANT", "CONTACT_ID", "CAMPAIGN_ID", pSourceContactId, pTargetContactId));
deleteStatements = deleteStatements.concat(_DuplicateScannerUtils._buildDeletePersonAndContactQuery(sourcePersonId, pSourceContactId));
logging.log("updateStatements -> " + JSON.stringify(updateStatements));
//logging.log("updateStatements -> " + JSON.stringify(updateStatements));
logging.log("deleteStatements -> " + JSON.stringify(deleteStatements));
//let affectedRows = db.updates(updateStatements);
//let deletedRows = db.deletes(deleteStatements)
......
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