Skip to content
Snippets Groups Projects
Commit 4ca45dcd authored by Sebastian Pongratz's avatar Sebastian Pongratz :ping_pong:
Browse files

Merge branch 'cm_1078967_Refactoring_Dublettenerkennung' into '2021.1'

Cm 1078967 refactoring dublettenerkennung

See merge request xrm/basic!1093
parents b78542a9 f36f0a7b
No related branches found
No related tags found
No related merge requests found
Showing
with 92 additions and 380 deletions
......@@ -27,4 +27,4 @@
<column name="DATE_NEW" valueDate="2020-06-26T12:00:00"/>
</insert>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
</databaseChangeLog>
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
<include relativeToChangelogFile="true" file="update_duplicatepattern.xml"/>
</databaseChangeLog>
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
<changeSet author="s.schmidt" id="a627624f-e0a8-47d7-bce1-7e4bea790ss6">
<update tableName="DUPLICATESCANNER">
<column name="SCAN_PATTERN" value="{&quot;entity&quot;:&quot;Person_entity&quot;,&quot;filter&quot;:{&quot;type&quot;:&quot;group&quot;,&quot;operator&quot;:&quot;AND&quot;,&quot;childs&quot;:[{&quot;type&quot;:&quot;group&quot;,&quot;operator&quot;:&quot;AND&quot;,&quot;childs&quot;:[{&quot;type&quot;:&quot;row&quot;,&quot;name&quot;:&quot;FIRSTNAME&quot;,&quot;operator&quot;:&quot;ISNOTNULL&quot;,&quot;value&quot;:&quot;&quot;,&quot;key&quot;:&quot;&quot;,&quot;contenttype&quot;:&quot;TEXT&quot;},{&quot;type&quot;:&quot;row&quot;,&quot;name&quot;:&quot;LASTNAME&quot;,&quot;operator&quot;:&quot;ISNOTNULL&quot;,&quot;value&quot;:&quot;&quot;,&quot;key&quot;:&quot;&quot;,&quot;contenttype&quot;:&quot;TEXT&quot;}]},{&quot;type&quot;:&quot;group&quot;,&quot;operator&quot;:&quot;OR&quot;,&quot;childs&quot;:[{&quot;type&quot;:&quot;row&quot;,&quot;name&quot;:&quot;STANDARD_EMAIL_COMMUNICATION&quot;,&quot;operator&quot;:&quot;ISNOTNULL&quot;,&quot;value&quot;:&quot;&quot;,&quot;key&quot;:&quot;&quot;,&quot;contenttype&quot;:&quot;TEXT&quot;}]},{&quot;type&quot;:&quot;row&quot;,&quot;name&quot;:&quot;PERSON_ID&quot;,&quot;operator&quot;:&quot;CONTAINSNOT&quot;,&quot;value&quot;:&quot;{}&quot;,&quot;key&quot;:&quot;{}&quot;,&quot;contenttype&quot;:&quot;TEXT&quot;}]},&quot;provider&quot;:&quot;Dublicates&quot;}"></column>
<where>ID = ? and SCAN_PATTERN = ?</where>
<whereParams>
<param name="id" value="a8363f75-dc0a-412c-afe1-80ebacc26744"/>
<param name="pattern" value="{&quot;entity&quot;:&quot;Person_entity&quot;,&quot;provider&quot;:&quot;indexP&quot;,&quot;filter&quot;:{&quot;type&quot;:&quot;group&quot;,&quot;operator&quot;:&quot;AND&quot;,&quot;childs&quot;:[{&quot;type&quot;:&quot;row&quot;,&quot;name&quot;:&quot;FIRSTNAME&quot;,&quot;operator&quot;:&quot;ISNOTNULL&quot;,&quot;value&quot;:&quot;&quot;,&quot;key&quot;:&quot;&quot;,&quot;contenttype&quot;:&quot;TEXT&quot;},{&quot;type&quot;:&quot;row&quot;,&quot;name&quot;:&quot;LASTNAME&quot;,&quot;operator&quot;:&quot;ISNOTNULL&quot;,&quot;value&quot;:&quot;&quot;,&quot;key&quot;:&quot;&quot;,&quot;contenttype&quot;:&quot;TEXT&quot;}]}}"/>
</whereParams>
</update>
<update tableName="DUPLICATESCANNER">
<column name="SCAN_PATTERN" value="{&quot;entity&quot;:&quot;Organisation_entity&quot;,&quot;filter&quot;:{&quot;type&quot;:&quot;group&quot;,&quot;operator&quot;:&quot;AND&quot;,&quot;childs&quot;:[{&quot;type&quot;:&quot;row&quot;,&quot;name&quot;:&quot;NAME&quot;,&quot;operator&quot;:&quot;CONTAINS&quot;,&quot;value&quot;:&quot;{\&quot;exclude\&quot;: [\&quot;gmbh\&quot;, \&quot;co\&quot;, \&quot;kg\&quot;, \&quot;AG\&quot;, \&quot;bank\&quot;]}&quot;,&quot;key&quot;:&quot;{\&quot;exclude\&quot;: [\&quot;gmbh\&quot;, \&quot;co\&quot;, \&quot;kg\&quot;, \&quot;AG\&quot;, \&quot;bank\&quot;]}&quot;,&quot;contenttype&quot;:&quot;TEXT&quot;},{&quot;type&quot;:&quot;row&quot;,&quot;name&quot;:&quot;STANDARD_CITY&quot;,&quot;operator&quot;:&quot;ISNOTNULL&quot;,&quot;value&quot;:&quot;&quot;,&quot;key&quot;:&quot;&quot;,&quot;contenttype&quot;:&quot;TEXT&quot;}]},&quot;provider&quot;:&quot;Dublicates&quot;}"></column>
<where>ID = ? and SCAN_PATTERN = ?</where>
<whereParams>
<param name="id" value="8fa3ab66-cc01-45b6-88f3-a9e76bad7db0"/>
<param name="pattern" value="{&quot;entity&quot;:&quot;Organisation_entity&quot;,&quot;provider&quot;:&quot;indexP&quot;,&quot;filter&quot;:{&quot;type&quot;:&quot;group&quot;,&quot;operator&quot;:&quot;AND&quot;,&quot;childs&quot;:[{&quot;type&quot;:&quot;row&quot;,&quot;name&quot;:&quot;NAME&quot;,&quot;operator&quot;:&quot;CONTAINSNOT&quot;,&quot;value&quot;:&quot;[\&quot;gmbh\&quot;, \&quot;co\&quot;, \&quot;kg\&quot;, \&quot;ag\&quot;, \&quot;bank\&quot;, \&quot;deutsche\&quot;, \&quot;van\&quot;, \&quot;software\&quot;, \&quot;medien\&quot;, \&quot;print\&quot;]&quot;,&quot;key&quot;:&quot;[\&quot;gmbh\&quot;, \&quot;co\&quot;, \&quot;kg\&quot;, \&quot;ag\&quot;, \&quot;bank\&quot;, \&quot;deutsche\&quot;, \&quot;van\&quot;, \&quot;software\&quot;, \&quot;medien\&quot;, \&quot;print\&quot;]&quot;,&quot;contenttype&quot;:&quot;LONG_TEXT&quot;},{&quot;type&quot;:&quot;row&quot;,&quot;name&quot;:&quot;STANDARD_CITY&quot;,&quot;operator&quot;:&quot;ISNOTNULL&quot;,&quot;value&quot;:&quot;&quot;,&quot;key&quot;:&quot;&quot;,&quot;contenttype&quot;:&quot;TEXT&quot;}]}}"/>
</whereParams>
</update>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
......@@ -6,4 +6,5 @@
<include relativeToChangelogFile="true" file="Bulkmail/changelog.xml"/>
<include relativeToChangelogFile="true" file="Registration_Webservice/changelog.xml"/>
<include relativeToChangelogFile="true" file="VisitPlan/changelog.xml"/>
<include relativeToChangelogFile="true" file="Duplicate/changelog.xml"/>
</databaseChangeLog>
......@@ -10,7 +10,7 @@
<column name="ID" value="8fa3ab66-cc01-45b6-88f3-a9e76bad7db0"/>
<column name="USER_EDIT" value="Admin"/>
<column name="ID_FIELD_NAME" value="CONTACTID"/>
<column name="SCAN_PATTERN" value="{&quot;entity&quot;:&quot;Organisation_entity&quot;,&quot;provider&quot;:&quot;indexP&quot;,&quot;filter&quot;:{&quot;type&quot;:&quot;group&quot;,&quot;operator&quot;:&quot;AND&quot;,&quot;childs&quot;:[{&quot;type&quot;:&quot;row&quot;,&quot;name&quot;:&quot;NAME&quot;,&quot;operator&quot;:&quot;CONTAINSNOT&quot;,&quot;value&quot;:&quot;[\&quot;gmbh\&quot;, \&quot;co\&quot;, \&quot;kg\&quot;, \&quot;ag\&quot;, \&quot;bank\&quot;, \&quot;deutsche\&quot;, \&quot;van\&quot;, \&quot;software\&quot;, \&quot;medien\&quot;, \&quot;print\&quot;]&quot;,&quot;key&quot;:&quot;[\&quot;gmbh\&quot;, \&quot;co\&quot;, \&quot;kg\&quot;, \&quot;ag\&quot;, \&quot;bank\&quot;, \&quot;deutsche\&quot;, \&quot;van\&quot;, \&quot;software\&quot;, \&quot;medien\&quot;, \&quot;print\&quot;]&quot;,&quot;contenttype&quot;:&quot;LONG_TEXT&quot;},{&quot;type&quot;:&quot;row&quot;,&quot;name&quot;:&quot;STANDARD_CITY&quot;,&quot;operator&quot;:&quot;ISNOTNULL&quot;,&quot;value&quot;:&quot;&quot;,&quot;key&quot;:&quot;&quot;,&quot;contenttype&quot;:&quot;TEXT&quot;}]}}"/>
<column name="SCAN_PATTERN" value="{&quot;entity&quot;:&quot;Organisation_entity&quot;,&quot;filter&quot;:{&quot;type&quot;:&quot;group&quot;,&quot;operator&quot;:&quot;AND&quot;,&quot;childs&quot;:[{&quot;type&quot;:&quot;row&quot;,&quot;name&quot;:&quot;NAME&quot;,&quot;operator&quot;:&quot;CONTAINS&quot;,&quot;value&quot;:&quot;{\&quot;exclude\&quot;: [\&quot;gmbh\&quot;, \&quot;co\&quot;, \&quot;kg\&quot;, \&quot;AG\&quot;, \&quot;bank\&quot;]}&quot;,&quot;key&quot;:&quot;{\&quot;exclude\&quot;: [\&quot;gmbh\&quot;, \&quot;co\&quot;, \&quot;kg\&quot;, \&quot;AG\&quot;, \&quot;bank\&quot;]}&quot;,&quot;contenttype&quot;:&quot;TEXT&quot;},{&quot;type&quot;:&quot;row&quot;,&quot;name&quot;:&quot;STANDARD_CITY&quot;,&quot;operator&quot;:&quot;ISNOTNULL&quot;,&quot;value&quot;:&quot;&quot;,&quot;key&quot;:&quot;&quot;,&quot;contenttype&quot;:&quot;TEXT&quot;}]},&quot;provider&quot;:&quot;Dublicates&quot;}"/>
<column name="USER_NEW" value="Admin"/>
<column name="DATE_NEW" valueDate="2020-06-26T12:00:00"/>
</insert>
......@@ -22,7 +22,7 @@
<column name="ID" value="a8363f75-dc0a-412c-afe1-80ebacc26744"/>
<column name="USER_EDIT" value="Admin"/>
<column name="ID_FIELD_NAME" value="CONTACTID"/>
<column name="SCAN_PATTERN" value="{&quot;entity&quot;:&quot;Person_entity&quot;,&quot;provider&quot;:&quot;indexP&quot;,&quot;filter&quot;:{&quot;type&quot;:&quot;group&quot;,&quot;operator&quot;:&quot;AND&quot;,&quot;childs&quot;:[{&quot;type&quot;:&quot;row&quot;,&quot;name&quot;:&quot;FIRSTNAME&quot;,&quot;operator&quot;:&quot;ISNOTNULL&quot;,&quot;value&quot;:&quot;&quot;,&quot;key&quot;:&quot;&quot;,&quot;contenttype&quot;:&quot;TEXT&quot;},{&quot;type&quot;:&quot;row&quot;,&quot;name&quot;:&quot;LASTNAME&quot;,&quot;operator&quot;:&quot;ISNOTNULL&quot;,&quot;value&quot;:&quot;&quot;,&quot;key&quot;:&quot;&quot;,&quot;contenttype&quot;:&quot;TEXT&quot;}]}}"/>
<column name="SCAN_PATTERN" value="{&quot;entity&quot;:&quot;Person_entity&quot;,&quot;filter&quot;:{&quot;type&quot;:&quot;group&quot;,&quot;operator&quot;:&quot;AND&quot;,&quot;childs&quot;:[{&quot;type&quot;:&quot;group&quot;,&quot;operator&quot;:&quot;AND&quot;,&quot;childs&quot;:[{&quot;type&quot;:&quot;row&quot;,&quot;name&quot;:&quot;FIRSTNAME&quot;,&quot;operator&quot;:&quot;ISNOTNULL&quot;,&quot;value&quot;:&quot;&quot;,&quot;key&quot;:&quot;&quot;,&quot;contenttype&quot;:&quot;TEXT&quot;},{&quot;type&quot;:&quot;row&quot;,&quot;name&quot;:&quot;LASTNAME&quot;,&quot;operator&quot;:&quot;ISNOTNULL&quot;,&quot;value&quot;:&quot;&quot;,&quot;key&quot;:&quot;&quot;,&quot;contenttype&quot;:&quot;TEXT&quot;}]},{&quot;type&quot;:&quot;group&quot;,&quot;operator&quot;:&quot;OR&quot;,&quot;childs&quot;:[{&quot;type&quot;:&quot;row&quot;,&quot;name&quot;:&quot;STANDARD_EMAIL_COMMUNICATION&quot;,&quot;operator&quot;:&quot;ISNOTNULL&quot;,&quot;value&quot;:&quot;&quot;,&quot;key&quot;:&quot;&quot;,&quot;contenttype&quot;:&quot;TEXT&quot;}]},{&quot;type&quot;:&quot;row&quot;,&quot;name&quot;:&quot;PERSON_ID&quot;,&quot;operator&quot;:&quot;CONTAINSNOT&quot;,&quot;value&quot;:&quot;{}&quot;,&quot;key&quot;:&quot;{}&quot;,&quot;contenttype&quot;:&quot;TEXT&quot;}]},&quot;provider&quot;:&quot;Dublicates&quot;}"/>
<column name="USER_NEW" value="Admin"/>
<column name="DATE_NEW" valueDate="2020-06-26T12:00:00"/>
</insert>
......
......@@ -256,6 +256,20 @@
</entityParameter>
</children>
</entityConsumer>
<entityConsumer>
<name>Duplicates</name>
<dependency>
<name>dependency</name>
<entityName>Duplicate_entity</entityName>
<fieldName>Duplicates</fieldName>
</dependency>
<children>
<entityParameter>
<name>DuplicateObject_param</name>
<valueProcess>%aditoprj%/entity/Contact_entity/entityfields/duplicates/children/duplicateobject_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
</entityConsumer>
</entityFields>
<recordContainers>
<dbRecordContainer>
......
import("system.logging");
import("KeywordRegistry_basic");
import("Sql_lib");
import("Entity_lib");
import("DuplicateScanner_lib");
import("Context_lib");
import("system.vars");
import("system.result");
var contactId = vars.get("$param.OwnContactId_param");
var [firstname, middlename, lastname, dob, gender, salutation, title, titleSuffix] =
newSelect(["FIRSTNAME", "MIDDLENAME", "LASTNAME", "DATEOFBIRTH", "GENDER", "SALUTATION", "TITLE", "TITLESUFFIX"])
.from("CONTACT")
.join("PERSON", "CONTACT.PERSON_ID = PERSON.PERSONID")
.where("CONTACT.CONTACTID", contactId)
.arrayRow();
var firstEmailCommunication = "";
if(vars.get("$field.Communications.insertedRows"))
{
firstEmailCommunication = vars.get("$field.Communications.insertedRows").filter(function(object)
{
return object["MEDIUM_ID"] == $KeywordRegistry.communicationMedium$mail();
})[0];
firstEmailCommunication = firstEmailCommunication ? firstEmailCommunication["ADDR"] : "";
}
result.object(DuplicateScannerUtils.getDataForDuplicateCheck("Person_entity", {
CONTACTID: contactId,
FIRSTNAME: firstname,
MIDDLENAME: middlename,
LASTNAME: lastname,
DATEOFBIRTH: dob,
GENDER: gender,
SALUTATION: salutation,
TITLE: title,
TITLESUFFIX: titleSuffix,
POSITION: vars.get("$field.POSITION"),
STATUS: vars.get("$field.STATUS"),
DEPARTMENT: vars.get("$field.DEPARTMENT"),
STANDARD_EMAIL_COMMUNICATION: firstEmailCommunication
}));
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.21" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.21">
<name>DuplicateOrganisation_entity</name>
<title>Duplicate</title>
<majorModelMode>DISTRIBUTED</majorModelMode>
<documentation>%aditoprj%/entity/DuplicateOrganisation_entity/documentation.adoc</documentation>
<grantCreate v="false" />
<grantUpdate v="false" />
<grantDelete v="false" />
<initFilterProcess>%aditoprj%/entity/DuplicateOrganisation_entity/initFilterProcess.js</initFilterProcess>
<titlePlural>Duplicates</titlePlural>
<recordContainer>db</recordContainer>
<entityFields>
<entityProvider>
<name>#PROVIDER</name>
<targetContextField>targetContext</targetContextField>
<targetIdField>CONTACTID</targetIdField>
</entityProvider>
<entityProvider>
<name>#PROVIDER_AGGREGATES</name>
<useAggregates v="true" />
</entityProvider>
<entityField>
<name>CONTACTID</name>
<linkedContext>Organisation</linkedContext>
</entityField>
<entityField>
<name>ORGNAME</name>
<title>Name</title>
<linkedContext>Organisation</linkedContext>
</entityField>
<entityParameter>
<name>Id_param</name>
<valueProcess>%aditoprj%/entity/DuplicateOrganisation_entity/entityfields/id_param/valueProcess.js</valueProcess>
<mandatory v="true" />
</entityParameter>
<entityParameter>
<name>Obj_param</name>
<expose v="true" />
<mandatory v="true" />
<description>Contains a name value object of all variables that can be used to scan for duplicates</description>
</entityParameter>
<entityActionGroup>
<name>filterActions</name>
<children>
<entityActionField>
<name>ignoreDuplicates</name>
<title>${IGNORE_DUPLICATE}</title>
<onActionProcess>%aditoprj%/entity/DuplicateOrganisation_entity/entityfields/filteractions/children/ignoreduplicates/onActionProcess.js</onActionProcess>
<isObjectAction v="false" />
<selectionType>MULTI</selectionType>
<iconId>VAADIN:CLOSE</iconId>
<titleProcess>%aditoprj%/entity/DuplicateOrganisation_entity/entityfields/filteractions/children/ignoreduplicates/titleProcess.js</titleProcess>
</entityActionField>
<entityActionField>
<name>mergeselectedintocurrent</name>
<title>Integrate selected into current contact</title>
<onActionProcess>%aditoprj%/entity/DuplicateOrganisation_entity/entityfields/filteractions/children/mergeselectedintocurrent/onActionProcess.js</onActionProcess>
<selectionType>MULTI</selectionType>
<iconId>NEON:IMPORT</iconId>
</entityActionField>
<entityActionField>
<name>mergecurrentintoselected</name>
<title>Integrate current into selected contact</title>
<onActionProcess>%aditoprj%/entity/DuplicateOrganisation_entity/entityfields/filteractions/children/mergecurrentintoselected/onActionProcess.js</onActionProcess>
<selectionType>MULTI</selectionType>
<iconId>NEON:EXPORT</iconId>
</entityActionField>
</children>
</entityActionGroup>
<entityField>
<name>STATUS</name>
<title>Status</title>
<consumer>KeywordContactStates</consumer>
</entityField>
<entityField>
<name>CUSTOMERCODE</name>
<title>Customercode</title>
</entityField>
<entityConsumer>
<name>KeywordContactStates</name>
<dependency>
<name>dependency</name>
<entityName>KeywordEntry_entity</entityName>
<fieldName>SpecificContainerKeywords</fieldName>
</dependency>
<children>
<entityParameter>
<name>ContainerName_param</name>
<valueProcess>%aditoprj%/entity/DuplicateOrganisation_entity/entityfields/keywordcontactstates/children/containername_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
</entityConsumer>
<entityField>
<name>TYPE</name>
<title>Type</title>
<consumer>KeywordOrganisationTypes</consumer>
</entityField>
<entityField>
<name>STANDARD_EMAIL_COMMUNICATION</name>
<title>E-Mail</title>
</entityField>
<entityField>
<name>STANDARD_PHONE_COMMUNICATION</name>
<title>Phone</title>
</entityField>
<entityField>
<name>STANDARD_ADDRESS</name>
<title>Address</title>
</entityField>
<entityConsumer>
<name>KeywordOrganisationTypes</name>
<dependency>
<name>dependency</name>
<entityName>KeywordEntry_entity</entityName>
<fieldName>SpecificContainerKeywords</fieldName>
</dependency>
<children>
<entityParameter>
<name>ContainerName_param</name>
<valueProcess>%aditoprj%/entity/DuplicateOrganisation_entity/entityfields/keywordorganisationtypes/children/containername_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
</entityConsumer>
<entityField>
<name>targetContext</name>
<valueProcess>%aditoprj%/entity/DuplicateOrganisation_entity/entityfields/targetcontext/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>DUPLICATE</name>
<title>Duplicate</title>
<contentType>BOOLEAN</contentType>
</entityField>
<entityField>
<name>PICTURE</name>
<title>Picture</title>
<contentType>IMAGE</contentType>
<displayValueProcess>%aditoprj%/entity/DuplicateOrganisation_entity/entityfields/picture/displayValueProcess.js</displayValueProcess>
</entityField>
</entityFields>
<recordContainers>
<dbRecordContainer>
<name>db</name>
<isReadOnly v="true" />
<fromClauseProcess>%aditoprj%/entity/DuplicateOrganisation_entity/recordcontainers/db/fromClauseProcess.js</fromClauseProcess>
<conditionProcess>%aditoprj%/entity/DuplicateOrganisation_entity/recordcontainers/db/conditionProcess.js</conditionProcess>
<alias>Data_alias</alias>
<recordFieldMappings>
<dbRecordFieldMapping>
<name>CONTACTID.value</name>
<recordfield>CONTACT.CONTACTID</recordfield>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>ORGNAME.value</name>
<recordfield>CONTACT.CONTACTID</recordfield>
<isFilterable v="true" />
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>ORGNAME.displayValue</name>
<recordfield>ORGANISATION.NAME</recordfield>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>CUSTOMERCODE.value</name>
<recordfield>ORGANISATION.CUSTOMERCODE</recordfield>
<isFilterable v="true" />
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>STATUS.value</name>
<recordfield>CONTACT.STATUS</recordfield>
<isFilterable v="true" />
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>STATUS.displayValue</name>
<expression>%aditoprj%/entity/DuplicateOrganisation_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js</expression>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>STANDARD_EMAIL_COMMUNICATION.value</name>
<expression>%aditoprj%/entity/DuplicateOrganisation_entity/recordcontainers/db/recordfieldmappings/standard_email_communication.value/expression.js</expression>
<isFilterable v="true" />
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>STANDARD_PHONE_COMMUNICATION.value</name>
<expression>%aditoprj%/entity/DuplicateOrganisation_entity/recordcontainers/db/recordfieldmappings/standard_phone_communication.value/expression.js</expression>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>STANDARD_ADDRESS.value</name>
<recordfield>ADDRESS.ADDRESS</recordfield>
<isFilterable v="true" />
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>TYPE.value</name>
<recordfield>ORGANISATION.KIND</recordfield>
<isFilterable v="true" />
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>TYPE.displayValue</name>
<expression>%aditoprj%/entity/DuplicateOrganisation_entity/recordcontainers/db/recordfieldmappings/type.displayvalue/expression.js</expression>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>DUPLICATE.value</name>
<expression>%aditoprj%/entity/DuplicateOrganisation_entity/recordcontainers/db/recordfieldmappings/duplicate.value/expression.js</expression>
<isFilterable v="true" />
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>PICTURE.value</name>
<recordfield>ORGANISATION.PICTURE</recordfield>
</dbRecordFieldMapping>
</recordFieldMappings>
<linkInformation>
<linkInformation>
<name>49ea0faa-d04e-4d9d-b489-5a7b815e9e89</name>
<tableName>ORGANISATION</tableName>
<primaryKey>ORGANISATIONID</primaryKey>
<isUIDTable v="false" />
<readonly v="true" />
</linkInformation>
<linkInformation>
<name>523f6891-14ee-49ba-952d-7d5981e14b0c</name>
<tableName>CONTACT</tableName>
<primaryKey>CONTACTID</primaryKey>
<isUIDTable v="true" />
<readonly v="true" />
</linkInformation>
<linkInformation>
<name>6b73b998-a194-4fb6-8659-42eac09e20cc</name>
<tableName>ADDRESS</tableName>
<primaryKey>ADDRESSID</primaryKey>
<isUIDTable v="false" />
<readonly v="true" />
</linkInformation>
</linkInformation>
</dbRecordContainer>
</recordContainers>
</entity>
= DuplicateOrganisation_entity
== Overview
Shows the duplicates of a record.
The views are only referenced in the OrganisationMain_view.
This entity is used to show all duplicates of an organisation, merge duplicates to one record and to ignore duplicates.
==== Actions
* ignoreDuplicates: The selected record is marked as no duplicate.
* mergeselectedintocurrent: The selected record will be merged into the current opened one.
* mergecurrentintoselected: Same behavior as with the mergeselectedintocurrent action only the other way.
== AID
More information on duplicates can be found in the AID60 or in the documentation of the DuplicateScanner_entity
\ No newline at end of file
import("system.neon");
import("system.vars");
import("system.result");
import("DuplicateScanner_lib");
DuplicateScannerUtils.updateIgnored("Organisation_entity", vars.get("$param.Id_param"), vars.get("$sys.selection"), parseInt(vars.get("$field.DUPLICATE")));
neon.refreshAll(); // Update the rows, because UNRELATEDDUPLICATES wont trigger a refresh even with write entities
import("system.translate");
import("system.question");
import("Employee_lib");
import("system.vars");
import("system.neon");
import("DuplicateMerge_lib");
if(vars.get("$sys.selection").length == 1)
{
let sourceContactId = vars.get("$param.Id_param");
let targetContactId = vars.get("$sys.selection")[0];
//todo the actual merge ought to happen in a separate view where the contact infos can be merged manually by the user.
let mergeSuccess = DuplicateMergeUtils.mergeOrganisation(sourceContactId, targetContactId);
if(mergeSuccess)
{
let currentContactId = EmployeeUtils.getCurrentContactId();
if(currentContactId == null)
currentContactId = "";
DuplicateMergeUtils.createMergeSuccessActivity(sourceContactId, targetContactId, currentContactId, "Organisation");
neon.openContext("Organisation", "OrganisationMain_view", [targetContactId], neon.OPERATINGSTATE_VIEW, null)
}
}
else
{
question.showMessage(translate.text("Please select only one element"));
}
import("system.translate");
import("system.question");
import("Employee_lib");
import("system.vars");
import("system.neon");
import("DuplicateMerge_lib");
if(vars.get("$sys.selection").length == 1)
{
let targetContactId = vars.get("$param.Id_param");
let sourceContactId = vars.get("$sys.selection")[0];
//todo the actual merge ought to happen in a separate view where the contact infos can be merged manually by the user.
let mergeSuccess = DuplicateMergeUtils.mergeOrganisation(sourceContactId, targetContactId);
if(mergeSuccess)
{
let currentContactId = EmployeeUtils.getCurrentContactId();
if(currentContactId == null)
currentContactId = "";
DuplicateMergeUtils.createMergeSuccessActivity(sourceContactId, targetContactId, currentContactId, "Organisation");
//neon.refresh() with no fields will refresh the current image (and all sub images) but NOT the preview. neon.refreshAll() would refresh both,
//why it would lead to an error because it's trying to load the already opened preview of the duplicateContact which just got deleted
//and does not exist any more which results in an exception
neon.refresh();
}
}
else
{
question.showMessage(translate.text("Please select only one element"));
}
import("system.result");
import("system.vars");
var jsonObj = JSON.parse(vars.get("$param.Obj_param"));
result.string(jsonObj["CONTACTID"]);
import("system.result");
import("Keyword_lib");
import("KeywordRegistry_basic");
result.string($KeywordRegistry.contactStatus());
import("system.result");
import("Keyword_lib");
import("KeywordRegistry_basic");
result.string($KeywordRegistry.organisationType());
import("system.result");
import("system.vars");
if (vars.get("$field.PICTURE"))
{
result.string(vars.get("$field.PICTURE"));
}
else
{
result.string("TEXT:" + vars.getString("$field.ORGNAME.displayValue").trim());
}
import("system.result");
import("Context_lib");
result.string(ContextUtils.getContextName("Organisation"));
import("system.vars");
import("Sql_lib");
import("DuplicateScanner_lib");
import("system.result");
var duplicateIds = DuplicateScannerUtils.getDuplicateIdsByEntityObj("Organisation_entity", JSON.parse(vars.get("$param.Obj_param")));
duplicateIds.push("-"); // workaround empty arrays
result.string(newWhere("CONTACT.CONTACTID", duplicateIds, SqlBuilder.IN()).toString());
import("Sql_lib");
import("system.vars");
import("system.result");
var unrelatedCondition = newWhere("UNRELATEDDUPLICATES.DUPLICATETYPE", "Organisation_entity")
.and("UNRELATEDDUPLICATES.SOURCEDUPLICATEID", vars.get("$param.Id_param"))
.and("UNRELATEDDUPLICATES.UNRELATEDDUPLICATEID = CONTACT.CONTACTID");
result.string(
"ORGANISATION " +
"join CONTACT on (ORGANISATION.ORGANISATIONID = CONTACT.ORGANISATION_ID) " +
"left join ADDRESS on (ADDRESS.ADDRESSID = CONTACT.ADDRESS_ID) " +
"left join UNRELATEDDUPLICATES on " + unrelatedCondition.toString()
);
import("system.result");
import("Sql_lib");
var statement = SqlBuilder.caseStatement()
.when("UNRELATEDDUPLICATES.UNRELATEDDUPLICATEID is not null")
.thenString("0").elseString("1");
result.string(statement);
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