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

Aktion eingefügt, dass ganze Cluster auf einmal ignoriert werden können.

Logausgaben entfernt
parent 229de6f8
No related branches found
No related tags found
No related merge requests found
Showing
with 48 additions and 10 deletions
......@@ -106,6 +106,17 @@
</entityParameter>
</children>
</entityConsumer>
<entityActionGroup>
<name>DuplicateClusterActionGroup</name>
<children>
<entityActionField>
<name>IgnoreWholeCluster</name>
<title>Ignore whole Cluster</title>
<onActionProcess>%aditoprj%/entity/Duplicates_entity/entityfields/duplicateclusteractiongroup/children/ignorewholecluster/onActionProcess.js</onActionProcess>
<iconId>VAADIN:CLOSE</iconId>
</entityActionField>
</children>
</entityActionGroup>
</entityFields>
<recordContainers>
<jDitoRecordContainer>
......
import("system.logging");
import("system.neon");
import("system.vars");
import("DuplicateScanner_lib");
import("system.notification");
let clusterId = vars.get("$sys.selection");
let duplicateContactIdsInClusterRay = DuplicateScannerUtils.GetCachedDuplicatesForClusterId(clusterId)
if(duplicateContactIdsInClusterRay.length > 1)
{
let referenceDuplicateId = duplicateContactIdsInClusterRay[0];
for (let i = 1; i < duplicateContactIdsInClusterRay.length; i++)
{
DuplicateScannerUtils.CreateUnrelatedDuplicateRelation(referenceDuplicateId, duplicateContactIdsInClusterRay[i], clusterId);
}
//notification.createConfig().notificationType(notification.t)
//neon.refreshAll();
}
......@@ -6,7 +6,7 @@ import("DuplicateScanner_lib");
let clusterRecordId = vars.get("$field.UID");
let contactIdsInCluster = DuplicateScannerUtils.GetCachedDuplicatesForClusterId(clusterRecordId);
logging.log("contactIdsInCluster -> " + contactIdsInCluster);
/*
* To achieve that if there are no duplicates, no contacts should be shown and therefore returned by the
* recordcontainer, an invalid id gets returned. It then is used in the conditionProcess to load the duplicates.
......
import("system.logging");
import("system.vars");
import("system.result");
let clusterId = vars.get("$field.UID");
logging.log("duplicatesunrelatedpersonsconsumer clusterId -> " + clusterId);
result.string(clusterId);
\ No newline at end of file
import("system.vars");
import("system.logging");
import("system.result");
logging.log("consumer selection -> " + vars.get("$sys.selection"));
result.string("Person_entity");
\ No newline at end of file
......@@ -13,7 +13,6 @@ let targetEntity = vars.get("$param.TargetEntity");
let duplicates = [];
let test = vars.get("$local.idvalues");
logging.log("test -> " + test);
let duplicateInfosQuery = "";
......@@ -33,7 +32,7 @@ else
duplicateInfosQuery = "orgquery";
let duplicateInfos = db.table(duplicateInfosQuery);
logging.log("duplicateInfos -> " + JSON.stringify(duplicateInfos));
let recordClusterId = "";
let recordDescription = "";
let recordDuplicateInClusterCount = 0;
......
......@@ -34,6 +34,6 @@ if(onlyShowContactIds != null && onlyShowContactIds.length > 0)
cond.andSqlCondition(additionalCondition, "1=2");
alternativeCondition = "1 = 2";
}
logging.log("additionalCondition -> " + db.translateCondition(cond.build(alternativeCondition)));
//TODO: use a preparedCondition when available #1030812 #1034026
result.string(db.translateCondition(cond.build(alternativeCondition)));
\ No newline at end of file
......@@ -10,6 +10,8 @@
<children>
<tableViewTemplate>
<name>PersonDuplicatesTable</name>
<favoriteActionGroup2>DuplicateClusterActionGroup</favoriteActionGroup2>
<hideContentSearch v="true" />
<entityField>#ENTITY</entityField>
<isCreatable v="false" />
<isEditable v="false" />
......
......@@ -109,13 +109,21 @@ DuplicateScannerUtils.GetCachedDuplicatesForContactId = function(pDuplicateId)
return db.array(db.COLUMN, querySelectDuplicateContactIds);
}
/*
* Returns all duplicate ids which haven't been marked as unrelated for the given cluster id.
*
* @return Array of ContactIds of duplicates not including those marked as unrelated
*/
DuplicateScannerUtils.GetCachedDuplicatesForClusterId = function(pClusterId)
{
let clusterIdRay = [];
clusterIdRay.push(pClusterId);
let duplicateIdsOfClusterWithoutUnrelated = SqlCondition.begin()
.and("DUPLICATEID not in (select UNRELATEDDUPLICATES.UNRELATEDDUPLICATEID from UNRELATEDDUPLICATES)")
.andIn("DUPLICATECLUSTERS.CLUSTERID", [pClusterId])
.and("DUPLICATECLUSTERS.CLUSTERID = '" + clusterIdRay + "'")
.buildSql("select DUPLICATEID from DUPLICATECLUSTERS");
return db.array(db.COLUMN, duplicateIdsOfClusterWithoutUnrelated);
}
......
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