diff --git a/.liquibase/Data_alias/basic/2021.0.3/Duplicate/insert_duplicatescanner.xml b/.liquibase/Data_alias/basic/2021.0.3/Duplicate/insert_duplicatescanner.xml index c7e0ec1fa96fce602e301bd969d9c6d40236ca8c..492039b47ee477de9b56a4f417f4156ee6517c2e 100644 --- a/.liquibase/Data_alias/basic/2021.0.3/Duplicate/insert_duplicatescanner.xml +++ b/.liquibase/Data_alias/basic/2021.0.3/Duplicate/insert_duplicatescanner.xml @@ -27,4 +27,4 @@ <column name="DATE_NEW" valueDate="2020-06-26T12:00:00"/> </insert> </changeSet> -</databaseChangeLog> \ No newline at end of file +</databaseChangeLog> diff --git a/.liquibase/Data_alias/basic/2021.1.2/Duplicate/changelog.xml b/.liquibase/Data_alias/basic/2021.1.2/Duplicate/changelog.xml new file mode 100644 index 0000000000000000000000000000000000000000..e37834491b3ef3785b81a7093189fe92e9141fad --- /dev/null +++ b/.liquibase/Data_alias/basic/2021.1.2/Duplicate/changelog.xml @@ -0,0 +1,6 @@ +<?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> diff --git a/.liquibase/Data_alias/basic/2021.1.2/Duplicate/update_duplicatepattern.xml b/.liquibase/Data_alias/basic/2021.1.2/Duplicate/update_duplicatepattern.xml new file mode 100644 index 0000000000000000000000000000000000000000..20bb625a1e5b2957d2a3324bf6800ad528f1ed1a --- /dev/null +++ b/.liquibase/Data_alias/basic/2021.1.2/Duplicate/update_duplicatepattern.xml @@ -0,0 +1,23 @@ +<?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="{"entity":"Person_entity","filter":{"type":"group","operator":"AND","childs":[{"type":"group","operator":"AND","childs":[{"type":"row","name":"FIRSTNAME","operator":"ISNOTNULL","value":"","key":"","contenttype":"TEXT"},{"type":"row","name":"LASTNAME","operator":"ISNOTNULL","value":"","key":"","contenttype":"TEXT"}]},{"type":"group","operator":"OR","childs":[{"type":"row","name":"STANDARD_EMAIL_COMMUNICATION","operator":"ISNOTNULL","value":"","key":"","contenttype":"TEXT"}]},{"type":"row","name":"PERSON_ID","operator":"CONTAINSNOT","value":"{}","key":"{}","contenttype":"TEXT"}]},"provider":"Dublicates"}"></column> + <where>ID = ? and SCAN_PATTERN = ?</where> + <whereParams> + <param name="id" value="a8363f75-dc0a-412c-afe1-80ebacc26744"/> + <param name="pattern" value="{"entity":"Person_entity","provider":"indexP","filter":{"type":"group","operator":"AND","childs":[{"type":"row","name":"FIRSTNAME","operator":"ISNOTNULL","value":"","key":"","contenttype":"TEXT"},{"type":"row","name":"LASTNAME","operator":"ISNOTNULL","value":"","key":"","contenttype":"TEXT"}]}}"/> + </whereParams> + </update> + <update tableName="DUPLICATESCANNER"> + <column name="SCAN_PATTERN" value="{"entity":"Organisation_entity","filter":{"type":"group","operator":"AND","childs":[{"type":"row","name":"NAME","operator":"CONTAINS","value":"{\"exclude\": [\"gmbh\", \"co\", \"kg\", \"AG\", \"bank\"]}","key":"{\"exclude\": [\"gmbh\", \"co\", \"kg\", \"AG\", \"bank\"]}","contenttype":"TEXT"},{"type":"row","name":"STANDARD_CITY","operator":"ISNOTNULL","value":"","key":"","contenttype":"TEXT"}]},"provider":"Dublicates"}"></column> + <where>ID = ? and SCAN_PATTERN = ?</where> + <whereParams> + <param name="id" value="8fa3ab66-cc01-45b6-88f3-a9e76bad7db0"/> + <param name="pattern" value="{"entity":"Organisation_entity","provider":"indexP","filter":{"type":"group","operator":"AND","childs":[{"type":"row","name":"NAME","operator":"CONTAINSNOT","value":"[\"gmbh\", \"co\", \"kg\", \"ag\", \"bank\", \"deutsche\", \"van\", \"software\", \"medien\", \"print\"]","key":"[\"gmbh\", \"co\", \"kg\", \"ag\", \"bank\", \"deutsche\", \"van\", \"software\", \"medien\", \"print\"]","contenttype":"LONG_TEXT"},{"type":"row","name":"STANDARD_CITY","operator":"ISNOTNULL","value":"","key":"","contenttype":"TEXT"}]}}"/> + </whereParams> + </update> + </changeSet> +</databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2021.1.2/changelog.xml b/.liquibase/Data_alias/basic/2021.1.2/changelog.xml index 19811a3b12699629f58308c92de032b68180a2a2..2ebb42d8503e63ee0f4fda6232dfd0049a82fde9 100644 --- a/.liquibase/Data_alias/basic/2021.1.2/changelog.xml +++ b/.liquibase/Data_alias/basic/2021.1.2/changelog.xml @@ -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> diff --git a/.liquibase/Data_alias/basic/_demoData/generatedData/duplicatescanner.xml b/.liquibase/Data_alias/basic/_demoData/generatedData/duplicatescanner.xml index c8354f97bd09c8cdba6cc075f3b16cd842d81784..4562ad00d3478ed37c9de4f1589965ac8a7691b2 100644 --- a/.liquibase/Data_alias/basic/_demoData/generatedData/duplicatescanner.xml +++ b/.liquibase/Data_alias/basic/_demoData/generatedData/duplicatescanner.xml @@ -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="{"entity":"Organisation_entity","provider":"indexP","filter":{"type":"group","operator":"AND","childs":[{"type":"row","name":"NAME","operator":"CONTAINSNOT","value":"[\"gmbh\", \"co\", \"kg\", \"ag\", \"bank\", \"deutsche\", \"van\", \"software\", \"medien\", \"print\"]","key":"[\"gmbh\", \"co\", \"kg\", \"ag\", \"bank\", \"deutsche\", \"van\", \"software\", \"medien\", \"print\"]","contenttype":"LONG_TEXT"},{"type":"row","name":"STANDARD_CITY","operator":"ISNOTNULL","value":"","key":"","contenttype":"TEXT"}]}}"/> + <column name="SCAN_PATTERN" value="{"entity":"Organisation_entity","filter":{"type":"group","operator":"AND","childs":[{"type":"row","name":"NAME","operator":"CONTAINS","value":"{\"exclude\": [\"gmbh\", \"co\", \"kg\", \"AG\", \"bank\"]}","key":"{\"exclude\": [\"gmbh\", \"co\", \"kg\", \"AG\", \"bank\"]}","contenttype":"TEXT"},{"type":"row","name":"STANDARD_CITY","operator":"ISNOTNULL","value":"","key":"","contenttype":"TEXT"}]},"provider":"Dublicates"}"/> <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="{"entity":"Person_entity","provider":"indexP","filter":{"type":"group","operator":"AND","childs":[{"type":"row","name":"FIRSTNAME","operator":"ISNOTNULL","value":"","key":"","contenttype":"TEXT"},{"type":"row","name":"LASTNAME","operator":"ISNOTNULL","value":"","key":"","contenttype":"TEXT"}]}}"/> + <column name="SCAN_PATTERN" value="{"entity":"Person_entity","filter":{"type":"group","operator":"AND","childs":[{"type":"group","operator":"AND","childs":[{"type":"row","name":"FIRSTNAME","operator":"ISNOTNULL","value":"","key":"","contenttype":"TEXT"},{"type":"row","name":"LASTNAME","operator":"ISNOTNULL","value":"","key":"","contenttype":"TEXT"}]},{"type":"group","operator":"OR","childs":[{"type":"row","name":"STANDARD_EMAIL_COMMUNICATION","operator":"ISNOTNULL","value":"","key":"","contenttype":"TEXT"}]},{"type":"row","name":"PERSON_ID","operator":"CONTAINSNOT","value":"{}","key":"{}","contenttype":"TEXT"}]},"provider":"Dublicates"}"/> <column name="USER_NEW" value="Admin"/> <column name="DATE_NEW" valueDate="2020-06-26T12:00:00"/> </insert> diff --git a/entity/Contact_entity/Contact_entity.aod b/entity/Contact_entity/Contact_entity.aod index 7918197fb38dbffc8367cdd5f9bab3fd14ab0a21..81c65b0ca8196e580dd7bbe329bfe9a789f63fbf 100644 --- a/entity/Contact_entity/Contact_entity.aod +++ b/entity/Contact_entity/Contact_entity.aod @@ -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> diff --git a/entity/Contact_entity/entityfields/duplicates/children/duplicateobject_param/valueProcess.js b/entity/Contact_entity/entityfields/duplicates/children/duplicateobject_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..436a67e53b2ffc503582460cc31909693ffd541f --- /dev/null +++ b/entity/Contact_entity/entityfields/duplicates/children/duplicateobject_param/valueProcess.js @@ -0,0 +1,45 @@ +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 diff --git a/entity/DuplicateOrganisation_entity/DuplicateOrganisation_entity.aod b/entity/DuplicateOrganisation_entity/DuplicateOrganisation_entity.aod deleted file mode 100644 index bc20fd9bae6482a9cc37ed0359e09d93cad030a4..0000000000000000000000000000000000000000 --- a/entity/DuplicateOrganisation_entity/DuplicateOrganisation_entity.aod +++ /dev/null @@ -1,234 +0,0 @@ -<?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> diff --git a/entity/DuplicateOrganisation_entity/documentation.adoc b/entity/DuplicateOrganisation_entity/documentation.adoc deleted file mode 100644 index 73695092a6b0fcb6d5afaa09001147aad6bc69f8..0000000000000000000000000000000000000000 --- a/entity/DuplicateOrganisation_entity/documentation.adoc +++ /dev/null @@ -1,17 +0,0 @@ -= 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 diff --git a/entity/DuplicateOrganisation_entity/entityfields/filteractions/children/ignoreduplicates/onActionProcess.js b/entity/DuplicateOrganisation_entity/entityfields/filteractions/children/ignoreduplicates/onActionProcess.js deleted file mode 100644 index a070181a8e991188f1a7ff62ab87423364cdb5a6..0000000000000000000000000000000000000000 --- a/entity/DuplicateOrganisation_entity/entityfields/filteractions/children/ignoreduplicates/onActionProcess.js +++ /dev/null @@ -1,7 +0,0 @@ -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 diff --git a/entity/DuplicateOrganisation_entity/entityfields/filteractions/children/mergecurrentintoselected/onActionProcess.js b/entity/DuplicateOrganisation_entity/entityfields/filteractions/children/mergecurrentintoselected/onActionProcess.js deleted file mode 100644 index b23396c01c1214f15be0e2bae435e1e9da91c702..0000000000000000000000000000000000000000 --- a/entity/DuplicateOrganisation_entity/entityfields/filteractions/children/mergecurrentintoselected/onActionProcess.js +++ /dev/null @@ -1,29 +0,0 @@ -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")); -} diff --git a/entity/DuplicateOrganisation_entity/entityfields/filteractions/children/mergeselectedintocurrent/onActionProcess.js b/entity/DuplicateOrganisation_entity/entityfields/filteractions/children/mergeselectedintocurrent/onActionProcess.js deleted file mode 100644 index ac1a9260b226c00b472e5222a97c0c4f8286bfad..0000000000000000000000000000000000000000 --- a/entity/DuplicateOrganisation_entity/entityfields/filteractions/children/mergeselectedintocurrent/onActionProcess.js +++ /dev/null @@ -1,31 +0,0 @@ -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")); -} diff --git a/entity/DuplicateOrganisation_entity/entityfields/id_param/valueProcess.js b/entity/DuplicateOrganisation_entity/entityfields/id_param/valueProcess.js deleted file mode 100644 index bffe18eb097c82b9fa662880ad23d5d1ee32f7ff..0000000000000000000000000000000000000000 --- a/entity/DuplicateOrganisation_entity/entityfields/id_param/valueProcess.js +++ /dev/null @@ -1,5 +0,0 @@ -import("system.result"); -import("system.vars"); - -var jsonObj = JSON.parse(vars.get("$param.Obj_param")); -result.string(jsonObj["CONTACTID"]); diff --git a/entity/DuplicateOrganisation_entity/entityfields/keywordcontactstates/children/containername_param/valueProcess.js b/entity/DuplicateOrganisation_entity/entityfields/keywordcontactstates/children/containername_param/valueProcess.js deleted file mode 100644 index 43e8d27c6a6cdd11f092f8b404a97dc237577a38..0000000000000000000000000000000000000000 --- a/entity/DuplicateOrganisation_entity/entityfields/keywordcontactstates/children/containername_param/valueProcess.js +++ /dev/null @@ -1,5 +0,0 @@ -import("system.result"); -import("Keyword_lib"); -import("KeywordRegistry_basic"); - -result.string($KeywordRegistry.contactStatus()); diff --git a/entity/DuplicateOrganisation_entity/entityfields/keywordorganisationtypes/children/containername_param/valueProcess.js b/entity/DuplicateOrganisation_entity/entityfields/keywordorganisationtypes/children/containername_param/valueProcess.js deleted file mode 100644 index 9f418ef99a76f73e9ce0e06b98eb299c5431d63c..0000000000000000000000000000000000000000 --- a/entity/DuplicateOrganisation_entity/entityfields/keywordorganisationtypes/children/containername_param/valueProcess.js +++ /dev/null @@ -1,5 +0,0 @@ -import("system.result"); -import("Keyword_lib"); -import("KeywordRegistry_basic"); - -result.string($KeywordRegistry.organisationType()); diff --git a/entity/DuplicateOrganisation_entity/entityfields/picture/displayValueProcess.js b/entity/DuplicateOrganisation_entity/entityfields/picture/displayValueProcess.js deleted file mode 100644 index aa69acba15ba5aa0635f9e0a4a391a04c5819c2f..0000000000000000000000000000000000000000 --- a/entity/DuplicateOrganisation_entity/entityfields/picture/displayValueProcess.js +++ /dev/null @@ -1,11 +0,0 @@ -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()); -} diff --git a/entity/DuplicateOrganisation_entity/entityfields/targetcontext/valueProcess.js b/entity/DuplicateOrganisation_entity/entityfields/targetcontext/valueProcess.js deleted file mode 100644 index 84e4b61c2566393178456e74db7e36eb6abdaf80..0000000000000000000000000000000000000000 --- a/entity/DuplicateOrganisation_entity/entityfields/targetcontext/valueProcess.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.result"); -import("Context_lib"); - -result.string(ContextUtils.getContextName("Organisation")); diff --git a/entity/DuplicateOrganisation_entity/recordcontainers/db/conditionProcess.js b/entity/DuplicateOrganisation_entity/recordcontainers/db/conditionProcess.js deleted file mode 100644 index e53fabe5b3f46c2048bdb6500df6f37ca9300d61..0000000000000000000000000000000000000000 --- a/entity/DuplicateOrganisation_entity/recordcontainers/db/conditionProcess.js +++ /dev/null @@ -1,8 +0,0 @@ -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()); diff --git a/entity/DuplicateOrganisation_entity/recordcontainers/db/fromClauseProcess.js b/entity/DuplicateOrganisation_entity/recordcontainers/db/fromClauseProcess.js deleted file mode 100644 index 5412501fe024b394c16299840fb75b9997368d1f..0000000000000000000000000000000000000000 --- a/entity/DuplicateOrganisation_entity/recordcontainers/db/fromClauseProcess.js +++ /dev/null @@ -1,14 +0,0 @@ -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() -); diff --git a/entity/DuplicateOrganisation_entity/recordcontainers/db/recordfieldmappings/duplicate.value/expression.js b/entity/DuplicateOrganisation_entity/recordcontainers/db/recordfieldmappings/duplicate.value/expression.js deleted file mode 100644 index 8f7063b2ac8e637e6618ccc1ff745653daf0b339..0000000000000000000000000000000000000000 --- a/entity/DuplicateOrganisation_entity/recordcontainers/db/recordfieldmappings/duplicate.value/expression.js +++ /dev/null @@ -1,7 +0,0 @@ -import("system.result"); -import("Sql_lib"); - -var statement = SqlBuilder.caseStatement() - .when("UNRELATEDDUPLICATES.UNRELATEDDUPLICATEID is not null") - .thenString("0").elseString("1"); -result.string(statement); diff --git a/entity/DuplicateOrganisation_entity/recordcontainers/db/recordfieldmappings/standard_email_communication.value/expression.js b/entity/DuplicateOrganisation_entity/recordcontainers/db/recordfieldmappings/standard_email_communication.value/expression.js deleted file mode 100644 index 5827c59c416c332ba9281a60756f919fcb75c0a2..0000000000000000000000000000000000000000 --- a/entity/DuplicateOrganisation_entity/recordcontainers/db/recordfieldmappings/standard_email_communication.value/expression.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.result"); -import("Communication_lib"); - -result.string(CommUtil.getStandardSubSqlMail()); diff --git a/entity/DuplicateOrganisation_entity/recordcontainers/db/recordfieldmappings/standard_phone_communication.value/expression.js b/entity/DuplicateOrganisation_entity/recordcontainers/db/recordfieldmappings/standard_phone_communication.value/expression.js deleted file mode 100644 index 0f438c2535b21180c5ad03637de90f577f2c736e..0000000000000000000000000000000000000000 --- a/entity/DuplicateOrganisation_entity/recordcontainers/db/recordfieldmappings/standard_phone_communication.value/expression.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.result"); -import("Communication_lib"); - -result.string(CommUtil.getStandardSubSqlPhone()); diff --git a/entity/DuplicateOrganisation_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js b/entity/DuplicateOrganisation_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js deleted file mode 100644 index b63b2d57742bc29e8f35acd8bae539ec0a560c9c..0000000000000000000000000000000000000000 --- a/entity/DuplicateOrganisation_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js +++ /dev/null @@ -1,6 +0,0 @@ -import("system.result"); -import("Keyword_lib"); -import("KeywordRegistry_basic"); - -var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.contactStatus(), "CONTACT.STATUS"); -result.string(sql); diff --git a/entity/DuplicateOrganisation_entity/recordcontainers/db/recordfieldmappings/type.displayvalue/expression.js b/entity/DuplicateOrganisation_entity/recordcontainers/db/recordfieldmappings/type.displayvalue/expression.js deleted file mode 100644 index 7ab8eb06526a4f6be6502246408fe7891c4dc46d..0000000000000000000000000000000000000000 --- a/entity/DuplicateOrganisation_entity/recordcontainers/db/recordfieldmappings/type.displayvalue/expression.js +++ /dev/null @@ -1,6 +0,0 @@ -import("system.result"); -import("Keyword_lib"); -import("KeywordRegistry_basic"); - -var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.organisationType(), "ORGANISATION.KIND"); -result.string(sql); diff --git a/entity/DuplicatePerson_entity/DuplicatePerson_entity.aod b/entity/DuplicatePerson_entity/DuplicatePerson_entity.aod deleted file mode 100644 index 09b341ca2b19374f703ac6008f1189d21904f091..0000000000000000000000000000000000000000 --- a/entity/DuplicatePerson_entity/DuplicatePerson_entity.aod +++ /dev/null @@ -1,257 +0,0 @@ -<?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>DuplicatePerson_entity</name> - <title>Duplicate</title> - <majorModelMode>DISTRIBUTED</majorModelMode> - <documentation>%aditoprj%/entity/DuplicatePerson_entity/documentation.adoc</documentation> - <grantCreate v="false" /> - <grantUpdate v="false" /> - <grantDelete v="false" /> - <initFilterProcess>%aditoprj%/entity/DuplicatePerson_entity/initFilterProcess.js</initFilterProcess> - <titlePlural>Duplicates</titlePlural> - <recordContainer>db</recordContainer> - <entityFields> - <entityProvider> - <name>#PROVIDER</name> - <targetContextField>parentContext</targetContextField> - <targetIdField>CONTACTID</targetIdField> - </entityProvider> - <entityProvider> - <name>#PROVIDER_AGGREGATES</name> - <useAggregates v="true" /> - </entityProvider> - <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/DuplicatePerson_entity/entityfields/filteractions/children/ignoreduplicates/onActionProcess.js</onActionProcess> - <isObjectAction v="false" /> - <selectionType>MULTI</selectionType> - <iconId>VAADIN:CLOSE</iconId> - <titleProcess>%aditoprj%/entity/DuplicatePerson_entity/entityfields/filteractions/children/ignoreduplicates/titleProcess.js</titleProcess> - </entityActionField> - <entityActionField> - <name>mergeselectedintocurrent</name> - <title>Integrate selected into current contact</title> - <onActionProcess>%aditoprj%/entity/DuplicatePerson_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/DuplicatePerson_entity/entityfields/filteractions/children/mergecurrentintoselected/onActionProcess.js</onActionProcess> - <selectionType>MULTI</selectionType> - <iconId>NEON:EXPORT</iconId> - </entityActionField> - </children> - </entityActionGroup> - <entityField> - <name>CONTACTID</name> - <linkedContext>Person</linkedContext> - </entityField> - <entityParameter> - <name>Id_param</name> - <valueProcess>%aditoprj%/entity/DuplicatePerson_entity/entityfields/id_param/valueProcess.js</valueProcess> - <mandatory v="true" /> - </entityParameter> - <entityField> - <name>FIRSTNAME</name> - <title>Firstname</title> - </entityField> - <entityField> - <name>LASTNAME</name> - <title>Lastname</title> - <linkedContext>Person</linkedContext> - </entityField> - <entityField> - <name>MIDDLENAME</name> - <title>Middlename</title> - </entityField> - <entityField> - <name>LETTERSALUTATION</name> - <title>Salutation</title> - </entityField> - <entityField> - <name>TITLE</name> - <title>Title</title> - </entityField> - <entityField> - <name>PICTURE</name> - <title>Picture</title> - <contentType>IMAGE</contentType> - <displayValueProcess>%aditoprj%/entity/DuplicatePerson_entity/entityfields/picture/displayValueProcess.js</displayValueProcess> - </entityField> - <entityField> - <name>STANDARD_EMAIL_COMMUNICATION</name> - <title>E-Mail</title> - </entityField> - <entityField> - <name>STANDARD_PHONE_COMMUNICATION</name> - <title>Phone</title> - </entityField> - <entityField> - <name>ORGANISATION_ID</name> - <title>Company</title> - <consumer>Organisations</consumer> - <linkedContext>Organisation</linkedContext> - </entityField> - <entityConsumer> - <name>Organisations</name> - <dependency> - <name>dependency</name> - <entityName>Organisation_entity</entityName> - <fieldName>Organisations</fieldName> - </dependency> - </entityConsumer> - <entityField> - <name>STATUS</name> - <title>Status</title> - <consumer>KeywordContactStates</consumer> - </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/DuplicatePerson_entity/entityfields/keywordcontactstates/children/containername_param/valueProcess.js</valueProcess> - </entityParameter> - </children> - </entityConsumer> - <entityField> - <name>STANDARD_ADDRESS</name> - <title>Address</title> - </entityField> - <entityField> - <name>parentContext</name> - <valueProcess>%aditoprj%/entity/DuplicatePerson_entity/entityfields/parentcontext/valueProcess.js</valueProcess> - </entityField> - <entityField> - <name>DUPLICATE</name> - <title>Duplicate</title> - <contentType>BOOLEAN</contentType> - </entityField> - </entityFields> - <recordContainers> - <dbRecordContainer> - <name>db</name> - <isReadOnly v="true" /> - <fromClauseProcess>%aditoprj%/entity/DuplicatePerson_entity/recordcontainers/db/fromClauseProcess.js</fromClauseProcess> - <conditionProcess>%aditoprj%/entity/DuplicatePerson_entity/recordcontainers/db/conditionProcess.js</conditionProcess> - <alias>Data_alias</alias> - <recordFieldMappings> - <dbRecordFieldMapping> - <name>CONTACTID.value</name> - <recordfield>CONTACT.CONTACTID</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>MIDDLENAME.value</name> - <recordfield>PERSON.MIDDLENAME</recordfield> - <isFilterable v="true" /> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>LASTNAME.value</name> - <recordfield>CONTACT.CONTACTID</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>FIRSTNAME.value</name> - <recordfield>PERSON.FIRSTNAME</recordfield> - <isFilterable v="true" /> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>LETTERSALUTATION.value</name> - <recordfield>PERSON.SALUTATION</recordfield> - <isFilterable v="true" /> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>LASTNAME.displayValue</name> - <recordfield>PERSON.LASTNAME</recordfield> - <isFilterable v="true" /> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>TITLE.value</name> - <recordfield>PERSON.TITLE</recordfield> - <isFilterable v="true" /> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>PICTURE.value</name> - <recordfield>PERSON.PICTURE</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>STANDARD_PHONE_COMMUNICATION.value</name> - <expression>%aditoprj%/entity/DuplicatePerson_entity/recordcontainers/db/recordfieldmappings/standard_phone_communication.value/expression.js</expression> - <isFilterable v="true" /> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>STANDARD_EMAIL_COMMUNICATION.value</name> - <expression>%aditoprj%/entity/DuplicatePerson_entity/recordcontainers/db/recordfieldmappings/standard_email_communication.value/expression.js</expression> - <isFilterable v="true" /> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>ORGANISATION_ID.value</name> - <expression>%aditoprj%/entity/DuplicatePerson_entity/recordcontainers/db/recordfieldmappings/organisation_id.value/expression.js</expression> - <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/DuplicatePerson_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js</expression> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>STANDARD_ADDRESS.value</name> - <recordfield>ADDRESS.ADDRESS</recordfield> - <isFilterable v="true" /> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>ORGANISATION_ID.displayValue</name> - <expression>%aditoprj%/entity/DuplicatePerson_entity/recordcontainers/db/recordfieldmappings/organisation_id.displayvalue/expression.js</expression> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>DUPLICATE.value</name> - <expression>%aditoprj%/entity/DuplicatePerson_entity/recordcontainers/db/recordfieldmappings/duplicate.value/expression.js</expression> - <isFilterable v="true" /> - </dbRecordFieldMapping> - </recordFieldMappings> - <linkInformation> - <linkInformation> - <name>93f86a28-8c69-491e-8f62-79f5840e23a5</name> - <tableName>PERSON</tableName> - <primaryKey>PERSONID</primaryKey> - <isUIDTable v="false" /> - <readonly v="true" /> - </linkInformation> - <linkInformation> - <name>c989f19d-d211-4f54-9ea5-ddf16e5a13a0</name> - <tableName>CONTACT</tableName> - <primaryKey>CONTACTID</primaryKey> - <isUIDTable v="true" /> - <readonly v="true" /> - </linkInformation> - <linkInformation> - <name>7ff69154-f1ff-4e33-8cd4-5a88e3b18269</name> - <tableName>ADDRESS</tableName> - <primaryKey>ADDRESSID</primaryKey> - <isUIDTable v="false" /> - <readonly v="true" /> - </linkInformation> - </linkInformation> - </dbRecordContainer> - </recordContainers> -</entity> diff --git a/entity/DuplicatePerson_entity/documentation.adoc b/entity/DuplicatePerson_entity/documentation.adoc deleted file mode 100644 index 8d2e8be6b145c97ddff336e74921c2d77918c3d2..0000000000000000000000000000000000000000 --- a/entity/DuplicatePerson_entity/documentation.adoc +++ /dev/null @@ -1,17 +0,0 @@ -= DuplicateOrganisation_entity - -== Overview - -Shows the duplicates of a record. -The views are only referenced in the PersonMain_view. - -This entity is used to show all duplicates of a person, 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 diff --git a/entity/DuplicatePerson_entity/entityfields/filteractions/children/ignoreduplicates/onActionProcess.js b/entity/DuplicatePerson_entity/entityfields/filteractions/children/ignoreduplicates/onActionProcess.js deleted file mode 100644 index 69c03d7bc979275e8276e8bc9700787e0e513f13..0000000000000000000000000000000000000000 --- a/entity/DuplicatePerson_entity/entityfields/filteractions/children/ignoreduplicates/onActionProcess.js +++ /dev/null @@ -1,7 +0,0 @@ -import("system.neon"); -import("system.vars"); -import("system.result"); -import("DuplicateScanner_lib"); - -DuplicateScannerUtils.updateIgnored("Person_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 diff --git a/entity/DuplicatePerson_entity/entityfields/filteractions/children/mergecurrentintoselected/onActionProcess.js b/entity/DuplicatePerson_entity/entityfields/filteractions/children/mergecurrentintoselected/onActionProcess.js deleted file mode 100644 index 8e96e7fcea38ebc093da5fceaaa9ad34a9a5c7a9..0000000000000000000000000000000000000000 --- a/entity/DuplicatePerson_entity/entityfields/filteractions/children/mergecurrentintoselected/onActionProcess.js +++ /dev/null @@ -1,36 +0,0 @@ -import("system.translate"); -import("system.question"); -import("system.tools"); -import("Employee_lib"); -import("system.vars"); -import("system.neon"); -import("DuplicateMerge_lib"); - -if(vars.get("$sys.selection").length == 1) -{ -var sourceContactId = vars.get("$param.Id_param"); -var 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. -var mergeSuccess = DuplicateMergeUtils.mergePerson(sourceContactId, targetContactId); - -if(mergeSuccess) -{ - var user = tools.getUserByAttribute(tools.CONTACTID, sourceContactId); - - if (user) { - user[tools.PARAMS][tools.CONTACTID] = targetContactId; - tools.updateUser(user); - } - var currentContactId = EmployeeUtils.getCurrentContactId(); - if(currentContactId == null) - currentContactId = ""; - DuplicateMergeUtils.createMergeSuccessActivity(sourceContactId, targetContactId, currentContactId, "Person"); - - neon.openContext("Person", "PersonMain_view", [targetContactId], neon.OPERATINGSTATE_VIEW, null) -} -} -else -{ - question.showMessage(translate.text("Please select only one element")); -} diff --git a/entity/DuplicatePerson_entity/entityfields/filteractions/children/mergeselectedintocurrent/onActionProcess.js b/entity/DuplicatePerson_entity/entityfields/filteractions/children/mergeselectedintocurrent/onActionProcess.js deleted file mode 100644 index 30d97b1c8023db93074e3cee7b3f30487e920aad..0000000000000000000000000000000000000000 --- a/entity/DuplicatePerson_entity/entityfields/filteractions/children/mergeselectedintocurrent/onActionProcess.js +++ /dev/null @@ -1,42 +0,0 @@ -import("system.translate"); -import("system.question"); -import("system.tools"); -import("system.db"); -import("Employee_lib"); -import("KeywordRegistry_basic"); -import("ActivityTask_lib"); -import("system.vars"); -import("system.neon"); -import("DuplicateMerge_lib"); - -if(vars.get("$sys.selection").length == 1) -{ -var targetContactId = vars.get("$param.Id_param"); -var sourceContactIdArray = vars.get("$sys.selection"); -var sourceContactId = sourceContactIdArray[0]; - -//todo the actual merge ought to happen in a separate view where the contact infos can be merged manually by the user. -var mergeSuccess = DuplicateMergeUtils.mergePerson(sourceContactId, targetContactId); - -if(mergeSuccess) -{ - var user = tools.getUserByAttribute(tools.CONTACTID, sourceContactId); - - if (user) { - user[tools.PARAMS][tools.CONTACTID] = targetContactId; - tools.updateUser(user); - } - var currentContactId = EmployeeUtils.getCurrentContactId(); - if(currentContactId == null) - currentContactId = ""; - DuplicateMergeUtils.createMergeSuccessActivity(sourceContactId, targetContactId, currentContactId, "Person"); - //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")); -} diff --git a/entity/DuplicatePerson_entity/entityfields/id_param/valueProcess.js b/entity/DuplicatePerson_entity/entityfields/id_param/valueProcess.js deleted file mode 100644 index bffe18eb097c82b9fa662880ad23d5d1ee32f7ff..0000000000000000000000000000000000000000 --- a/entity/DuplicatePerson_entity/entityfields/id_param/valueProcess.js +++ /dev/null @@ -1,5 +0,0 @@ -import("system.result"); -import("system.vars"); - -var jsonObj = JSON.parse(vars.get("$param.Obj_param")); -result.string(jsonObj["CONTACTID"]); diff --git a/entity/DuplicatePerson_entity/entityfields/keywordcontactstates/children/containername_param/valueProcess.js b/entity/DuplicatePerson_entity/entityfields/keywordcontactstates/children/containername_param/valueProcess.js deleted file mode 100644 index 43e8d27c6a6cdd11f092f8b404a97dc237577a38..0000000000000000000000000000000000000000 --- a/entity/DuplicatePerson_entity/entityfields/keywordcontactstates/children/containername_param/valueProcess.js +++ /dev/null @@ -1,5 +0,0 @@ -import("system.result"); -import("Keyword_lib"); -import("KeywordRegistry_basic"); - -result.string($KeywordRegistry.contactStatus()); diff --git a/entity/DuplicatePerson_entity/entityfields/parentcontext/valueProcess.js b/entity/DuplicatePerson_entity/entityfields/parentcontext/valueProcess.js deleted file mode 100644 index f7baa76a6be6f585b2829869961b69b1ca4a5e15..0000000000000000000000000000000000000000 --- a/entity/DuplicatePerson_entity/entityfields/parentcontext/valueProcess.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.result"); -import("Context_lib"); - -result.string(ContextUtils.getContextName("Person")); diff --git a/entity/DuplicatePerson_entity/entityfields/picture/displayValueProcess.js b/entity/DuplicatePerson_entity/entityfields/picture/displayValueProcess.js deleted file mode 100644 index e09fa2ae490ce0756966fd490af0150cc05e726f..0000000000000000000000000000000000000000 --- a/entity/DuplicatePerson_entity/entityfields/picture/displayValueProcess.js +++ /dev/null @@ -1,11 +0,0 @@ -import("system.result"); -import("system.vars"); - -if (vars.get("$field.PICTURE")) -{ - result.string(vars.get("$field.PICTURE")); -} -else -{ - result.string("TEXT:" + (vars.getString("$field.FIRSTNAME") + " " + vars.getString("$field.LASTNAME")).trim()); -} diff --git a/entity/DuplicatePerson_entity/initFilterProcess.js b/entity/DuplicatePerson_entity/initFilterProcess.js deleted file mode 100644 index 92797e84dbb193011bf821bb4ecc828681a2d414..0000000000000000000000000000000000000000 --- a/entity/DuplicatePerson_entity/initFilterProcess.js +++ /dev/null @@ -1,15 +0,0 @@ -import("system.translate"); -import("system.result"); - -result.string(JSON.stringify({ - type: "group", - operator: "AND", - childs: [{ - type: "row", - name: "DUPLICATE", - operator: "EQUAL", - contenttype: "BOOLEAN", - key: "1", - value: translate.text("Yes") - }] -})); diff --git a/entity/DuplicatePerson_entity/recordcontainers/db/conditionProcess.js b/entity/DuplicatePerson_entity/recordcontainers/db/conditionProcess.js deleted file mode 100644 index 658b1af578f9b7fb2d68728d73cef7393c3a7740..0000000000000000000000000000000000000000 --- a/entity/DuplicatePerson_entity/recordcontainers/db/conditionProcess.js +++ /dev/null @@ -1,8 +0,0 @@ -import("system.vars"); -import("Sql_lib"); -import("DuplicateScanner_lib"); -import("system.result"); - -var duplicateIds = DuplicateScannerUtils.getDuplicateIdsByEntityObj("Person_entity", JSON.parse(vars.get("$param.Obj_param"))); -duplicateIds.push("-"); // workaround empty arrays -result.string(newWhere("CONTACT.CONTACTID", duplicateIds, SqlBuilder.IN()).toString()); diff --git a/entity/DuplicatePerson_entity/recordcontainers/db/fromClauseProcess.js b/entity/DuplicatePerson_entity/recordcontainers/db/fromClauseProcess.js deleted file mode 100644 index 2205f0c5af7cbe0439abdf3017bae42b6e9be2cd..0000000000000000000000000000000000000000 --- a/entity/DuplicatePerson_entity/recordcontainers/db/fromClauseProcess.js +++ /dev/null @@ -1,14 +0,0 @@ -import("Sql_lib"); -import("system.vars"); -import("system.result"); - -var unrelatedCondition = newWhere("UNRELATEDDUPLICATES.DUPLICATETYPE", "Person_entity") - .and("UNRELATEDDUPLICATES.SOURCEDUPLICATEID", vars.get("$param.Id_param")) - .and("UNRELATEDDUPLICATES.UNRELATEDDUPLICATEID = CONTACT.CONTACTID"); - -result.string( - "PERSON " + - "join CONTACT on (PERSON.PERSONID = CONTACT.PERSON_ID) " + - "left join ADDRESS on (ADDRESS.ADDRESSID = CONTACT.ADDRESS_ID) " + - "left join UNRELATEDDUPLICATES on " + unrelatedCondition.toString() -); diff --git a/entity/DuplicatePerson_entity/recordcontainers/db/recordfieldmappings/duplicate.value/expression.js b/entity/DuplicatePerson_entity/recordcontainers/db/recordfieldmappings/duplicate.value/expression.js deleted file mode 100644 index 8f7063b2ac8e637e6618ccc1ff745653daf0b339..0000000000000000000000000000000000000000 --- a/entity/DuplicatePerson_entity/recordcontainers/db/recordfieldmappings/duplicate.value/expression.js +++ /dev/null @@ -1,7 +0,0 @@ -import("system.result"); -import("Sql_lib"); - -var statement = SqlBuilder.caseStatement() - .when("UNRELATEDDUPLICATES.UNRELATEDDUPLICATEID is not null") - .thenString("0").elseString("1"); -result.string(statement); diff --git a/entity/DuplicatePerson_entity/recordcontainers/db/recordfieldmappings/organisation_id.displayvalue/expression.js b/entity/DuplicatePerson_entity/recordcontainers/db/recordfieldmappings/organisation_id.displayvalue/expression.js deleted file mode 100644 index 64f71be666b2bbb3421d182e2fe8b25d989a3316..0000000000000000000000000000000000000000 --- a/entity/DuplicatePerson_entity/recordcontainers/db/recordfieldmappings/organisation_id.displayvalue/expression.js +++ /dev/null @@ -1,5 +0,0 @@ -import("Sql_lib"); -import("system.result"); - -result.string(newSelect("ORGANISATION.NAME").from("ORGANISATION") - .where("ORGANISATION.ORGANISATIONID = CONTACT.ORGANISATION_ID").toString()); diff --git a/entity/DuplicatePerson_entity/recordcontainers/db/recordfieldmappings/organisation_id.value/expression.js b/entity/DuplicatePerson_entity/recordcontainers/db/recordfieldmappings/organisation_id.value/expression.js deleted file mode 100644 index e37273248e57bcb47a83af87693aa9cca2ed5636..0000000000000000000000000000000000000000 --- a/entity/DuplicatePerson_entity/recordcontainers/db/recordfieldmappings/organisation_id.value/expression.js +++ /dev/null @@ -1,6 +0,0 @@ -import("system.result"); -import("Sql_lib"); - -result.string(newSelect("c.CONTACTID").from("CONTACT as c") - .where("c.ORGANISATION_ID = CONTACT.ORGANISATION_ID") - .and("c.PERSON_ID is null").toString()); diff --git a/entity/DuplicatePerson_entity/recordcontainers/db/recordfieldmappings/standard_email_communication.value/expression.js b/entity/DuplicatePerson_entity/recordcontainers/db/recordfieldmappings/standard_email_communication.value/expression.js deleted file mode 100644 index 5827c59c416c332ba9281a60756f919fcb75c0a2..0000000000000000000000000000000000000000 --- a/entity/DuplicatePerson_entity/recordcontainers/db/recordfieldmappings/standard_email_communication.value/expression.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.result"); -import("Communication_lib"); - -result.string(CommUtil.getStandardSubSqlMail()); diff --git a/entity/DuplicatePerson_entity/recordcontainers/db/recordfieldmappings/standard_phone_communication.value/expression.js b/entity/DuplicatePerson_entity/recordcontainers/db/recordfieldmappings/standard_phone_communication.value/expression.js deleted file mode 100644 index 0f438c2535b21180c5ad03637de90f577f2c736e..0000000000000000000000000000000000000000 --- a/entity/DuplicatePerson_entity/recordcontainers/db/recordfieldmappings/standard_phone_communication.value/expression.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.result"); -import("Communication_lib"); - -result.string(CommUtil.getStandardSubSqlPhone()); diff --git a/entity/DuplicatePerson_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js b/entity/DuplicatePerson_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js deleted file mode 100644 index 50433a35e5f298cf550485a4d9ea33ac405a6ebd..0000000000000000000000000000000000000000 --- a/entity/DuplicatePerson_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js +++ /dev/null @@ -1,5 +0,0 @@ -import("system.result"); -import("Keyword_lib"); -import("KeywordRegistry_basic"); - -result.string(KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.contactStatus(), "CONTACT.STATUS")); diff --git a/entity/DuplicateScanner_entity/entityfields/filteractions/children/rebuild/onActionProcess.js b/entity/DuplicateScanner_entity/entityfields/filteractions/children/rebuild/onActionProcess.js index fc6ae65d2d318b7ba951ae069442ed54db022857..7ed528ddfe75c265e65de2421f1ca6158f7e2f08 100644 --- a/entity/DuplicateScanner_entity/entityfields/filteractions/children/rebuild/onActionProcess.js +++ b/entity/DuplicateScanner_entity/entityfields/filteractions/children/rebuild/onActionProcess.js @@ -1,23 +1,13 @@ +import("system.translate"); import("system.process"); -import("system.logging"); -import("system.entities"); import("system.vars"); -import("DuplicateScanner_lib"); -var selectedIds = vars.get("$sys.selection"); -var loadConfig = entities.createConfigForLoadingRows() - .entity("DuplicateScanner_entity") - .uids(selectedIds) - .fields(["FILTER_NAME", "ENTITY_TO_SCAN_NAME", "ID_FIELD_NAME", "SCAN_PATTERN"]); -var selectedEntries = entities.getRows(loadConfig); -logging.log("Rebuilding " + selectedEntries.length + " entries"); +var selectedEntries = vars.get("$sys.selectionRows"); selectedEntries.forEach(function(currEntry) { var filterName = currEntry["FILTER_NAME"]; var targetEntity = currEntry["ENTITY_TO_SCAN_NAME"]; - var targetIdField = currEntry["ID_FIELD_NAME"]; - var filter = JSON.parse(currEntry["SCAN_PATTERN"]); var startConfig = process.createStartAsyncConfig() .setName("rebuildDuplicates_serverProcess") @@ -25,8 +15,8 @@ selectedEntries.forEach(function(currEntry) .setLocalVariables({ filterName: filterName, targetEntity: targetEntity, - targetIdField: targetIdField, - filter: JSON.stringify(filter.filter) + caption: translate.text("Duplicaterow rebuild"), + description: translate.withArguments("The duplicate row corrosponding to %0 has been rebuild", [filterName]) }) .setUser(vars.get("$sys.user")) .setTimerType(process.TIMERTYPE_SERVER); diff --git a/entity/DuplicateScanner_entity/entityfields/filteractions/children/viewduplicates/onActionProcess.js b/entity/DuplicateScanner_entity/entityfields/filteractions/children/viewduplicates/onActionProcess.js index 064e1f6c17fd9f84dc46723d329baf5a181ddc6d..cf88cee6543b98e43bce2a2ac9ab24e9a0f38e9d 100644 --- a/entity/DuplicateScanner_entity/entityfields/filteractions/children/viewduplicates/onActionProcess.js +++ b/entity/DuplicateScanner_entity/entityfields/filteractions/children/viewduplicates/onActionProcess.js @@ -1,3 +1,4 @@ +import("Sql_lib"); import("system.translate"); import("system.question"); import("system.vars"); @@ -7,29 +8,19 @@ import("Context_lib"); if(vars.get("$sys.selection").length == 1) { - var config = entities.createConfigForLoadingRows() - .entity("DuplicateScanner_entity") - .uid(vars.get("$sys.selection")[0]) - .fields(["ENTITY_TO_SCAN_NAME"]); - var scanner = entities.getRow(config); - var contextId = ContextUtils.getContextName(ContextUtils.getContextId(scanner["ENTITY_TO_SCAN_NAME"])); - - neon.openContext(contextId, null, null, neon.OPERATINGSTATE_SEARCH, { - FilterPreSet_param: JSON.stringify({ - type: "group", - operator: "AND", - childs: [{ - type: "row", - name: "#EXTENSION.Duplicates_filter.Duplicates_filter#NUMBER", - operator: "GREATER", - value: "All Duplicates", - key: "0", - contenttype: "NUMBER" - }] - }) - }); + var entity = vars.get("$sys.selectionRows")[0]["ENTITY_TO_SCAN_NAME"]; + var contextId = ContextUtils.getContextName(ContextUtils.getContextId(entity)); + var duplicateIds = newSelect("HASDUPLICATE.OBJECT_ROWID") + .from("HASDUPLICATE") + .where("HASDUPLICATE.OBJECT_TYPE", entity) + .and("HASDUPLICATE.OBJECT_ROWID", newSelect("UNRELATEDDUPLICATES.SOURCEDUPLICATEID") + .from("UNRELATEDDUPLICATES") + .where("UNRELATEDDUPLICATES.DUPLICATETYPE = HASDUPLICATE.OBJECT_TYPE"), SqlBuilder.NOT_IN()) + .arrayColumn(); + + neon.openContext(contextId, null, duplicateIds, neon.OPERATINGSTATE_SEARCH, null); } else { question.showMessage(translate.text("Please select only one element")); -} +} \ No newline at end of file diff --git a/entity/DuplicateScanner_entity/recordcontainers/dbrecordcontainer/onDBInsert.js b/entity/DuplicateScanner_entity/recordcontainers/dbrecordcontainer/onDBInsert.js index 3c29c7e6c1790f6f53dd7fbb272a21d62f24667d..7b5061b548dbd89b48b34cf6d6bf947c6422a900 100644 --- a/entity/DuplicateScanner_entity/recordcontainers/dbrecordcontainer/onDBInsert.js +++ b/entity/DuplicateScanner_entity/recordcontainers/dbrecordcontainer/onDBInsert.js @@ -1,3 +1,4 @@ +import("DuplicateScanner_lib"); import("Sql_lib"); import("system.neon"); import("system.vars"); @@ -5,4 +6,4 @@ import("system.vars"); var rowdata = vars.get("$local.rowdata"); newWhere("DUPLICATESCANNER.ID", rowdata["DUPLICATESCANNER.ID"]) -.updateFields({"DUPLICATESCANNER.SCAN_PATTERN" : JSON.stringify({entity: "" + rowdata["DUPLICATESCANNER.ENTITY_TO_SCAN_NAME"] + "", provider: "indexP", filter: {type: "group", operator: "AND", childs: []}})}, "DUPLICATESCANNER"); \ No newline at end of file +.updateFields({"DUPLICATESCANNER.SCAN_PATTERN" : JSON.stringify({entity: "" + rowdata["DUPLICATESCANNER.ENTITY_TO_SCAN_NAME"] + "", provider: DuplicateScannerUtils.getDuplicateProviderName(), filter: {type: "group", operator: "AND", childs: []}})}, "DUPLICATESCANNER"); \ No newline at end of file diff --git a/entity/DuplicateScanner_entity/recordcontainers/dbrecordcontainer/onDBUpdate.js b/entity/DuplicateScanner_entity/recordcontainers/dbrecordcontainer/onDBUpdate.js index c752ef5850f94d87e6353b5cace686dafb172353..9e264bc9c8bd2e972d2d905e841385e9356740a0 100644 --- a/entity/DuplicateScanner_entity/recordcontainers/dbrecordcontainer/onDBUpdate.js +++ b/entity/DuplicateScanner_entity/recordcontainers/dbrecordcontainer/onDBUpdate.js @@ -1,3 +1,4 @@ +import("DuplicateScanner_lib"); import("Sql_lib"); import("system.vars"); @@ -6,7 +7,7 @@ var rowdata = vars.get("$local.rowdata"); let scanPattern = JSON.parse(rowdata["DUPLICATESCANNER.SCAN_PATTERN"]); if (scanPattern.provider == undefined) { - scanPattern.provider = "indexP"; + scanPattern.provider = DuplicateScannerUtils.getDuplicateProviderName(); newWhere("DUPLICATESCANNER.ID", vars.get("$local.uid")) .updateData(true, "DUPLICATESCANNER", ["DUPLICATESCANNER.SCAN_PATTERN"], null,[JSON.stringify(scanPattern)]); } \ No newline at end of file diff --git a/entity/Duplicate_entity/Duplicate_entity.aod b/entity/Duplicate_entity/Duplicate_entity.aod new file mode 100644 index 0000000000000000000000000000000000000000..a5926bf4898fcaa32cc28690ee1bb1e7526da4ff --- /dev/null +++ b/entity/Duplicate_entity/Duplicate_entity.aod @@ -0,0 +1,130 @@ +<?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>Duplicate_entity</name> + <title>Duplicate</title> + <majorModelMode>DISTRIBUTED</majorModelMode> + <initFilterProcess>%aditoprj%/entity/Duplicate_entity/initFilterProcess.js</initFilterProcess> + <titlePlural>Duplicates</titlePlural> + <recordContainer>jdito</recordContainer> + <entityFields> + <entityProvider> + <name>#PROVIDER</name> + </entityProvider> + <entityProvider> + <name>#PROVIDER_AGGREGATES</name> + <useAggregates v="true" /> + </entityProvider> + <entityField> + <name>UID</name> + </entityField> + <entityField> + <name>TITLE</name> + <title>Title</title> + </entityField> + <entityField> + <name>DESCRIPTION</name> + <title>Description</title> + </entityField> + <entityProvider> + <name>Duplicates</name> + <targetContextField>CONTEXTNAME</targetContextField> + <targetIdField>UID</targetIdField> + </entityProvider> + <entityField> + <name>ICON</name> + <contentType>IMAGE</contentType> + </entityField> + <entityParameter> + <name>DuplicateObject_param</name> + <expose v="true" /> + <mandatory v="true" /> + </entityParameter> + <entityField> + <name>CONTEXTNAME</name> + </entityField> + <entityActionGroup> + <name>filterActions</name> + <children> + <entityActionField> + <name>ignoreDuplicates</name> + <title>${IGNORE_DUPLICATE}</title> + <onActionProcess>%aditoprj%/entity/Duplicate_entity/entityfields/filteractions/children/ignoreduplicates/onActionProcess.js</onActionProcess> + <selectionType>MULTI</selectionType> + <iconId>VAADIN:CLOSE</iconId> + <titleProcess>%aditoprj%/entity/Duplicate_entity/entityfields/filteractions/children/ignoreduplicates/titleProcess.js</titleProcess> + <tooltipProcess>%aditoprj%/entity/Duplicate_entity/entityfields/filteractions/children/ignoreduplicates/tooltipProcess.js</tooltipProcess> + </entityActionField> + <entityActionField> + <name>mergeselectedintocurrent</name> + <title>Integrate selected dataset into opened dataset</title> + <onActionProcess>%aditoprj%/entity/Duplicate_entity/entityfields/filteractions/children/mergeselectedintocurrent/onActionProcess.js</onActionProcess> + <selectionType>MULTI</selectionType> + <iconId>NEON:IMPORT</iconId> + <state>INVISIBLE</state> + <stateProcess>%aditoprj%/entity/Duplicate_entity/entityfields/filteractions/children/mergeselectedintocurrent/stateProcess.js</stateProcess> + <tooltip>Integrate selected dataset into opened dataset</tooltip> + </entityActionField> + <entityActionField> + <name>mergecurrentintoselected</name> + <title>Integrate opened dataset into selected dataset</title> + <onActionProcess>%aditoprj%/entity/Duplicate_entity/entityfields/filteractions/children/mergecurrentintoselected/onActionProcess.js</onActionProcess> + <selectionType>MULTI</selectionType> + <iconId>NEON:EXPORT</iconId> + <state>INVISIBLE</state> + <stateProcess>%aditoprj%/entity/Duplicate_entity/entityfields/filteractions/children/mergecurrentintoselected/stateProcess.js</stateProcess> + <tooltip>Integrate opened dataset into selected dataset</tooltip> + </entityActionField> + </children> + </entityActionGroup> + <entityField> + <name>SOURCE_UID</name> + </entityField> + <entityField> + <name>SOURCE_ENTITY</name> + </entityField> + <entityField> + <name>ISDUPLICATE</name> + <title>Duplicate</title> + <contentType>BOOLEAN</contentType> + <dropDownProcess>%aditoprj%/entity/Duplicate_entity/entityfields/isduplicate/dropDownProcess.js</dropDownProcess> + </entityField> + </entityFields> + <recordContainers> + <jDitoRecordContainer> + <name>jdito</name> + <jDitoRecordAlias>Data_alias</jDitoRecordAlias> + <isFilterable v="true" /> + <isRequireContainerFiltering v="true" /> + <contentProcess>%aditoprj%/entity/Duplicate_entity/recordcontainers/jdito/contentProcess.js</contentProcess> + <recordFieldMappings> + <jDitoRecordFieldMapping> + <name>UID.value</name> + </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>ICON.value</name> + </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>TITLE.value</name> + <isFilterable v="true" /> + </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>DESCRIPTION.value</name> + <isFilterable v="true" /> + </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>CONTEXTNAME.value</name> + </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>SOURCE_UID.value</name> + </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>SOURCE_ENTITY.value</name> + </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>ISDUPLICATE.value</name> + <isFilterable v="true" /> + </jDitoRecordFieldMapping> + </recordFieldMappings> + </jDitoRecordContainer> + </recordContainers> +</entity> diff --git a/entity/Duplicate_entity/entityfields/filteractions/children/ignoreduplicates/onActionProcess.js b/entity/Duplicate_entity/entityfields/filteractions/children/ignoreduplicates/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..155c0216e77261c29f92ac49c8cdf7f7534f512b --- /dev/null +++ b/entity/Duplicate_entity/entityfields/filteractions/children/ignoreduplicates/onActionProcess.js @@ -0,0 +1,9 @@ +import("system.translate"); +import("system.question"); +import("system.neon"); +import("system.vars"); +import("system.result"); +import("DuplicateScanner_lib"); + +DuplicateScannerUtils.updateIgnored(vars.get("$field.SOURCE_ENTITY"), vars.get("$field.SOURCE_UID"), vars.get("$sys.selection"), parseInt(vars.get("$field.ISDUPLICATE"))); +neon.refreshAll(); // Update the rows, because UNRELATEDDUPLICATES wont trigger a refresh even with write entities diff --git a/entity/DuplicatePerson_entity/entityfields/filteractions/children/ignoreduplicates/titleProcess.js b/entity/Duplicate_entity/entityfields/filteractions/children/ignoreduplicates/titleProcess.js similarity index 79% rename from entity/DuplicatePerson_entity/entityfields/filteractions/children/ignoreduplicates/titleProcess.js rename to entity/Duplicate_entity/entityfields/filteractions/children/ignoreduplicates/titleProcess.js index 4c5ccfffeb0e7b5efc940eba237fbdc99ab9b603..896a15b93193321af4d612298f1c1e2015d19d51 100644 --- a/entity/DuplicatePerson_entity/entityfields/filteractions/children/ignoreduplicates/titleProcess.js +++ b/entity/Duplicate_entity/entityfields/filteractions/children/ignoreduplicates/titleProcess.js @@ -3,7 +3,7 @@ import("system.vars"); import("system.result"); result.string( - parseInt(vars.get("$field.DUPLICATE")) ? + parseInt(vars.get("$field.ISDUPLICATE")) ? translate.text("${IGNORE_DUPLICATE}") : translate.text("${UNIGNORE_DUPLICATE}") ); diff --git a/entity/DuplicateOrganisation_entity/entityfields/filteractions/children/ignoreduplicates/titleProcess.js b/entity/Duplicate_entity/entityfields/filteractions/children/ignoreduplicates/tooltipProcess.js similarity index 79% rename from entity/DuplicateOrganisation_entity/entityfields/filteractions/children/ignoreduplicates/titleProcess.js rename to entity/Duplicate_entity/entityfields/filteractions/children/ignoreduplicates/tooltipProcess.js index 4c5ccfffeb0e7b5efc940eba237fbdc99ab9b603..896a15b93193321af4d612298f1c1e2015d19d51 100644 --- a/entity/DuplicateOrganisation_entity/entityfields/filteractions/children/ignoreduplicates/titleProcess.js +++ b/entity/Duplicate_entity/entityfields/filteractions/children/ignoreduplicates/tooltipProcess.js @@ -3,7 +3,7 @@ import("system.vars"); import("system.result"); result.string( - parseInt(vars.get("$field.DUPLICATE")) ? + parseInt(vars.get("$field.ISDUPLICATE")) ? translate.text("${IGNORE_DUPLICATE}") : translate.text("${UNIGNORE_DUPLICATE}") ); diff --git a/entity/Duplicate_entity/entityfields/filteractions/children/mergecurrentintoselected/onActionProcess.js b/entity/Duplicate_entity/entityfields/filteractions/children/mergecurrentintoselected/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..efe4c00f3c7d81a6d5d8c6c03d107304f8e3cb36 --- /dev/null +++ b/entity/Duplicate_entity/entityfields/filteractions/children/mergecurrentintoselected/onActionProcess.js @@ -0,0 +1,28 @@ +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("$field.SOURCE_UID"); + let targetContactId = vars.get("$sys.selection")[0]; + let context = vars.get("$field.CONTEXTNAME"); + + //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.mergeContext(context, sourceContactId, targetContactId); + + if(mergeSuccess) + { + let currentContactId = EmployeeUtils.getCurrentContactId() || ""; + DuplicateMergeUtils.createMergeSuccessActivity(sourceContactId, targetContactId, currentContactId, context); + + neon.openContext(context, null, [targetContactId], neon.OPERATINGSTATE_VIEW, null); + } +} +else +{ + question.showMessage(translate.text("Please select only one element")); +} diff --git a/entity/Duplicate_entity/entityfields/filteractions/children/mergecurrentintoselected/stateProcess.js b/entity/Duplicate_entity/entityfields/filteractions/children/mergecurrentintoselected/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..80a8ef08400c41c39a2b2269fb2056c982321a72 --- /dev/null +++ b/entity/Duplicate_entity/entityfields/filteractions/children/mergecurrentintoselected/stateProcess.js @@ -0,0 +1,9 @@ +import("system.neon"); +import("system.result"); +import("system.vars"); +import("DuplicateMerge_lib"); + +if(DuplicateMergeUtils.hasContextMergeFunction(vars.get("$field.CONTEXTNAME"))) +{ + result.string(neon.COMPONENTSTATE_EDITABLE); +} \ No newline at end of file diff --git a/entity/Duplicate_entity/entityfields/filteractions/children/mergeselectedintocurrent/onActionProcess.js b/entity/Duplicate_entity/entityfields/filteractions/children/mergeselectedintocurrent/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..520e640f20c672251791d0010f0c672032ffeda4 --- /dev/null +++ b/entity/Duplicate_entity/entityfields/filteractions/children/mergeselectedintocurrent/onActionProcess.js @@ -0,0 +1,30 @@ +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("$field.SOURCE_UID"); + let sourceContactId = vars.get("$sys.selection")[0]; + let context = vars.get("$field.CONTEXTNAME"); + + //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.mergeContext(context, sourceContactId, targetContactId); + + if(mergeSuccess) + { + let currentContactId = EmployeeUtils.getCurrentContactId() || ""; + DuplicateMergeUtils.createMergeSuccessActivity(sourceContactId, targetContactId, currentContactId, context); + //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")); +} diff --git a/entity/Duplicate_entity/entityfields/filteractions/children/mergeselectedintocurrent/stateProcess.js b/entity/Duplicate_entity/entityfields/filteractions/children/mergeselectedintocurrent/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..80a8ef08400c41c39a2b2269fb2056c982321a72 --- /dev/null +++ b/entity/Duplicate_entity/entityfields/filteractions/children/mergeselectedintocurrent/stateProcess.js @@ -0,0 +1,9 @@ +import("system.neon"); +import("system.result"); +import("system.vars"); +import("DuplicateMerge_lib"); + +if(DuplicateMergeUtils.hasContextMergeFunction(vars.get("$field.CONTEXTNAME"))) +{ + result.string(neon.COMPONENTSTATE_EDITABLE); +} \ No newline at end of file diff --git a/entity/Duplicate_entity/entityfields/isduplicate/dropDownProcess.js b/entity/Duplicate_entity/entityfields/isduplicate/dropDownProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..e3351b24177538ee71fa0200812feed9a6fb5dca --- /dev/null +++ b/entity/Duplicate_entity/entityfields/isduplicate/dropDownProcess.js @@ -0,0 +1,7 @@ +import("system.translate"); +import("system.result"); + +result.object([ + ["0", translate.text("No")], + ["1", translate.text("Yes")] +]); \ No newline at end of file diff --git a/entity/DuplicateOrganisation_entity/initFilterProcess.js b/entity/Duplicate_entity/initFilterProcess.js similarity index 89% rename from entity/DuplicateOrganisation_entity/initFilterProcess.js rename to entity/Duplicate_entity/initFilterProcess.js index 92797e84dbb193011bf821bb4ecc828681a2d414..7f9fa550dcfb4151b1f24e0753533349b1296b4a 100644 --- a/entity/DuplicateOrganisation_entity/initFilterProcess.js +++ b/entity/Duplicate_entity/initFilterProcess.js @@ -6,10 +6,10 @@ result.string(JSON.stringify({ operator: "AND", childs: [{ type: "row", - name: "DUPLICATE", + name: "ISDUPLICATE", operator: "EQUAL", contenttype: "BOOLEAN", key: "1", value: translate.text("Yes") }] -})); +})); \ No newline at end of file diff --git a/entity/Duplicate_entity/recordcontainers/jdito/contentProcess.js b/entity/Duplicate_entity/recordcontainers/jdito/contentProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..6d26e7d4cd23c65a60f1cc6d7114596e547f2140 --- /dev/null +++ b/entity/Duplicate_entity/recordcontainers/jdito/contentProcess.js @@ -0,0 +1,26 @@ +import("system.logging"); +import("DuplicateScanner_lib"); +import("system.result"); +import("JditoFilter_lib"); +import("system.vars"); + +var duplicateObject = JSON.parse(vars.get("$param.DuplicateObject_param")); +var filter = vars.get("$local.filter"); +var filterFields = ["UID", "ICON", "TITLE", "DESCRIPTION", "CONTEXTNAME", "SOURCE_ID", "SOURCE_ENTITY", "ISDUPLICATE"]; +var duplicates = []; + +duplicateObject.forEach(function(pMappingObj) +{ + try + { + duplicates = duplicates.concat((new DuplicateUtils(pMappingObj)).execute()); + } + catch(err) + { + logging.log(err, logging.ERROR); + } +}); + +duplicates = JditoFilterUtils.filterRecords(filterFields, duplicates, filter.filter, {}); + +result.object(duplicates); \ No newline at end of file diff --git a/entity/Organisation_entity/Organisation_entity.aod b/entity/Organisation_entity/Organisation_entity.aod index 539360851e27cc97de40bf25776fc1635f9f4ebb..470985186e35aa9b270b92b8f59ffdd9763db608 100644 --- a/entity/Organisation_entity/Organisation_entity.aod +++ b/entity/Organisation_entity/Organisation_entity.aod @@ -439,7 +439,6 @@ <dependency> <name>dependency</name> <entityName>Salesproject_entity</entityName> - <fieldName>Salesprojects</fieldName> </dependency> <children> <entityParameter> @@ -944,8 +943,8 @@ <valueProcess>%aditoprj%/entity/Organisation_entity/entityfields/organisation_objecttype/valueProcess.js</valueProcess> </entityField> <entityProvider> - <name>indexP</name> - <documentation>%aditoprj%/entity/Organisation_entity/entityfields/indexp/documentation.adoc</documentation> + <name>Dublicates</name> + <documentation>%aditoprj%/entity/Organisation_entity/entityfields/dublicates/documentation.adoc</documentation> <recordContainer>index</recordContainer> <children> <entityParameter> @@ -1282,13 +1281,13 @@ <selectionModeProcess>%aditoprj%/entity/Organisation_entity/entityfields/duplicates/selectionModeProcess.js</selectionModeProcess> <dependency> <name>dependency</name> - <entityName>DuplicateOrganisation_entity</entityName> - <fieldName>#PROVIDER</fieldName> + <entityName>Duplicate_entity</entityName> + <fieldName>Duplicates</fieldName> </dependency> <children> <entityParameter> - <name>Obj_param</name> - <valueProcess>%aditoprj%/entity/Organisation_entity/entityfields/duplicates/children/obj_param/valueProcess.js</valueProcess> + <name>DuplicateObject_param</name> + <valueProcess>%aditoprj%/entity/Organisation_entity/entityfields/duplicates/children/duplicateobject_param/valueProcess.js</valueProcess> </entityParameter> </children> </entityConsumer> @@ -1762,7 +1761,6 @@ <additionalFieldNameAliases> <element>address</element> </additionalFieldNameAliases> - <isMultiValued v="true" /> </indexRecordFieldMapping> <indexRecordFieldMapping> <name>STANDARD_COUNTRY.value</name> @@ -1770,7 +1768,6 @@ <additionalFieldNameAliases> <element>country</element> </additionalFieldNameAliases> - <isMultiValued v="true" /> </indexRecordFieldMapping> <indexRecordFieldMapping> <name>STANDARD_ZIP.value</name> @@ -1778,7 +1775,6 @@ <additionalFieldNameAliases> <element>zip</element> </additionalFieldNameAliases> - <isMultiValued v="true" /> </indexRecordFieldMapping> <indexRecordFieldMapping> <name>STANDARD_CITY.value</name> @@ -1786,7 +1782,6 @@ <additionalFieldNameAliases> <element>city</element> </additionalFieldNameAliases> - <isMultiValued v="true" /> </indexRecordFieldMapping> <indexRecordFieldMapping> <name>STANDARD_EMAIL_COMMUNICATION.value</name> @@ -1794,7 +1789,6 @@ <additionalFieldNameAliases> <element>email</element> </additionalFieldNameAliases> - <isMultiValued v="false" /> </indexRecordFieldMapping> <indexRecordFieldMapping> <name>STANDARD_PHONE_COMMUNICATION.value</name> @@ -1802,7 +1796,6 @@ <additionalFieldNameAliases> <element>phone</element> </additionalFieldNameAliases> - <isMultiValued v="false" /> </indexRecordFieldMapping> <indexRecordFieldMapping> <name>ADDRESS_ID.displayValue</name> diff --git a/entity/Organisation_entity/contentDescriptionProcess.js b/entity/Organisation_entity/contentDescriptionProcess.js index b07a72fe7cc543e3bedc5d5604f12f28769ffb6b..85723819cdf5a5f2c32f952765c3ea512dddc005 100644 --- a/entity/Organisation_entity/contentDescriptionProcess.js +++ b/entity/Organisation_entity/contentDescriptionProcess.js @@ -1,5 +1,14 @@ +import("Util_lib"); import("system.translate"); import("system.datetime"); import("system.vars"); import("system.result"); -result.string(datetime.toDate(vars.get("$field.DATE_NEW"), translate.text("dd.MM.yyyy"))); \ No newline at end of file + +//Has to be there, because the core doesn't check changes on ".displayValue" +"$field.ADDRESS_ID"; + +result.string( + StringUtils.concat(" ", [vars.get("$field.ADDRESS_ID.displayValue") + , '|', translate.text("Phone") + ":", vars.get("$field.STANDARD_PHONE_COMMUNICATION") + , '|', translate.text("Email") + ":", vars.get("$field.STANDARD_EMAIL_COMMUNICATION")]) +); \ No newline at end of file diff --git a/entity/Organisation_entity/entityfields/commrestrictions_active/valueProcess.js b/entity/Organisation_entity/entityfields/commrestrictions_active/valueProcess.js index eb0180412d1da157d1c0c7c2b6cc9de3818d508b..cec39d51e514c2159c988d626eeae0fecf149f88 100644 --- a/entity/Organisation_entity/entityfields/commrestrictions_active/valueProcess.js +++ b/entity/Organisation_entity/entityfields/commrestrictions_active/valueProcess.js @@ -1,3 +1,7 @@ +import("Util_lib"); +import("system.translate"); +import("Entity_lib"); +import("DuplicateScanner_lib"); import("Contact_lib"); import("system.neon"); import("system.result"); @@ -5,5 +9,30 @@ import("system.vars"); if (vars.get("$sys.viewmode") == neon.FRAME_VIEWMODE_DATASET) { - result.string(ContactUtils.getCommunicationRejectionSummary(vars.get("$field.CONTACTID"))); + var commRestrictionString = ContactUtils.getCommunicationRejectionSummary(vars.get("$field.CONTACTID")); + + //has to be checked for exists because otherwise there will be a exception on the quickEntry_entity + var firstAddress = vars.exists("$field.Addresses.insertedRows") && vars.get("$field.Addresses.insertedRows") ? vars.get("$field.Addresses.insertedRows")[0] : null; + + var dataObject = DuplicateScannerUtils.getDataForDuplicateCheck(EntityUtils.getCurrentEntitytId(), { + CONTACTID: vars.get("$field.CONTACTID"), + NAME: vars.get("$field.NAME"), + ADDRESS_ID: vars.get("$field.ADDRESS_ID"), + CUSTOMERCODE: vars.get("$field.CUSTOMERCODE"), + LANGUAGE: vars.get("$field.LANGUAGE"), + TYPE: vars.get("$field.TYPE"), + STATUS: vars.get("$field.STATUS"), + STANDARD_ADDRESS: vars.get("$field.STANDARD_ADDRESS") || (firstAddress ? firstAddress["ADDRESS"] : ""), + STANDARD_CITY: vars.get("$field.STANDARD_CITY") || (firstAddress ? firstAddress["CITY"] : ""), + STANDARD_COUNTRY: vars.get("$field.STANDARD_COUNTRY") || (firstAddress ? firstAddress["COUNTRY"] : ""), + STANDARD_EMAIL_COMMUNICATION: vars.get("$field.STANDARD_EMAIL_COMMUNICATION"), + STANDARD_LAT: vars.get("$field.STANDARD_LAT"), + STANDARD_LON: vars.get("$field.STANDARD_LON"), + STANDARD_PHONE_COMMUNICATION: vars.get("$field.STANDARD_PHONE_COMMUNICATION"), + STANDARD_ZIP: vars.get("$field.STANDARD_ZIP") || (firstAddress ? firstAddress["ZIP"] : "") + })[0]; + + var duplictateString = (new DuplicateUtils(dataObject)).checkForDuplicates() ? translate.text("Duplicates have been found") : ""; + + result.string(StringUtils.concat("\n", [commRestrictionString, duplictateString])); } diff --git a/entity/Organisation_entity/entityfields/indexp/documentation.adoc b/entity/Organisation_entity/entityfields/dublicates/documentation.adoc similarity index 100% rename from entity/Organisation_entity/entityfields/indexp/documentation.adoc rename to entity/Organisation_entity/entityfields/dublicates/documentation.adoc diff --git a/entity/Organisation_entity/entityfields/duplicates/children/duplicateobject_param/valueProcess.js b/entity/Organisation_entity/entityfields/duplicates/children/duplicateobject_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..e67ea2edade05f7799146c04c6e8d4f223024195 --- /dev/null +++ b/entity/Organisation_entity/entityfields/duplicates/children/duplicateobject_param/valueProcess.js @@ -0,0 +1,25 @@ +import("KeywordRegistry_basic"); +import("Entity_lib"); +import("DuplicateScanner_lib"); +import("system.vars"); +import("system.result"); + +var firstAddress = vars.get("$field.Addresses.insertedRows") ? vars.get("$field.Addresses.insertedRows")[0] : null; + +result.object(DuplicateScannerUtils.getDataForDuplicateCheck(EntityUtils.getCurrentEntitytId(), { + CONTACTID: vars.get("$field.CONTACTID"), + NAME: vars.get("$field.NAME"), + ADDRESS_ID: vars.get("$field.ADDRESS_ID"), + CUSTOMERCODE: vars.get("$field.CUSTOMERCODE"), + LANGUAGE: vars.get("$field.LANGUAGE"), + TYPE: vars.get("$field.TYPE"), + STATUS: vars.get("$field.STATUS"), + STANDARD_ADDRESS: vars.get("$field.STANDARD_ADDRESS") || (firstAddress ? firstAddress["ADDRESS"] : ""), + STANDARD_CITY: vars.get("$field.STANDARD_CITY") || (firstAddress ? firstAddress["CITY"] : ""), + STANDARD_COUNTRY: vars.get("$field.STANDARD_COUNTRY") || (firstAddress ? firstAddress["COUNTRY"] : ""), + STANDARD_EMAIL_COMMUNICATION: vars.get("$field.STANDARD_EMAIL_COMMUNICATION"), + STANDARD_LAT: vars.get("$field.STANDARD_LAT"), + STANDARD_LON: vars.get("$field.STANDARD_LON"), + STANDARD_PHONE_COMMUNICATION: vars.get("$field.STANDARD_PHONE_COMMUNICATION"), + STANDARD_ZIP: vars.get("$field.STANDARD_ZIP") || (firstAddress ? firstAddress["ZIP"] : "") +})); \ No newline at end of file diff --git a/entity/Organisation_entity/entityfields/duplicates/children/obj_param/valueProcess.js b/entity/Organisation_entity/entityfields/duplicates/children/obj_param/valueProcess.js deleted file mode 100644 index 39bdfae5361be160d838627fc4e4de2d45eb9b82..0000000000000000000000000000000000000000 --- a/entity/Organisation_entity/entityfields/duplicates/children/obj_param/valueProcess.js +++ /dev/null @@ -1,20 +0,0 @@ -import("system.vars"); -import("system.result"); - -result.string(JSON.stringify({ - CONTACTID: vars.get("$field.CONTACTID"), - NAME: vars.get("$field.NAME"), - ADDRESS_ID: vars.get("$field.ADDRESS_ID"), - CUSTOMERCODE: vars.get("$field.CUSTOMERCODE"), - LANGUAGE: vars.get("$field.LANGUAGE"), - TYPE: vars.get("$field.TYPE"), - STATUS: vars.get("$field.STATUS"), - STANDARD_ADDRESS: vars.get("$field.STANDARD_ADDRESS"), - STANDARD_CITY: vars.get("$field.STANDARD_CITY"), - STANDARD_COUNTRY: vars.get("$field.STANDARD_COUNTRY"), - STANDARD_EMAIL_COMMUNICATION: vars.get("$field.STANDARD_EMAIL_COMMUNICATION"), - STANDARD_LAT: vars.get("$field.STANDARD_LAT"), - STANDARD_LON: vars.get("$field.STANDARD_LON"), - STANDARD_PHONE_COMMUNICATION: vars.get("$field.STANDARD_PHONE_COMMUNICATION"), - STANDARD_ZIP: vars.get("$field.STANDARD_ZIP") -})); diff --git a/entity/Organisation_entity/recordcontainers/db/onDBDelete.js b/entity/Organisation_entity/recordcontainers/db/onDBDelete.js index 1c79f609e4a6fe4174ecd97e5d2eb712ed3c6e28..df7ebcfc65ce91ebe3df47be55e4f6d59813c916 100644 --- a/entity/Organisation_entity/recordcontainers/db/onDBDelete.js +++ b/entity/Organisation_entity/recordcontainers/db/onDBDelete.js @@ -1,3 +1,4 @@ +import("Entity_lib"); import("Sql_lib"); import("Context_lib"); import("Workflow_lib"); @@ -5,9 +6,8 @@ import("system.vars"); import("DuplicateScanner_lib"); import("Attribute_lib"); -// TODO: enable when duplicate-module is finalized let contactId = vars.get("$field.CONTACTID"); -DuplicateScannerUtils.deleteHasDuplicateEntries("Organisation_entity", [contactId]); +DuplicateScannerUtils.deleteHasDuplicateEntries(EntityUtils.getCurrentEntitytId(), [contactId]); new AttributeRelationQuery(contactId, null, ContextUtils.getCurrentContextId()) .deleteAllAttributes(); diff --git a/entity/Organisation_entity/recordcontainers/db/onDBInsert.js b/entity/Organisation_entity/recordcontainers/db/onDBInsert.js index c8db8fdecb72ba18f14ae3fd3a5bd05223ac2396..3a1f8c34d3d38dd91b68afbf069f5aa1d739b2e8 100644 --- a/entity/Organisation_entity/recordcontainers/db/onDBInsert.js +++ b/entity/Organisation_entity/recordcontainers/db/onDBInsert.js @@ -1,8 +1,9 @@ +import("Entity_lib"); import("system.vars"); import("Workflow_lib"); import("DuplicateScanner_lib"); -DuplicateScannerUtils.updateHasDuplicateEntry("Organisation_entity"); +DuplicateScannerUtils.updateHasDuplicateEntry(EntityUtils.getCurrentEntitytId()); //start the execution in afterOperatingState, because here the dataset is not yet inserted vars.set("$context.workflowQueue", {}); diff --git a/entity/Organisation_entity/recordcontainers/db/onDBUpdate.js b/entity/Organisation_entity/recordcontainers/db/onDBUpdate.js index 737768cc8678c59374d99e790f4956812e3661db..d5a9930e3524f4672e60fc045acf0981c2f8ed5c 100644 --- a/entity/Organisation_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/Organisation_entity/recordcontainers/db/onDBUpdate.js @@ -8,7 +8,7 @@ import("Workflow_lib"); import("KeywordRegistry_basic"); import("DuplicateScanner_lib"); -DuplicateScannerUtils.updateHasDuplicateEntry("Organisation_entity"); +DuplicateScannerUtils.updateHasDuplicateEntry(EntityUtils.getCurrentEntitytId()); // TODO: this is a workaround for missing possibility to react on changes of fields not connected to record Contqainer #1030023 var rowdata = vars.get("$local.rowdata"); diff --git a/entity/Organisation_entity/recordcontainers/index/query.js b/entity/Organisation_entity/recordcontainers/index/query.js index 7719191536bddb7acfaeea36c429e64c453847b2..7915fb34408516b0c6ffd9c57877a6b20856677f 100644 --- a/entity/Organisation_entity/recordcontainers/index/query.js +++ b/entity/Organisation_entity/recordcontainers/index/query.js @@ -33,10 +33,10 @@ var querySelect = newSelect([ sqlHelper.trim("ORGANISATION.ORGANISATIONID"),//trim to enable filter patterns like: >> -organisationid_value:0<< "CONTACT.CONTACTID", "ORGANISATION.CUSTOMERCODE", - "ADDRESS.ADDRESS", - "ADDRESS.COUNTRY", - "ADDRESS.ZIP", - "ADDRESS.CITY", + "standardAddress.ADDRESS", + "standardAddress.COUNTRY", + "standardAddress.ZIP", + "standardAddress.CITY", "standardEmail.ADDR", "standardPhone.ADDR", sqlHelper.concatWithSeparator([sqlHelper.concatWithSeparator(["standardAddress.ADDRESS", "standardAddress.BUILDINGNO"]) @@ -46,7 +46,6 @@ var querySelect = newSelect([ .from("ORGANISATION") .join("CONTACT", "CONTACT.ORGANISATION_ID = ORGANISATION.ORGANISATIONID and CONTACT.PERSON_ID is null") .leftJoin("ADDRESS", "standardAddress.ADDRESSID = CONTACT.ADDRESS_ID", "standardAddress") - .leftJoin("ADDRESS", "ADDRESS.CONTACT_ID = CONTACT.CONTACTID") .leftJoin("COMMUNICATION", "COMMUNICATION.CONTACT_ID = CONTACT.CONTACTID") //standardMail is not multi valued and can only old one value (the standard email address) .leftJoin("COMMUNICATION", newWhere("standardEmail.CONTACT_ID = CONTACT.CONTACTID") diff --git a/entity/Person_entity/Person_entity.aod b/entity/Person_entity/Person_entity.aod index cc93d6ec372f55d0d72aec8f38f4ed96a29b7992..4fc9ff7c70ec6ff160a892062b545352ae69d631 100644 --- a/entity/Person_entity/Person_entity.aod +++ b/entity/Person_entity/Person_entity.aod @@ -12,6 +12,7 @@ </siblings> <grantDeleteProcess>%aditoprj%/entity/Person_entity/grantDeleteProcess.js</grantDeleteProcess> <contentTitleProcess>%aditoprj%/entity/Person_entity/contentTitleProcess.js</contentTitleProcess> + <contentDescriptionProcess>%aditoprj%/entity/Person_entity/contentDescriptionProcess.js</contentDescriptionProcess> <afterUiInit>%aditoprj%/entity/Person_entity/afterUiInit.js</afterUiInit> <onValidation>%aditoprj%/entity/Person_entity/onValidation.js</onValidation> <initFilterProcess>%aditoprj%/entity/Person_entity/initFilterProcess.js</initFilterProcess> @@ -975,8 +976,8 @@ <title>Count</title> </entityAggregateField> <entityProvider> - <name>indexP</name> - <documentation>%aditoprj%/entity/Person_entity/entityfields/indexp/documentation.adoc</documentation> + <name>Dublicates</name> + <documentation>%aditoprj%/entity/Person_entity/entityfields/dublicates/documentation.adoc</documentation> <recordContainer>index</recordContainer> </entityProvider> <entityField> @@ -1003,9 +1004,6 @@ </entityParameter> </children> </entityConsumer> - <entityProvider> - <name>ebdb88f5-f030-426c-b261-9f3828d19356</name> - </entityProvider> <entityConsumer> <name>Orders</name> <documentation>%aditoprj%/entity/Person_entity/entityfields/orders/documentation.adoc</documentation> @@ -1246,13 +1244,13 @@ <selectionModeProcess>%aditoprj%/entity/Person_entity/entityfields/duplicates/selectionModeProcess.js</selectionModeProcess> <dependency> <name>dependency</name> - <entityName>DuplicatePerson_entity</entityName> - <fieldName>#PROVIDER</fieldName> + <entityName>Duplicate_entity</entityName> + <fieldName>Duplicates</fieldName> </dependency> <children> <entityParameter> - <name>Obj_param</name> - <valueProcess>%aditoprj%/entity/Person_entity/entityfields/duplicates/children/obj_param/valueProcess.js</valueProcess> + <name>DuplicateObject_param</name> + <valueProcess>%aditoprj%/entity/Person_entity/entityfields/duplicates/children/duplicateobject_param/valueProcess.js</valueProcess> </entityParameter> </children> </entityConsumer> @@ -1839,7 +1837,6 @@ <additionalFieldNameAliases> <element>address</element> </additionalFieldNameAliases> - <isMultiValued v="true" /> </indexRecordFieldMapping> <indexRecordFieldMapping> <name>STANDARD_COUNTRY.value</name> @@ -1847,7 +1844,6 @@ <additionalFieldNameAliases> <element>country</element> </additionalFieldNameAliases> - <isMultiValued v="true" /> </indexRecordFieldMapping> <indexRecordFieldMapping> <name>STANDARD_ZIP.value</name> @@ -1855,7 +1851,6 @@ <additionalFieldNameAliases> <element>zip</element> </additionalFieldNameAliases> - <isMultiValued v="true" /> </indexRecordFieldMapping> <indexRecordFieldMapping> <name>STANDARD_CITY.value</name> @@ -1863,7 +1858,6 @@ <additionalFieldNameAliases> <element>city</element> </additionalFieldNameAliases> - <isMultiValued v="true" /> </indexRecordFieldMapping> <indexRecordFieldMapping> <name>STANDARD_EMAIL_COMMUNICATION.value</name> @@ -1871,7 +1865,6 @@ <additionalFieldNameAliases> <element>email</element> </additionalFieldNameAliases> - <isMultiValued v="true" /> </indexRecordFieldMapping> <indexRecordFieldMapping> <name>STANDARD_PHONE_COMMUNICATION.value</name> @@ -1879,7 +1872,6 @@ <additionalFieldNameAliases> <element>phone</element> </additionalFieldNameAliases> - <isMultiValued v="true" /> </indexRecordFieldMapping> <indexRecordFieldMapping> <name>PICTURE.value</name> diff --git a/entity/Person_entity/contentDescriptionProcess.js b/entity/Person_entity/contentDescriptionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..320b8b3df217b339d789ef3facd72960b7744c83 --- /dev/null +++ b/entity/Person_entity/contentDescriptionProcess.js @@ -0,0 +1,14 @@ +import("Util_lib"); +import("system.translate"); +import("system.datetime"); +import("system.vars"); +import("system.result"); + +//Has to be there, because the core doesn't check changes on ".displayValue" +"$field.ADDRESS_ID"; + +result.string( + StringUtils.concat(" ", [vars.get("$field.ORGANISATION_NAME"), '|', vars.get("$field.ADDRESS_ID.displayValue") + , '|', translate.text("Phone") + ":", vars.get("$field.STANDARD_PHONE_COMMUNICATION") + , '|', translate.text("Email") + ":", vars.get("$field.STANDARD_EMAIL_COMMUNICATION")]) +); \ No newline at end of file diff --git a/entity/Person_entity/entityfields/commrestrictions_active/valueProcess.js b/entity/Person_entity/entityfields/commrestrictions_active/valueProcess.js index eb0180412d1da157d1c0c7c2b6cc9de3818d508b..bcd2f1fe3f1c91768106e49fdfb0a7e6019699cb 100644 --- a/entity/Person_entity/entityfields/commrestrictions_active/valueProcess.js +++ b/entity/Person_entity/entityfields/commrestrictions_active/valueProcess.js @@ -1,3 +1,8 @@ +import("Util_lib"); +import("system.translate"); +import("Entity_lib"); +import("DuplicateScanner_lib"); +import("KeywordRegistry_basic"); import("Contact_lib"); import("system.neon"); import("system.result"); @@ -5,5 +10,38 @@ import("system.vars"); if (vars.get("$sys.viewmode") == neon.FRAME_VIEWMODE_DATASET) { - result.string(ContactUtils.getCommunicationRejectionSummary(vars.get("$field.CONTACTID"))); + var commRestrictionString = ContactUtils.getCommunicationRejectionSummary(vars.get("$field.CONTACTID")); + + var communications = vars.get("$field.Communications.insertedRows"); + + var email = communications.filter(function(object) + { + return object["MEDIUM_ID"] == $KeywordRegistry.communicationMedium$mail(); + })[0]; + + var dataObject = DuplicateScannerUtils.getDataForDuplicateCheck(EntityUtils.getCurrentEntitytId(), { + PERSON_ID: vars.get("$field.PERSON_ID"), + CONTACTID: vars.get("$field.CONTACTID"), + FIRSTNAME: vars.get("$field.FIRSTNAME"), + MIDDLENAME: vars.get("$field.MIDDLENAME"), + LASTNAME: vars.get("$field.LASTNAME"), + DATEOFBIRTH: vars.get("$field.DATEOFBIRTH"), + GENDER: vars.get("$field.GENDER"), + SALUTATION: vars.get("$field.SALUTATION"), + TITLE: vars.get("$field.TITLE"), + TITLESUFFIX: vars.get("$field.TITLESUFFIX"), + POSITION: vars.get("$field.POSITION"), + STATUS: vars.get("$field.STATUS"), + DEPARTMENT: vars.get("$field.DEPARTMENT"), + STANDARD_ADDRESS: vars.get("$field.STANDARD_ADDRESS"), + STANDARD_CITY: vars.get("$field.STANDARD_CITY"), + STANDARD_COUNTRY: vars.get("$field.STANDARD_COUNTRY"), + STANDARD_EMAIL_COMMUNICATION: vars.get("$field.STANDARD_EMAIL_COMMUNICATION") || (email ? email["ADDR"] : ""), + STANDARD_PHONE_COMMUNICATION: vars.get("$field.STANDARD_PHONE_COMMUNICATION"), + STANDARD_ZIP: vars.get("$field.STANDARD_ZIP") + })[0]; + + var duplictateString = (new DuplicateUtils(dataObject)).checkForDuplicates() ? translate.text("Duplicates have been found") : ""; + + result.string(StringUtils.concat("\n", [commRestrictionString, duplictateString])); } diff --git a/entity/Person_entity/entityfields/indexp/documentation.adoc b/entity/Person_entity/entityfields/dublicates/documentation.adoc similarity index 100% rename from entity/Person_entity/entityfields/indexp/documentation.adoc rename to entity/Person_entity/entityfields/dublicates/documentation.adoc diff --git a/entity/Person_entity/entityfields/duplicates/children/obj_param/valueProcess.js b/entity/Person_entity/entityfields/duplicates/children/duplicateobject_param/valueProcess.js similarity index 64% rename from entity/Person_entity/entityfields/duplicates/children/obj_param/valueProcess.js rename to entity/Person_entity/entityfields/duplicates/children/duplicateobject_param/valueProcess.js index 59dc755e2ab02e6af201c71f835676e5172180bc..cd2472c731ef60d9d47a3ed46c322b74444cfda1 100644 --- a/entity/Person_entity/entityfields/duplicates/children/obj_param/valueProcess.js +++ b/entity/Person_entity/entityfields/duplicates/children/duplicateobject_param/valueProcess.js @@ -1,7 +1,19 @@ +import("KeywordRegistry_basic"); +import("Entity_lib"); +import("DuplicateScanner_lib"); +import("Context_lib"); import("system.vars"); import("system.result"); -result.string(JSON.stringify({ +var communications = vars.get("$field.Communications.insertedRows"); + +var email = communications.filter(function(object) +{ + return object["MEDIUM_ID"] == $KeywordRegistry.communicationMedium$mail(); +})[0]; + +result.object(DuplicateScannerUtils.getDataForDuplicateCheck(EntityUtils.getCurrentEntitytId(), { + PERSON_ID: vars.get("$field.PERSON_ID"), CONTACTID: vars.get("$field.CONTACTID"), FIRSTNAME: vars.get("$field.FIRSTNAME"), MIDDLENAME: vars.get("$field.MIDDLENAME"), @@ -17,7 +29,7 @@ result.string(JSON.stringify({ STANDARD_ADDRESS: vars.get("$field.STANDARD_ADDRESS"), STANDARD_CITY: vars.get("$field.STANDARD_CITY"), STANDARD_COUNTRY: vars.get("$field.STANDARD_COUNTRY"), - STANDARD_EMAIL_COMMUNICATION: vars.get("$field.STANDARD_EMAIL_COMMUNICATION"), + STANDARD_EMAIL_COMMUNICATION: vars.get("$field.STANDARD_EMAIL_COMMUNICATION") || (email ? email["ADDR"] : ""), STANDARD_PHONE_COMMUNICATION: vars.get("$field.STANDARD_PHONE_COMMUNICATION"), STANDARD_ZIP: vars.get("$field.STANDARD_ZIP") -})); +})); \ No newline at end of file diff --git a/entity/Person_entity/recordcontainers/db/onDBDelete.js b/entity/Person_entity/recordcontainers/db/onDBDelete.js index bccd1c92888786d6c6388db00bacae3689906f02..4725a29f82d91bd8edc7aa3fa9b5fd6532bd4ad5 100644 --- a/entity/Person_entity/recordcontainers/db/onDBDelete.js +++ b/entity/Person_entity/recordcontainers/db/onDBDelete.js @@ -1,3 +1,4 @@ +import("Entity_lib"); import("Sql_lib"); import("Context_lib"); import("Attribute_lib"); @@ -7,7 +8,7 @@ import("DuplicateScanner_lib"); var contactId = vars.get("$field.CONTACTID"); var context = ContextUtils.getCurrentContextId(); -DuplicateScannerUtils.deleteHasDuplicateEntries("Person_entity", [contactId]); +DuplicateScannerUtils.deleteHasDuplicateEntries(EntityUtils.getCurrentEntitytId(), [contactId]); new AttributeRelationQuery(contactId, null, context) .deleteAllAttributes(); diff --git a/entity/Person_entity/recordcontainers/db/onDBInsert.js b/entity/Person_entity/recordcontainers/db/onDBInsert.js index 8d1c5ddea0bed7f36862a8423508f130794a3a07..fa395c986d10b8565f6448562f7972a279d3917b 100644 --- a/entity/Person_entity/recordcontainers/db/onDBInsert.js +++ b/entity/Person_entity/recordcontainers/db/onDBInsert.js @@ -1,3 +1,4 @@ +import("Entity_lib"); import("Workflow_lib"); import("system.util"); import("Sql_lib"); @@ -6,7 +7,7 @@ import("DataPrivacy_lib"); import("system.vars"); import("DuplicateScanner_lib"); -DuplicateScannerUtils.updateHasDuplicateEntry("Person_entity"); +DuplicateScannerUtils.updateHasDuplicateEntry(EntityUtils.getCurrentEntitytId()); //let targetEntity = "Person_entity"; let contactId = vars.get("$local.uid"); diff --git a/entity/Person_entity/recordcontainers/db/onDBUpdate.js b/entity/Person_entity/recordcontainers/db/onDBUpdate.js index 100f1f714f83179a745ab4c332591ab988c0e60b..4e38dce71a3b241f9e38318e911ed28ceb82e51b 100644 --- a/entity/Person_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/Person_entity/recordcontainers/db/onDBUpdate.js @@ -10,7 +10,7 @@ import("Entity_lib"); import("StandardObject_lib"); import("DuplicateScanner_lib"); -DuplicateScannerUtils.updateHasDuplicateEntry("Person_entity"); +DuplicateScannerUtils.updateHasDuplicateEntry(EntityUtils.getCurrentEntitytId()); var localChanged = vars.get("$local.changed"); var orgChanged = false; diff --git a/entity/Person_entity/recordcontainers/index/query.js b/entity/Person_entity/recordcontainers/index/query.js index 61ec0a66cbf788e47523eaa832bedf9fcb12e562..4d355dbeba505882d8aafc0513c446caffcd7603 100644 --- a/entity/Person_entity/recordcontainers/index/query.js +++ b/entity/Person_entity/recordcontainers/index/query.js @@ -15,6 +15,7 @@ You may want to check out if your change affects other modules. However adding m var sqlQuery, sqlHelper, queryCondition, affectedIds; var commMediumPhoneIds = CommUtil.getMediumIdsByCategory("PHONE"); +var commMediumEmailIds = CommUtil.getMediumIdsByCategory("EMAIL"); sqlHelper = new SqlMaskingUtils(); var querySelect = newSelect([ "CONTACT.CONTACTID", //#UID @@ -33,22 +34,24 @@ var querySelect = newSelect([ sqlHelper.trim("PERSON.GENDER"), "CONTACT.ORGANISATION_ID", "ORGANISATION.NAME", - "ADDRESS.ADDRESS", - "ADDRESS.COUNTRY", - "ADDRESS.ZIP", - "ADDRESS.CITY", - "COMMUNICATION.ADDR", - "PHONE.ADDR", + "defaultAddress.ADDRESS", + "defaultAddress.COUNTRY", + "defaultAddress.ZIP", + "defaultAddress.CITY", + "email.ADDR", + "phone.ADDR", "PERSON.PICTURE" ]) .from("PERSON") .join("CONTACT", "CONTACT.PERSON_ID = PERSON.PERSONID") .join("ORGANISATION", "CONTACT.ORGANISATION_ID = ORGANISATION.ORGANISATIONID") .leftJoin("ADDRESS", "defaultAddress.ADDRESSID = CONTACT.ADDRESS_ID", "defaultAddress") - .leftJoin("ADDRESS", "ADDRESS.CONTACT_ID = CONTACT.CONTACTID") - .leftJoin("COMMUNICATION", "COMMUNICATION.CONTACT_ID = CONTACT.CONTACTID") + .leftJoin("COMMUNICATION", newWhere("email.CONTACT_ID = CONTACT.CONTACTID") + .and(["COMMUNICATION", "MEDIUM_ID", "email"], commMediumEmailIds, SqlBuilder.IN()) + .and(["COMMUNICATION", "ISSTANDARD", "email"], "1"), "email") .leftJoin("COMMUNICATION", newWhere("phone.CONTACT_ID = CONTACT.CONTACTID") - .and(["COMMUNICATION", "MEDIUM_ID", "phone"], commMediumPhoneIds, SqlBuilder.IN()), "phone") + .and(["COMMUNICATION", "MEDIUM_ID", "phone"], commMediumPhoneIds, SqlBuilder.IN()) + .and(["COMMUNICATION", "ISSTANDARD", "phone"], "1"), "phone") .where("CONTACT.STATUS", $KeywordRegistry.contactStatus$inactive(), SqlBuilder.NOT_EQUAL()) diff --git a/entity/QuickEntry_entity/QuickEntry_entity.aod b/entity/QuickEntry_entity/QuickEntry_entity.aod index 6a5199461c77194181b4f53eb8cd68b2749ab65b..ca99054b94f245e5ca32d81a1ac3faa96efa57ea 100644 --- a/entity/QuickEntry_entity/QuickEntry_entity.aod +++ b/entity/QuickEntry_entity/QuickEntry_entity.aod @@ -20,24 +20,6 @@ <contentType>TEXT</contentType> <mandatoryProcess>%aditoprj%/entity/QuickEntry_entity/entityfields/organisation_name/mandatoryProcess.js</mandatoryProcess> </entityField> - <entityConsumer> - <name>Adresses</name> - <dependency> - <name>dependency</name> - <entityName>Address_entity</entityName> - <fieldName>QuickEntryAdresses</fieldName> - </dependency> - <children> - <entityParameter> - <name>ContactId_param</name> - <valueProcess>%aditoprj%/entity/QuickEntry_entity/entityfields/adresses/children/contactid_param/valueProcess.js</valueProcess> - </entityParameter> - <entityParameter> - <name>ContactType_param</name> - <valueProcess>%aditoprj%/entity/QuickEntry_entity/entityfields/adresses/children/contacttype_param/valueProcess.js</valueProcess> - </entityParameter> - </children> - </entityConsumer> <entityConsumer> <name>Communications</name> <dependency> @@ -50,10 +32,6 @@ <name>ContactId_param</name> <valueProcess>%aditoprj%/entity/QuickEntry_entity/entityfields/communications/children/contactid_param/valueProcess.js</valueProcess> </entityParameter> - <entityParameter> - <name>AdditionalContactIds_param</name> - <valueProcess>%aditoprj%/entity/QuickEntry_entity/entityfields/communications/children/additionalcontactids_param/valueProcess.js</valueProcess> - </entityParameter> </children> </entityConsumer> <entityConsumer> @@ -64,34 +42,6 @@ <fieldName>ISO3Name</fieldName> </dependency> </entityConsumer> - <entityField> - <name>FIRSTNAME</name> - <title>Firstname</title> - </entityField> - <entityField> - <name>LASTNAME</name> - <title>Lastname</title> - <mandatoryProcess>%aditoprj%/entity/QuickEntry_entity/entityfields/lastname/mandatoryProcess.js</mandatoryProcess> - </entityField> - <entityField> - <name>PERSON_TITLE</name> - <title>Title</title> - <consumer>SalutationTitles</consumer> - </entityField> - <entityField> - <name>PERSON_SALUTATION</name> - <title>Salutation</title> - <consumer>Salutations</consumer> - <mandatoryProcess>%aditoprj%/entity/QuickEntry_entity/entityfields/person_salutation/mandatoryProcess.js</mandatoryProcess> - </entityField> - <entityField> - <name>PERSON_CONTACT_ID</name> - <valueProcess>%aditoprj%/entity/QuickEntry_entity/entityfields/person_contact_id/valueProcess.js</valueProcess> - </entityField> - <entityField> - <name>PERSON_ID</name> - <valueProcess>%aditoprj%/entity/QuickEntry_entity/entityfields/person_id/valueProcess.js</valueProcess> - </entityField> <entityConsumer> <name>Salutations</name> <dependency> @@ -106,24 +56,6 @@ </entityParameter> </children> </entityConsumer> - <entityConsumer> - <name>SalutationTitles</name> - <dependency> - <name>dependency</name> - <entityName>SalutationTitleDistinct_entity</entityName> - <fieldName>SalutationTitles</fieldName> - </dependency> - <children> - <entityParameter> - <name>Language_param</name> - <valueProcess>%aditoprj%/entity/QuickEntry_entity/entityfields/salutationtitles/children/language_param/valueProcess.js</valueProcess> - </entityParameter> - <entityParameter> - <name>Salutation_param</name> - <valueProcess>%aditoprj%/entity/QuickEntry_entity/entityfields/salutationtitles/children/salutation_param/valueProcess.js</valueProcess> - </entityParameter> - </children> - </entityConsumer> <entityConsumer> <name>Contacts</name> <dependency> @@ -232,25 +164,6 @@ <element>PROCESS_SETVALUE</element> </onValueChangeTypes> </entityField> - <entityConsumer> - <name>OrgAndPersDuplicates</name> - <dependency> - <name>dependency</name> - <entityName>AnyContact_entity</entityName> - <fieldName>ContactsByIds</fieldName> - </dependency> - <children> - <entityParameter> - <name>ContactIds_param</name> - <valueProcess>%aditoprj%/entity/QuickEntry_entity/entityfields/organdpersduplicates/children/contactids_param/valueProcess.js</valueProcess> - <documentation>%aditoprj%/entity/QuickEntry_entity/entityfields/organdpersduplicates/children/contactids_param/documentation.adoc</documentation> - </entityParameter> - <entityParameter> - <name>WithPrivatePersons_param</name> - <valueProcess>%aditoprj%/entity/QuickEntry_entity/entityfields/organdpersduplicates/children/withprivatepersons_param/valueProcess.js</valueProcess> - </entityParameter> - </children> - </entityConsumer> <entityProvider> <name>#PROVIDER_AGGREGATES</name> <useAggregates v="true" /> @@ -262,6 +175,20 @@ <state>INVISIBLE</state> <stateProcess>%aditoprj%/entity/QuickEntry_entity/entityfields/businesscardlanguage/stateProcess.js</stateProcess> </entityField> + <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/QuickEntry_entity/entityfields/duplicates/children/duplicateobject_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> </entityFields> <recordContainers> <jDitoRecordContainer> @@ -288,24 +215,6 @@ <jDitoRecordFieldMapping> <name>ORGANISATION_ID.value</name> </jDitoRecordFieldMapping> - <jDitoRecordFieldMapping> - <name>PERSON_ID.value</name> - </jDitoRecordFieldMapping> - <jDitoRecordFieldMapping> - <name>PERSON_CONTACT_ID.value</name> - </jDitoRecordFieldMapping> - <jDitoRecordFieldMapping> - <name>FIRSTNAME.value</name> - </jDitoRecordFieldMapping> - <jDitoRecordFieldMapping> - <name>LASTNAME.value</name> - </jDitoRecordFieldMapping> - <jDitoRecordFieldMapping> - <name>PERSON_SALUTATION.value</name> - </jDitoRecordFieldMapping> - <jDitoRecordFieldMapping> - <name>PERSON_TITLE.value</name> - </jDitoRecordFieldMapping> </recordFieldMappings> </jDitoRecordContainer> </recordContainers> diff --git a/entity/QuickEntry_entity/entityfields/activities/children/insertlinks_param/valueProcess.js b/entity/QuickEntry_entity/entityfields/activities/children/insertlinks_param/valueProcess.js index 3f6e93c8d5f4cc6891f50a7cad1de4c637738234..76ee601221a132251a757cf24f23198750c0eacc 100644 --- a/entity/QuickEntry_entity/entityfields/activities/children/insertlinks_param/valueProcess.js +++ b/entity/QuickEntry_entity/entityfields/activities/children/insertlinks_param/valueProcess.js @@ -4,14 +4,10 @@ import("system.result"); var links = [ ["Organisation", vars.get("$field.UID")] ]; -if(vars.get("$field.LASTNAME")) { - links.push(["Person", vars.get("$field.PERSON_CONTACT_ID")]); -} - //TODO: verify if only insertedRows are really relevant var contactLinks = vars.get("$field.Contacts.insertedRows").map(function (row) { return ["Person", row["CONTACTID"]]; }); -result.string(JSON.stringify(links.concat(contactLinks))); +result.string(JSON.stringify(links.concat(contactLinks))); \ No newline at end of file diff --git a/entity/QuickEntry_entity/entityfields/adresses/children/contactid_param/valueProcess.js b/entity/QuickEntry_entity/entityfields/adresses/children/contactid_param/valueProcess.js deleted file mode 100644 index 2877ad1ea1fcdb1d5a46d47ff08d284e05bc24ec..0000000000000000000000000000000000000000 --- a/entity/QuickEntry_entity/entityfields/adresses/children/contactid_param/valueProcess.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.vars"); -import("system.result"); - -result.string(vars.get("$field.PERSON_CONTACT_ID")); \ No newline at end of file diff --git a/entity/QuickEntry_entity/entityfields/adresses/children/contacttype_param/valueProcess.js b/entity/QuickEntry_entity/entityfields/adresses/children/contacttype_param/valueProcess.js deleted file mode 100644 index faf071cb37406c18f8b28a432547bcca7fc855c3..0000000000000000000000000000000000000000 --- a/entity/QuickEntry_entity/entityfields/adresses/children/contacttype_param/valueProcess.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.result"); -import("Contact_lib"); - -result.object(Contact.TYPES.Contact); \ No newline at end of file diff --git a/entity/QuickEntry_entity/entityfields/communications/children/additionalcontactids_param/valueProcess.js b/entity/QuickEntry_entity/entityfields/communications/children/additionalcontactids_param/valueProcess.js deleted file mode 100644 index d7fec8efe9bba23f2a5978cfa6e4d8c5c6e04603..0000000000000000000000000000000000000000 --- a/entity/QuickEntry_entity/entityfields/communications/children/additionalcontactids_param/valueProcess.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.vars"); -import("system.result"); - -result.string(JSON.stringify([vars.get("$field.PERSON_CONTACT_ID")])); diff --git a/entity/QuickEntry_entity/entityfields/duplicates/children/duplicateobject_param/valueProcess.js b/entity/QuickEntry_entity/entityfields/duplicates/children/duplicateobject_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..d05c76613d31e7738887e5a76eaafd0ee05b39af --- /dev/null +++ b/entity/QuickEntry_entity/entityfields/duplicates/children/duplicateobject_param/valueProcess.js @@ -0,0 +1,24 @@ +import("DuplicateScanner_lib"); +import("Context_lib"); +import("system.vars"); +import("system.result"); + +var duplicateScans = []; + +var firstOrganisationAddress = vars.get("$field.OrgAddresses.insertedRows") ? vars.get("$field.OrgAddresses.insertedRows")[0] : null; +var organisationPattern = DuplicateScannerUtils.getDataForDuplicateCheck("Organisation_entity", { + "CONTACTID" : vars.get("$field.UID"), + "NAME" : vars.get("$field.ORGANISATION_NAME"), + "STANDARD_CITY" : firstOrganisationAddress ? firstOrganisationAddress["CITY"] : "", + "STANDARD_ZIP" : firstOrganisationAddress ? firstOrganisationAddress["ZIP"] : "", + "STANDARD_ADDRESS" : firstOrganisationAddress ? firstOrganisationAddress["ADDRESS"] : "" +}); + +duplicateScans = duplicateScans.concat(organisationPattern); + +vars.get("$field.Contacts.insertedRows").forEach(function(contact) +{ + duplicateScans = duplicateScans.concat(DuplicateScannerUtils.getDataForDuplicateCheck("Person_entity", contact)); +}); + +result.object(duplicateScans); \ No newline at end of file diff --git a/entity/QuickEntry_entity/entityfields/lastname/mandatoryProcess.js b/entity/QuickEntry_entity/entityfields/lastname/mandatoryProcess.js deleted file mode 100644 index c5a419766d570f6091355c47f0362d476d2a4c71..0000000000000000000000000000000000000000 --- a/entity/QuickEntry_entity/entityfields/lastname/mandatoryProcess.js +++ /dev/null @@ -1,10 +0,0 @@ -import("system.logging"); -import("system.result"); -import("system.vars"); - -var insertedRows = vars.get("$field.Adresses.insertedRows"); -var isInserted = insertedRows.some(function (row){ - return row["ZIP"] || row["CITY"] || row["ADDRESS"]; -}) - -result.string(isInserted); \ No newline at end of file diff --git a/entity/QuickEntry_entity/entityfields/leadquickacquisition/onValueChange.js b/entity/QuickEntry_entity/entityfields/leadquickacquisition/onValueChange.js index c76bdbc402bb0c14ec2e2c0e5c61a33f067c3ba1..3d17822155cd8234b60047bfc4c8c2ec651aee7b 100644 --- a/entity/QuickEntry_entity/entityfields/leadquickacquisition/onValueChange.js +++ b/entity/QuickEntry_entity/entityfields/leadquickacquisition/onValueChange.js @@ -22,6 +22,7 @@ if(vars.get("$local.value")) { EntityConsumerUtils.rmInsertedConsumerRows("OrgAddresses"); EntityConsumerUtils.rmInsertedConsumerRows("Communications"); + EntityConsumerUtils.rmInsertedConsumerRows("Contacts"); //Filling necessary fields for company address var addressFields = { @@ -76,11 +77,15 @@ if(vars.get("$local.value")) "ADDR" : _formatLinkaddress(response.website) }); } - - //Filling optional fields for personal details e.g. firstname, lastname.. - if(response.title) neon.setFieldValue("$field.PERSON_TITLE", response.title); - if(response.firstName) neon.setFieldValue("$field.FIRSTNAME", response.firstName); - if(response.lastName) neon.setFieldValue("$field.LASTNAME", response.lastName); + + if(response.title || response.firstName || response.lastName) + { + neon.addRecord("Contacts", { + "FIRSTNAME" : response.firstName, + "LASTNAME" : response.lastName, + "TITLE" : response.title + }); + } } } diff --git a/entity/QuickEntry_entity/entityfields/organdpersduplicates/children/contactids_param/documentation.adoc b/entity/QuickEntry_entity/entityfields/organdpersduplicates/children/contactids_param/documentation.adoc deleted file mode 100644 index 667cdd59e70d81d319b110ff44e24478616dae1d..0000000000000000000000000000000000000000 --- a/entity/QuickEntry_entity/entityfields/organdpersduplicates/children/contactids_param/documentation.adoc +++ /dev/null @@ -1,2 +0,0 @@ -returns a list of duplicate ids -the index will be searched via the values entered in the edit frame \ No newline at end of file diff --git a/entity/QuickEntry_entity/entityfields/organdpersduplicates/children/contactids_param/valueProcess.js b/entity/QuickEntry_entity/entityfields/organdpersduplicates/children/contactids_param/valueProcess.js deleted file mode 100644 index 98b27caa01f480c5b39a7c62f68970a13519812b..0000000000000000000000000000000000000000 --- a/entity/QuickEntry_entity/entityfields/organdpersduplicates/children/contactids_param/valueProcess.js +++ /dev/null @@ -1,76 +0,0 @@ -import("system.indexsearch"); -import("system.vars"); -import("DuplicateScanner_lib"); -import("system.result"); -import("IndexSearch_lib"); - -//trigger refresh -vars.get("$field.FIRSTNAME"); -vars.get("$field.LASTNAME"); - -var uid = vars.get("$field.UID"); -var idsForEmptyResult = JSON.stringify(["nodata"]); -var duplicateScans = []; - -duplicateScans.push(["Person_entity", {"CONTACTID" : uid}]); - -vars.get("$field.Contacts.insertedRows").forEach(function (contact) -{ - duplicateScans.push(["Person_entity", contact]); -}); - -var organisationName = vars.get("$field.ORGANISATION_NAME"); -//although the standard address is not set at this point, it can be assumed that it will be the first one -var firstOrganisationAddress = vars.get("$field.OrgAddresses.insertedRows")[0]; -if (organisationName || firstOrganisationAddress) -{ - var city = null; - var zipCode = null; - var address = null; - - if (firstOrganisationAddress) - { - city = firstOrganisationAddress["CITY"]; - zipCode = firstOrganisationAddress["ZIP"]; - address = firstOrganisationAddress["ADDRESS"]; - } - - duplicateScans.push(["Organisation_entity", { - "CONTACTID" : uid, - "NAME" : organisationName, - "STANDARD_CITY" : city, - "STANDARD_ZIP" : zipCode, - "STANDARD_ADDRESS" : address - }]); -} - -var duplicates = duplicateScans.reduce(function (duplicateArr, [entity, fieldValues]) -{ - return duplicateArr.concat(_getDuplicates(entity, fieldValues)); -}, []); - -if (duplicates.length === 0) - result.string(idsForEmptyResult); -else - result.string(JSON.stringify(duplicates)); - - -function _getDuplicates(pEntity, pEntityFieldValues) -{ - var scanner = DuplicateScannerUtils.getScannerByEntity(pEntity); - var indexsearchFilter = IndexsearchFilterUtils.fromFilter(scanner.filter); - var entityFields = indexsearchFilter.getFields(); - entityFields.add(scanner.idField); - - var valuesToCheck = {}; - entityFields.forEach(function(field) { - var fieldValue = field in pEntityFieldValues - ? pEntityFieldValues[field] - : vars.exists("$field." + field) ? vars.get("$field." + field) : ""; - valuesToCheck[field] = fieldValue || ""; - }); - - var indexPattern = indexsearchFilter.buildQuery(valuesToCheck); - var duplicateIds = DuplicateScannerUtils.getDuplicateIds(pEntity, indexPattern, valuesToCheck[scanner.idField]); - return DuplicateScannerUtils.filterIgnored(pEntity, valuesToCheck[scanner.idField], duplicateIds); -} diff --git a/entity/QuickEntry_entity/entityfields/organdpersduplicates/children/withprivatepersons_param/valueProcess.js b/entity/QuickEntry_entity/entityfields/organdpersduplicates/children/withprivatepersons_param/valueProcess.js deleted file mode 100644 index 40effa0178464da0c7850912345f19c7fa95975a..0000000000000000000000000000000000000000 --- a/entity/QuickEntry_entity/entityfields/organdpersduplicates/children/withprivatepersons_param/valueProcess.js +++ /dev/null @@ -1,3 +0,0 @@ -import("system.result"); - -result.string(true); \ No newline at end of file diff --git a/entity/QuickEntry_entity/entityfields/person_contact_id/valueProcess.js b/entity/QuickEntry_entity/entityfields/person_contact_id/valueProcess.js deleted file mode 100644 index 663cf5f6581f5cfd96408a4a7b7109550cbf0ff4..0000000000000000000000000000000000000000 --- a/entity/QuickEntry_entity/entityfields/person_contact_id/valueProcess.js +++ /dev/null @@ -1,9 +0,0 @@ -import("system.neon"); -import("system.vars"); -import("system.util"); -import("system.result"); - -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) -{ - result.string(util.getNewUUID()); -} \ No newline at end of file diff --git a/entity/QuickEntry_entity/entityfields/person_id/valueProcess.js b/entity/QuickEntry_entity/entityfields/person_id/valueProcess.js deleted file mode 100644 index 363f6bcdd85145923d42471b7c2ca6fddcc3b602..0000000000000000000000000000000000000000 --- a/entity/QuickEntry_entity/entityfields/person_id/valueProcess.js +++ /dev/null @@ -1,10 +0,0 @@ -import("system.neon"); -import("system.vars"); -import("system.util"); -import("system.result"); - -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) -{ - result.string(util.getNewUUID()); -} - \ No newline at end of file diff --git a/entity/QuickEntry_entity/entityfields/person_salutation/mandatoryProcess.js b/entity/QuickEntry_entity/entityfields/person_salutation/mandatoryProcess.js deleted file mode 100644 index 612c7e81d16e51455c5f693c1f4a58579a2b0548..0000000000000000000000000000000000000000 --- a/entity/QuickEntry_entity/entityfields/person_salutation/mandatoryProcess.js +++ /dev/null @@ -1,15 +0,0 @@ -import("system.logging"); -import("system.result"); -import("system.vars"); - -var isMandatory = false; -if (vars.get("$field.LASTNAME") != "") - isMandatory = true; -else { - var insertedRows = vars.get("$field.Adresses.insertedRows");//this is the list of person contact addresses - isMandatory = insertedRows.some(function (row){ - return row["ZIP"] || row["CITY"] || row["ADDRESS"]; - }); -} - -result.string(isMandatory); \ No newline at end of file diff --git a/entity/QuickEntry_entity/entityfields/salutationtitles/children/language_param/valueProcess.js b/entity/QuickEntry_entity/entityfields/salutationtitles/children/language_param/valueProcess.js deleted file mode 100644 index 158526c7631aadeb6d39f34ed5dbe8950606cfe6..0000000000000000000000000000000000000000 --- a/entity/QuickEntry_entity/entityfields/salutationtitles/children/language_param/valueProcess.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.vars"); -import("system.result"); - -result.string(vars.get("$field.ISOLANGUAGE")) \ No newline at end of file diff --git a/entity/QuickEntry_entity/entityfields/salutationtitles/children/salutation_param/valueProcess.js b/entity/QuickEntry_entity/entityfields/salutationtitles/children/salutation_param/valueProcess.js deleted file mode 100644 index ed8925532624361a17d09f6a3620e2931de11301..0000000000000000000000000000000000000000 --- a/entity/QuickEntry_entity/entityfields/salutationtitles/children/salutation_param/valueProcess.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.vars"); -import("system.result"); - -result.string(vars.get("$field.PERSON_SALUTATION")) \ No newline at end of file diff --git a/entity/QuickEntry_entity/onValidation.js b/entity/QuickEntry_entity/onValidation.js index f07afb72e603362f0fe819df18d95d48cb79920d..15fb073ad33e678a8d3320d6473b43e573661ac3 100644 --- a/entity/QuickEntry_entity/onValidation.js +++ b/entity/QuickEntry_entity/onValidation.js @@ -2,5 +2,10 @@ import("system.translate"); import("system.result"); import("system.vars"); -if (!vars.get("$field.ORGANISATION_NAME") && !vars.get("$field.LASTNAME")) +var isMandatory = vars.get("$field.Contacts.insertedRows").some(function (row) +{ + return row["LASTNAME"] != null; +}); + +if (!vars.get("$field.ORGANISATION_NAME") && !isMandatory) result.string(translate.text("Either or both a contact and a company must be specified")); \ No newline at end of file diff --git a/entity/QuickEntry_entity/recordcontainers/jdito/contentProcess.js b/entity/QuickEntry_entity/recordcontainers/jdito/contentProcess.js index e9868a67143e4ea0f02124b70e1641af0af265e6..a62784a560899263afcf44b72846e04f1edb3331 100644 --- a/entity/QuickEntry_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/QuickEntry_entity/recordcontainers/jdito/contentProcess.js @@ -4,6 +4,6 @@ import("system.vars"); //TODO: This dummy implementation shouldn't be nescessary here. Remove this process eventually. #1051003 var rows = []; if (vars.get("$local.idvalues")) - rows = vars.get("$local.idvalues").map(function (id) {return [id, "", "", "", "", "", "", "", "", "", "", ""];}); + rows = vars.get("$local.idvalues").map(function (id) {return [id, "", "", "", "", ""];}); result.object(rows); \ No newline at end of file diff --git a/entity/QuickEntry_entity/recordcontainers/jdito/onInsert.js b/entity/QuickEntry_entity/recordcontainers/jdito/onInsert.js index 2d6cc1010d480929d0c3320e74eadbce2758f398..bd04d8dc2610a9f4b8621bad66d42f252bf2980b 100644 --- a/entity/QuickEntry_entity/recordcontainers/jdito/onInsert.js +++ b/entity/QuickEntry_entity/recordcontainers/jdito/onInsert.js @@ -30,34 +30,4 @@ if (rowdata["ORGANISATION_NAME.value"]) }); entities.createRow(configOrg); -} - -if (rowdata["LASTNAME.value"]) -{ - let gender = newSelect("SEX") - .from("SALUTATION") - .whereIfSet("SALUTATION.SALUTATION", rowdata["PERSON_SALUTATION.value"]) - .cell(true); - - let configPer = entities.createConfigForAddingRows(); - configPer.entity("Person_entity"); - configPer.fieldValues({ - "PERSON_ID" : rowdata["PERSON_ID.value"], - "PERSONID": rowdata["PERSON_ID.value"], - "FIRSTNAME": rowdata["FIRSTNAME.value"] || "", - "LASTNAME" : rowdata["LASTNAME.value"], - "SALUTATION": rowdata["PERSON_SALUTATION.value"] || "", - "TITLE": rowdata["PERSON_TITLE.value"] || "", - "GENDER": gender, - "USER_NEW": userNew, - "DATE_NEW": dateNew, - "USER_NEW_CONTACT": userNew, - "DATE_NEW_CONTACT" : dateNew, - "CONTACTID": rowdata["PERSON_CONTACT_ID.value"], - "ORGANISATION_ID": organisationId, - "STATUS" : $KeywordRegistry.contactStatus$active(), - "LANGUAGE": rowdata["ISOLANGUAGE.value"] - }); - - entities.createRow(configPer); } \ No newline at end of file diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod index 80d9d835e16634f9200da488eeb31cc8a02692df..c4203f75a400e9dcabf7c4e2a109c86cbcff3718 100644 --- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod +++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod @@ -9190,54 +9190,6 @@ <entry> <key>Landingpage</key> </entry> - <entry> - <key>The chosen attributes were successfully set for %0 %1</key> - </entry> - <entry> - <key>SerialLetter</key> - </entry> - <entry> - <key>Bulkmail</key> - </entry> - <entry> - <key>%0 recipient will be added to the serial letter.</key> - </entry> - <entry> - <key>The attribute \"%0\" couldn't be set for %1 %2, because %3.</key> - </entry> - <entry> - <key>the max amount of this attribute has been reached</key> - </entry> - <entry> - <key>set attribute (use filter result)</key> - </entry> - <entry> - <key>The chosen attribute was successfully set for %0 %1</key> - </entry> - <entry> - <key>Volume (Euro)</key> - </entry> - <entry> - <key>add Attributes</key> - </entry> - <entry> - <key>%0 recipient will be added to the bulk mail.</key> - </entry> - <entry> - <key>Attribute \"%0\" can only be inserted once with the same value.</key> - </entry> - <entry> - <key>Set attribute (use filter result)</key> - </entry> - <entry> - <key>set attribute (selected data)</key> - </entry> - <entry> - <key>affected rows:</key> - </entry> - <entry> - <key>this attribute with the same value exists already</key> - </entry> <entry> <key>Do you really want to delete all usages of \"%0\"?</key> </entry> @@ -9277,6 +9229,18 @@ <entry> <key>increase Priority</key> </entry> + <entry> + <key>Integrate opened dataset into selected dataset</key> + </entry> + <entry> + <key>Integrate selected dataset into opened dataset</key> + </entry> + <entry> + <key>increase priority</key> + </entry> + <entry> + <key>Weekly</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> <sqlModels> diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod index 5c02bbd97efdf850f5ac1134f3a1dc1e76f36523..cdfd21101f4c89e2b20d028f0c7844407f133cac 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -7816,8 +7816,8 @@ <value>Brief exportieren</value> </entry> <entry> - <key>Integrate current into selected contact</key> - <value>Aktuellen Datensatz in selektierten integrieren</value> + <key>Integrate opened dataset into selected dataset</key> + <value>Integriere geöffneten Datensatz in unten ausgewählten Datensatz</value> </entry> <entry> <key>Duplicates</key> @@ -7856,8 +7856,8 @@ <value>Dublettenaktionen</value> </entry> <entry> - <key>Integrate selected into current contact</key> - <value>Integriere ausgewählten in aktuellen Kontakt</value> + <key>Integrate selected dataset into opened dataset</key> + <value>Integriere unten ausgewählten Datensatz in geöffneten Datensatz</value> </entry> <entry> <key>Unrelated organisations duplicates</key> @@ -11323,7 +11323,7 @@ Bitte Datumseingabe prüfen</value> </entry> <entry> <key>The duplicate row corrosponding to %0 has been rebuild</key> - <value>Die Dupletten des %0 filters wurden neu berechnet</value> + <value>Der Dublettenfilter %0 wurde neu berechnet</value> </entry> <entry> <key>HTML Editor</key> @@ -12052,9 +12052,6 @@ Bitte Datumseingabe prüfen</value> <key>Due on</key> <value>Fällig am</value> </entry> - <entry> - <key>set attribute (use filter result)</key> - </entry> <entry> <key>Weekly</key> </entry> @@ -12066,6 +12063,15 @@ Bitte Datumseingabe prüfen</value> <key>Confirmation dialog</key> <value>Bestätigungsdialog</value> </entry> + <entry> + <key>Integrate current into selected contact</key> + </entry> + <entry> + <key>Integrate selected into current contact</key> + </entry> + <entry> + <key>increase Priority</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> </language> diff --git a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod index 177c0df254417d084c327dcc2c897da6a697bead..017c7479e64d8bf1deaccf96b3a4d2ddb4e319f0 100644 --- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod +++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod @@ -9278,27 +9278,6 @@ <entry> <key>Landingpage</key> </entry> - <entry> - <key>SerialLetter</key> - </entry> - <entry> - <key>Bulkmail</key> - </entry> - <entry> - <key>%0 recipient will be added to the serial letter.</key> - </entry> - <entry> - <key>Volume (Euro)</key> - </entry> - <entry> - <key>%0 recipient will be added to the bulk mail.</key> - </entry> - <entry> - <key>Attribute \"%0\" can only be inserted once with the same value.</key> - </entry> - <entry> - <key>Set attribute (use filter result)</key> - </entry> <entry> <key>Do you really want to delete all usages of \"%0\"?</key> </entry> @@ -9338,6 +9317,18 @@ <entry> <key>increase Priority</key> </entry> + <entry> + <key>Integrate opened dataset into selected dataset</key> + </entry> + <entry> + <key>Integrate selected dataset into opened dataset</key> + </entry> + <entry> + <key>increase priority</key> + </entry> + <entry> + <key>Weekly</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> </language> diff --git a/neonContext/Duplicate/Duplicate.aod b/neonContext/Duplicate/Duplicate.aod new file mode 100644 index 0000000000000000000000000000000000000000..0dbb722145b3a94459fdc64a757709eaf055b044 --- /dev/null +++ b/neonContext/Duplicate/Duplicate.aod @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<neonContext xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.1"> + <name>Duplicate</name> + <title>Duplicate</title> + <majorModelMode>DISTRIBUTED</majorModelMode> + <filterView>DuplicateFilter_view</filterView> + <editView>DuplicateEdit_view</editView> + <entity>Duplicate_entity</entity> + <references> + <neonViewReference> + <name>11c51417-d966-489f-974d-936236bbebed</name> + <view>DuplicateFilter_view</view> + </neonViewReference> + <neonViewReference> + <name>c121512b-1930-4b19-b716-e3e36f548764</name> + <view>DuplicateEdit_view</view> + </neonViewReference> + </references> +</neonContext> diff --git a/neonContext/DuplicateOrganisation/DuplicateOrganisation.aod b/neonContext/DuplicateOrganisation/DuplicateOrganisation.aod deleted file mode 100644 index d3cfec52aa9ea9b895eec795511a40b216c40de5..0000000000000000000000000000000000000000 --- a/neonContext/DuplicateOrganisation/DuplicateOrganisation.aod +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<neonContext xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.1"> - <name>DuplicateOrganisation</name> - <majorModelMode>DISTRIBUTED</majorModelMode> - <previewView>DuplicateOrganisationPreview_view</previewView> - <entity>DuplicateOrganisation_entity</entity> - <references> - <neonViewReference> - <name>c62620c2-33e3-4b76-bd76-0c1be1d516eb</name> - <view>DuplicateOrganisationFilter_view</view> - </neonViewReference> - <neonViewReference> - <name>512ef5c4-dc95-4ef1-81e0-d45479249c2e</name> - <view>DuplicateOrganisationEdit_view</view> - </neonViewReference> - <neonViewReference> - <name>2e59d859-6b5f-4bb5-a47b-1225164140ed</name> - <view>DuplicateOrganisationPreview_view</view> - </neonViewReference> - </references> -</neonContext> diff --git a/neonContext/DuplicatePerson/DuplicatePerson.aod b/neonContext/DuplicatePerson/DuplicatePerson.aod deleted file mode 100644 index a30cb53a7df1f4e8fd274399a08d9911a870e3c4..0000000000000000000000000000000000000000 --- a/neonContext/DuplicatePerson/DuplicatePerson.aod +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<neonContext xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.1"> - <name>DuplicatePerson</name> - <majorModelMode>DISTRIBUTED</majorModelMode> - <previewView>DuplicatePersonPreview_view</previewView> - <entity>DuplicatePerson_entity</entity> - <references> - <neonViewReference> - <name>930c8a65-e92e-4222-9ca7-cbc663ebf274</name> - <view>DuplicatePersonFilter_view</view> - </neonViewReference> - <neonViewReference> - <name>f54e544a-2279-41ec-a7b3-44e11989a736</name> - <view>DuplicatePersonEdit_view</view> - </neonViewReference> - <neonViewReference> - <name>596cd813-22e1-4ba6-96d5-fefefbb800cf</name> - <view>DuplicatePersonPreview_view</view> - </neonViewReference> - </references> -</neonContext> diff --git a/neonContext/QuickEntry/QuickEntry.aod b/neonContext/QuickEntry/QuickEntry.aod index c44db52e95254828433ff4928cda968192ca8872..34f26b4de659f8dee1a76e31aa33e1e38b1cf0a9 100644 --- a/neonContext/QuickEntry/QuickEntry.aod +++ b/neonContext/QuickEntry/QuickEntry.aod @@ -10,5 +10,8 @@ <name>43a3acbb-82a7-4d86-88f9-0e4265e4898d</name> <view>QuickEntryEdit_view</view> </neonViewReference> + <neonViewReference> + <name>916f4d61-c19e-4950-b765-7dc8f0b95869</name> + </neonViewReference> </references> </neonContext> diff --git a/neonView/ContactEdit_view/ContactEdit_view.aod b/neonView/ContactEdit_view/ContactEdit_view.aod index a460b7add1301bd49b87700ff88c9dc57a8901b1..847a2ac832955add337ebcb6c706d5ac1ef1c3c0 100644 --- a/neonView/ContactEdit_view/ContactEdit_view.aod +++ b/neonView/ContactEdit_view/ContactEdit_view.aod @@ -3,11 +3,17 @@ <name>ContactEdit_view</name> <majorModelMode>DISTRIBUTED</majorModelMode> <layout> - <boxLayout> + <headerFooterLayout> <name>layout</name> - </boxLayout> + <header>725b2d01-22cf-4a41-9bb9-c402fad9f29b</header> + </headerFooterLayout> </layout> <children> + <neonViewReference> + <name>725b2d01-22cf-4a41-9bb9-c402fad9f29b</name> + <entityField>Duplicates</entityField> + <view>DuplicateEdit_view</view> + </neonViewReference> <genericViewTemplate> <name>Edit</name> <editMode v="true" /> diff --git a/neonView/DuplicateEdit_view/DuplicateEdit_view.aod b/neonView/DuplicateEdit_view/DuplicateEdit_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..79456c94d038849e55bda8de97c6d869251cfe0f --- /dev/null +++ b/neonView/DuplicateEdit_view/DuplicateEdit_view.aod @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.8" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.8"> + <name>DuplicateEdit_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <noneLayout> + <name>layout</name> + </noneLayout> + </layout> + <children> + <tableViewTemplate> + <name>table</name> + <hideActions v="true" /> + <isCreatable v="false" /> + <isDeletable v="false" /> + <isEditable v="false" /> + <columns> + <neonTableColumn> + <name>aa8e55ef-4b77-437d-9acd-81387bc9de16</name> + <entityField>ICON</entityField> + </neonTableColumn> + <neonTableColumn> + <name>8db7a65f-278f-4e8e-aa56-68add5efa18e</name> + <entityField>TITLE</entityField> + </neonTableColumn> + <neonTableColumn> + <name>1b408537-6259-48cd-86ce-425cb08875ca</name> + <entityField>DESCRIPTION</entityField> + </neonTableColumn> + </columns> + </tableViewTemplate> + </children> +</neonView> diff --git a/neonView/DuplicateFilter_view/DuplicateFilter_view.aod b/neonView/DuplicateFilter_view/DuplicateFilter_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..22378b9ccebfb17e396f54e668aae3a9127c87a4 --- /dev/null +++ b/neonView/DuplicateFilter_view/DuplicateFilter_view.aod @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.8" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.8"> + <name>DuplicateFilter_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <filterable v="true" /> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <tableViewTemplate> + <name>table</name> + <favoriteActionGroup1>filterActions</favoriteActionGroup1> + <linkedColumns> + <element>TITLE</element> + </linkedColumns> + <columns> + <neonTableColumn> + <name>aa8e55ef-4b77-437d-9acd-81387bc9de16</name> + <entityField>ICON</entityField> + </neonTableColumn> + <neonTableColumn> + <name>2f20521a-fe8d-4b81-b654-48c962195cce</name> + <entityField>ISDUPLICATE</entityField> + </neonTableColumn> + <neonTableColumn> + <name>8db7a65f-278f-4e8e-aa56-68add5efa18e</name> + <entityField>TITLE</entityField> + </neonTableColumn> + <neonTableColumn> + <name>1b408537-6259-48cd-86ce-425cb08875ca</name> + <entityField>DESCRIPTION</entityField> + </neonTableColumn> + </columns> + </tableViewTemplate> + </children> +</neonView> diff --git a/neonView/DuplicateOrganisationEdit_view/DuplicateOrganisationEdit_view.aod b/neonView/DuplicateOrganisationEdit_view/DuplicateOrganisationEdit_view.aod deleted file mode 100644 index a2d93541e4f43880901a1cf4e3caad407d2b8ea1..0000000000000000000000000000000000000000 --- a/neonView/DuplicateOrganisationEdit_view/DuplicateOrganisationEdit_view.aod +++ /dev/null @@ -1,49 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.8" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.8"> - <name>DuplicateOrganisationEdit_view</name> - <majorModelMode>DISTRIBUTED</majorModelMode> - <layout> - <noneLayout> - <name>layout</name> - </noneLayout> - </layout> - <children> - <tableViewTemplate> - <name>table</name> - <hideActions v="true" /> - <isCreatable v="false" /> - <isDeletable v="false" /> - <isEditable v="false" /> - <columns> - <neonTableColumn> - <name>7cb9aa93-5aa1-4f52-a2a0-32723919af08</name> - <entityField>ORGNAME</entityField> - </neonTableColumn> - <neonTableColumn> - <name>683fa228-8853-4def-b904-c10222136aec</name> - <entityField>STATUS</entityField> - </neonTableColumn> - <neonTableColumn> - <name>bb6ddf6b-aa09-4b5b-814a-ae5ebf08a48a</name> - <entityField>CUSTOMERCODE</entityField> - </neonTableColumn> - <neonTableColumn> - <name>a1630a4a-9989-4e9b-bb39-03a8432aef3f</name> - <entityField>TYPE</entityField> - </neonTableColumn> - <neonTableColumn> - <name>6295ed5c-35a8-4238-921e-65e29141883f</name> - <entityField>STANDARD_EMAIL_COMMUNICATION</entityField> - </neonTableColumn> - <neonTableColumn> - <name>d6716d9e-19b7-4d2f-b7a9-61d0e3ef3ac5</name> - <entityField>STANDARD_PHONE_COMMUNICATION</entityField> - </neonTableColumn> - <neonTableColumn> - <name>334a97a3-cad3-4ac5-b670-de7d587e2781</name> - <entityField>STANDARD_ADDRESS</entityField> - </neonTableColumn> - </columns> - </tableViewTemplate> - </children> -</neonView> diff --git a/neonView/DuplicateOrganisationFilter_view/DuplicateOrganisationFilter_view.aod b/neonView/DuplicateOrganisationFilter_view/DuplicateOrganisationFilter_view.aod deleted file mode 100644 index 2e4b88985d02932f1eb78ced263ceb82b88c2adf..0000000000000000000000000000000000000000 --- a/neonView/DuplicateOrganisationFilter_view/DuplicateOrganisationFilter_view.aod +++ /dev/null @@ -1,58 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.8" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.8"> - <name>DuplicateOrganisationFilter_view</name> - <majorModelMode>DISTRIBUTED</majorModelMode> - <filterable v="true" /> - <layout> - <groupLayout> - <name>layout</name> - </groupLayout> - </layout> - <children> - <tableViewTemplate> - <name>table</name> - <favoriteActionGroup1>filterActions</favoriteActionGroup1> - <isCreatable v="false" /> - <isDeletable v="false" /> - <isEditable v="false" /> - <columns> - <neonTableColumn> - <name>04253f56-c764-46a9-8795-6b7c58d9352b</name> - <entityField>PICTURE</entityField> - </neonTableColumn> - <neonTableColumn> - <name>fc700556-7829-42be-b824-83d29e7dddf3</name> - <entityField>DUPLICATE</entityField> - </neonTableColumn> - <neonTableColumn> - <name>6e753d4c-4f6a-4fbf-8af0-b76aa4ff8e76</name> - <entityField>ORGNAME</entityField> - </neonTableColumn> - <neonTableColumn> - <name>1368091a-0a65-4df6-b0fc-34031925e2bf</name> - <entityField>STATUS</entityField> - </neonTableColumn> - <neonTableColumn> - <name>d407d879-3f44-4656-a4bc-0149adcfec5e</name> - <entityField>CUSTOMERCODE</entityField> - </neonTableColumn> - <neonTableColumn> - <name>166bdb5d-a822-4915-99aa-2ff1adca1bc9</name> - <entityField>TYPE</entityField> - </neonTableColumn> - <neonTableColumn> - <name>4edfc696-78b0-4abd-8d03-39c02d0116da</name> - <entityField>STANDARD_PHONE_COMMUNICATION</entityField> - </neonTableColumn> - <neonTableColumn> - <name>e7fb62b8-4d76-46cc-bf84-00230d2e6e56</name> - <entityField>STANDARD_EMAIL_COMMUNICATION</entityField> - </neonTableColumn> - <neonTableColumn> - <name>93bc9275-aea3-436d-ab86-fd400a790538</name> - <entityField>STANDARD_ADDRESS</entityField> - </neonTableColumn> - </columns> - </tableViewTemplate> - </children> -</neonView> diff --git a/neonView/DuplicateOrganisationPreview_view/DuplicateOrganisationPreview_view.aod b/neonView/DuplicateOrganisationPreview_view/DuplicateOrganisationPreview_view.aod deleted file mode 100644 index 29f3a38fc42c1f47d2d21233941b8677b77ddfe7..0000000000000000000000000000000000000000 --- a/neonView/DuplicateOrganisationPreview_view/DuplicateOrganisationPreview_view.aod +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.8" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.8"> - <name>DuplicateOrganisationPreview_view</name> - <majorModelMode>DISTRIBUTED</majorModelMode> - <layout> - <noneLayout> - <name>layout</name> - </noneLayout> - </layout> -</neonView> diff --git a/neonView/DuplicatePersonEdit_view/DuplicatePersonEdit_view.aod b/neonView/DuplicatePersonEdit_view/DuplicatePersonEdit_view.aod deleted file mode 100644 index 99e36d549f4ddd5e255077197ed28f53825b0c57..0000000000000000000000000000000000000000 --- a/neonView/DuplicatePersonEdit_view/DuplicatePersonEdit_view.aod +++ /dev/null @@ -1,61 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.8" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.8"> - <name>DuplicatePersonEdit_view</name> - <majorModelMode>DISTRIBUTED</majorModelMode> - <layout> - <noneLayout> - <name>layout</name> - </noneLayout> - </layout> - <children> - <tableViewTemplate> - <name>table</name> - <hideActions v="true" /> - <isCreatable v="false" /> - <isDeletable v="false" /> - <isEditable v="false" /> - <columns> - <neonTableColumn> - <name>fe9c534a-ba99-4805-996f-e76a6e77396e</name> - <entityField>LETTERSALUTATION</entityField> - </neonTableColumn> - <neonTableColumn> - <name>f8235c5b-6d13-4fd4-8522-96e38abaad1e</name> - <entityField>TITLE</entityField> - </neonTableColumn> - <neonTableColumn> - <name>7b89e8a4-e9da-4d89-86cf-d35db86cf53c</name> - <entityField>FIRSTNAME</entityField> - </neonTableColumn> - <neonTableColumn> - <name>2b255370-1cd5-472f-8417-bde8c9f5743a</name> - <entityField>MIDDLENAME</entityField> - </neonTableColumn> - <neonTableColumn> - <name>a5188dac-9c63-44de-bb36-cb40689376c2</name> - <entityField>LASTNAME</entityField> - </neonTableColumn> - <neonTableColumn> - <name>7f0abf2a-5411-425e-8be8-16c57d19ba12</name> - <entityField>STATUS</entityField> - </neonTableColumn> - <neonTableColumn> - <name>55cdd3d2-548a-4a7f-9590-14413d0a6f34</name> - <entityField>ORGANISATION_ID</entityField> - </neonTableColumn> - <neonTableColumn> - <name>305716b3-d99b-4fea-8f8a-a71b9dbeeacd</name> - <entityField>STANDARD_EMAIL_COMMUNICATION</entityField> - </neonTableColumn> - <neonTableColumn> - <name>446a5dea-a93f-4b1e-9b51-b8a00990972d</name> - <entityField>STANDARD_PHONE_COMMUNICATION</entityField> - </neonTableColumn> - <neonTableColumn> - <name>1fedd9be-6492-4e89-ae8e-03bc212078e1</name> - <entityField>STANDARD_ADDRESS</entityField> - </neonTableColumn> - </columns> - </tableViewTemplate> - </children> -</neonView> diff --git a/neonView/DuplicatePersonFilter_view/DuplicatePersonFilter_view.aod b/neonView/DuplicatePersonFilter_view/DuplicatePersonFilter_view.aod deleted file mode 100644 index c1f6405a3cc09e5a8eda9af6abb92dcce3fa1f06..0000000000000000000000000000000000000000 --- a/neonView/DuplicatePersonFilter_view/DuplicatePersonFilter_view.aod +++ /dev/null @@ -1,70 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.8" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.8"> - <name>DuplicatePersonFilter_view</name> - <majorModelMode>DISTRIBUTED</majorModelMode> - <filterable v="true" /> - <layout> - <groupLayout> - <name>layout</name> - </groupLayout> - </layout> - <children> - <tableViewTemplate> - <name>table</name> - <favoriteActionGroup1>filterActions</favoriteActionGroup1> - <isCreatable v="false" /> - <isDeletable v="false" /> - <isEditable v="false" /> - <columns> - <neonTableColumn> - <name>c89d9927-c3f1-4e0c-b7fa-20d5e031f8b7</name> - <entityField>PICTURE</entityField> - </neonTableColumn> - <neonTableColumn> - <name>c68a371e-0baa-4e6c-baee-424ca4f1d258</name> - <entityField>DUPLICATE</entityField> - </neonTableColumn> - <neonTableColumn> - <name>42fb67ab-6bc9-4a02-9dad-10f54d9fe242</name> - <entityField>LETTERSALUTATION</entityField> - </neonTableColumn> - <neonTableColumn> - <name>59aa16e6-f599-4aff-8314-6b1a2c8cfd67</name> - <entityField>TITLE</entityField> - </neonTableColumn> - <neonTableColumn> - <name>3fdd6165-1a1b-4521-a23f-631e5f88beb1</name> - <entityField>FIRSTNAME</entityField> - </neonTableColumn> - <neonTableColumn> - <name>a76bc050-eccd-4d2a-9190-2d994fcea7e3</name> - <entityField>MIDDLENAME</entityField> - </neonTableColumn> - <neonTableColumn> - <name>381ba7a3-1591-40a2-8837-0516db984bb7</name> - <entityField>LASTNAME</entityField> - </neonTableColumn> - <neonTableColumn> - <name>6b828d7c-7b3c-490f-98a1-41520dec0773</name> - <entityField>STATUS</entityField> - </neonTableColumn> - <neonTableColumn> - <name>47c28842-59ab-4f9c-9239-3fda9c6171e0</name> - <entityField>ORGANISATION_ID</entityField> - </neonTableColumn> - <neonTableColumn> - <name>68b9211a-b4e7-4b7b-b110-9d76d7e14bb2</name> - <entityField>STANDARD_PHONE_COMMUNICATION</entityField> - </neonTableColumn> - <neonTableColumn> - <name>7a3fd399-0e19-4399-8df1-4f8d521b6729</name> - <entityField>STANDARD_EMAIL_COMMUNICATION</entityField> - </neonTableColumn> - <neonTableColumn> - <name>f54a6069-994c-4c77-b462-dc449e42ef49</name> - <entityField>STANDARD_ADDRESS</entityField> - </neonTableColumn> - </columns> - </tableViewTemplate> - </children> -</neonView> diff --git a/neonView/DuplicatePersonPreview_view/DuplicatePersonPreview_view.aod b/neonView/DuplicatePersonPreview_view/DuplicatePersonPreview_view.aod deleted file mode 100644 index bd812680650a1960d3848cc068685b565b20f281..0000000000000000000000000000000000000000 --- a/neonView/DuplicatePersonPreview_view/DuplicatePersonPreview_view.aod +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.8" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.8"> - <name>DuplicatePersonPreview_view</name> - <majorModelMode>DISTRIBUTED</majorModelMode> - <layout> - <noneLayout> - <name>layout</name> - </noneLayout> - </layout> -</neonView> diff --git a/neonView/OrganisationEdit_view/OrganisationEdit_view.aod b/neonView/OrganisationEdit_view/OrganisationEdit_view.aod index 0e6500095ffe50942035ec4db7acb782dde76106..35d084a739d5b8c5a7a04e28816d281590df8fa3 100644 --- a/neonView/OrganisationEdit_view/OrganisationEdit_view.aod +++ b/neonView/OrganisationEdit_view/OrganisationEdit_view.aod @@ -6,15 +6,16 @@ <icon>VAADIN:BUILDING</icon> <quickEntry v="2" /> <layout> - <boxLayout> + <headerFooterLayout> <name>layout</name> - </boxLayout> + <header>933cd72c-fd3a-4b91-aad6-8e129d6233e5</header> + </headerFooterLayout> </layout> <children> <neonViewReference> <name>933cd72c-fd3a-4b91-aad6-8e129d6233e5</name> <entityField>Duplicates</entityField> - <view>DuplicateOrganisationEdit_view</view> + <view>DuplicateEdit_view</view> </neonViewReference> <genericViewTemplate> <name>Edit</name> diff --git a/neonView/OrganisationMain_view/OrganisationMain_view.aod b/neonView/OrganisationMain_view/OrganisationMain_view.aod index fcdacbfe67c053e54e513221e2785378d0071689..bcfdf5234b69f859073d04a1aa625b7db205bd2c 100644 --- a/neonView/OrganisationMain_view/OrganisationMain_view.aod +++ b/neonView/OrganisationMain_view/OrganisationMain_view.aod @@ -73,7 +73,7 @@ <neonViewReference> <name>a5ab96e5-927c-4db3-b7ed-f0c0aadcb89b</name> <entityField>Duplicates</entityField> - <view>DuplicateOrganisationFilter_view</view> + <view>DuplicateFilter_view</view> </neonViewReference> <neonViewReference> <name>56eb7d7d-23e9-4ab8-8a77-d0a6d997d710</name> diff --git a/neonView/PersonEdit_view/PersonEdit_view.aod b/neonView/PersonEdit_view/PersonEdit_view.aod index 27586ee38b4febc4820c68577184586052e44464..9269ef7852aa1b7d43b62b67c46dbd7995201a3a 100644 --- a/neonView/PersonEdit_view/PersonEdit_view.aod +++ b/neonView/PersonEdit_view/PersonEdit_view.aod @@ -6,15 +6,16 @@ <icon>VAADIN:USERS</icon> <quickEntry v="1" /> <layout> - <boxLayout> + <headerFooterLayout> <name>layout</name> - </boxLayout> + <header>a6b55bfc-7b0c-4020-a78d-18ee9a1d2b26</header> + </headerFooterLayout> </layout> <children> <neonViewReference> <name>a6b55bfc-7b0c-4020-a78d-18ee9a1d2b26</name> <entityField>Duplicates</entityField> - <view>DuplicatePersonEdit_view</view> + <view>DuplicateEdit_view</view> </neonViewReference> <genericViewTemplate> <name>Edit</name> diff --git a/neonView/PersonMain_view/PersonMain_view.aod b/neonView/PersonMain_view/PersonMain_view.aod index b0263fcdcc8754e14b64166966be4616d897d44a..b5efa8bddd05791f67b2a1743ad06cc3a515991b 100644 --- a/neonView/PersonMain_view/PersonMain_view.aod +++ b/neonView/PersonMain_view/PersonMain_view.aod @@ -62,7 +62,7 @@ <neonViewReference> <name>24ea8bc9-7ed0-4bed-a984-b1a9f3815c7c</name> <entityField>Duplicates</entityField> - <view>DuplicatePersonFilter_view</view> + <view>DuplicateFilter_view</view> </neonViewReference> <neonViewReference> <name>5754fc3a-c81c-42ba-90ea-2859b10bb391</name> diff --git a/neonView/PersonMultiEditQuickEntry_view/PersonMultiEditQuickEntry_view.aod b/neonView/PersonMultiEditQuickEntry_view/PersonMultiEditQuickEntry_view.aod index 253c58d726b077d4606f7f04df1eadb9e2977d82..97b355e07f23a7ed52e37d961e063ba52184792a 100644 --- a/neonView/PersonMultiEditQuickEntry_view/PersonMultiEditQuickEntry_view.aod +++ b/neonView/PersonMultiEditQuickEntry_view/PersonMultiEditQuickEntry_view.aod @@ -11,7 +11,7 @@ <genericMultipleViewTemplate> <name>GenericMultiple</name> <entityField>#ENTITY</entityField> - <title>more contacts</title> + <title>Contact</title> <devices> <element>MOBILE</element> <element>TABLET</element> diff --git a/neonView/QuickEntryEdit_view/QuickEntryEdit_view.aod b/neonView/QuickEntryEdit_view/QuickEntryEdit_view.aod index c9ef652c01ba859d7b894e61ed588d9d7a91279e..972bd61c3ea5cdba8aca50db6d37206bb554935c 100644 --- a/neonView/QuickEntryEdit_view/QuickEntryEdit_view.aod +++ b/neonView/QuickEntryEdit_view/QuickEntryEdit_view.aod @@ -6,15 +6,16 @@ <icon>VAADIN:WORKPLACE</icon> <quickEntry v="0" /> <layout> - <boxLayout> + <headerFooterLayout> <name>layout</name> - </boxLayout> + <header>08e465c6-63de-497a-a14b-bc63f65601cc</header> + </headerFooterLayout> </layout> <children> <neonViewReference> - <name>adf71384-2c12-401b-a3aa-89ed23e757c2</name> - <entityField>OrgAndPersDuplicates</entityField> - <view>AnyContactDuplicates_view</view> + <name>08e465c6-63de-497a-a14b-bc63f65601cc</name> + <entityField>Duplicates</entityField> + <view>DuplicateEdit_view</view> </neonViewReference> <genericViewTemplate> <name>GeneralData</name> @@ -29,10 +30,20 @@ <name>8ed8f12d-2a91-4009-8868-55a0c11880ff</name> <entityField>leadQuickAcquisition</entityField> </entityFieldLink> + </fields> + </genericViewTemplate> + <genericViewTemplate> + <name>OrganisationGeneralData</name> + <editMode v="true" /> + <fields> <entityFieldLink> - <name>5d319cad-a0e5-49c3-867a-ccbdd217d5e0</name> + <name>fcacb261-618e-4b82-9b14-8080b0271955</name> <entityField>ORGANISATION_NAME</entityField> </entityFieldLink> + <entityFieldLink> + <name>f9fa7ed7-0cb5-45b8-a7ab-baa486685e5e</name> + <entityField>ISOLANGUAGE</entityField> + </entityFieldLink> </fields> </genericViewTemplate> <neonViewReference> @@ -45,38 +56,6 @@ <entityField>Communications</entityField> <view>CommunicationMultiEdit_view</view> </neonViewReference> - <genericViewTemplate> - <name>GeneralDataPerson</name> - <editMode v="true" /> - <entityField>#ENTITY</entityField> - <fields> - <entityFieldLink> - <name>e025ba33-8593-4ac1-88f0-705801714340</name> - <entityField>ISOLANGUAGE</entityField> - </entityFieldLink> - <entityFieldLink> - <name>f7434390-8d1e-4ad0-acf8-f7d743835421</name> - <entityField>PERSON_SALUTATION</entityField> - </entityFieldLink> - <entityFieldLink> - <name>4d4eabe5-f166-4ed8-915d-f1f4f1513467</name> - <entityField>PERSON_TITLE</entityField> - </entityFieldLink> - <entityFieldLink> - <name>54e04763-1fca-4898-9370-204228d67087</name> - <entityField>FIRSTNAME</entityField> - </entityFieldLink> - <entityFieldLink> - <name>85227661-e199-4943-8d85-75cc92faa099</name> - <entityField>LASTNAME</entityField> - </entityFieldLink> - </fields> - </genericViewTemplate> - <neonViewReference> - <name>9f1eace6-b69e-4cd3-b672-5628d5ee2a47</name> - <entityField>Adresses</entityField> - <view>AdressMultiEdit_view</view> - </neonViewReference> <neonViewReference> <name>eb125436-53cf-47ce-b91f-28e065617608</name> <entityField>Contacts</entityField> diff --git a/process/DuplicateMerge_lib/process.js b/process/DuplicateMerge_lib/process.js index 5b83ce3f225e20ebee0e6ca40ff7bc859dea99b3..a4f7f6ec70c9de21d69cf2d317e44aee8303a41a 100644 --- a/process/DuplicateMerge_lib/process.js +++ b/process/DuplicateMerge_lib/process.js @@ -1,3 +1,4 @@ +import("system.entities"); import("Communication_lib"); import("Sql_lib"); import("system.db"); @@ -14,6 +15,50 @@ import("DuplicateScanner_lib"); */ function DuplicateMergeUtils() {} +/* + * Mapping between context and mergefunction + * + * @returns {Object} the mapping object. key is the context, value is the mergefunction. + */ +DuplicateMergeUtils.getContextMergeFunctionMapping = function() +{ + return { + "Person": DuplicateMergeUtils.mergePerson, + "Organisation": DuplicateMergeUtils.mergeOrganisation + }; +} + +/* + * Checks if a mergefunction is there for the specified context + * + * @param {String} pContext The context that is called + * @returns {Boolean} if the context has a mergefunction + */ +DuplicateMergeUtils.hasContextMergeFunction = function(pContext) +{ + return !!(DuplicateMergeUtils.getContextMergeFunctionMapping()[pContext]); +} + +/* + * Maps the context to the right mergefunction + * + * @param {String} pContext The context that is called + * @param {String} pSourceContactId The contact to be integrated into another + * @param {String} pTargetContactId The contact in which the source gets integrated + * @returns {Boolean} if the merge was sucessful + */ +DuplicateMergeUtils.mergeContext = function(pContext, pSourceContactId, pTargetContactId) +{ + var mergeFunction = DuplicateMergeUtils.getContextMergeFunctionMapping()[pContext]; + + if(!mergeFunction) + { + throw new Error("There is no merge-function for context '" + pContext + "' in DuplicateMerge_lib defined."); + } + + return mergeFunction(pSourceContactId, pTargetContactId); +} + /* * * Merges the source person into the target person. @@ -63,12 +108,7 @@ DuplicateMergeUtils.mergePerson = function(pSourceContactId, pTargetContactId) }); var deletedRows = db.deletes(deleteStatements) - DuplicateScannerUtils.deleteHasDuplicateEntries("Person_entity", [pSourceContactId, pTargetContactId]); - var dupIds = DuplicateScannerUtils.getDuplicateIdsByEntityScanner("Person_entity", pTargetContactId); - if(dupIds.length > 0) - { - DuplicateScannerUtils.insertHasDuplicateEntry("Person_entity", pTargetContactId, dupIds.length); - } + DuplicateMergeUtils._modifyDuplicates("Person_entity", pTargetContactId, pSourceContactId); return isLinkedDataUpdated || isParticipantsUpdated || deletedRows > 0; } @@ -104,12 +144,7 @@ DuplicateMergeUtils.mergeOrganisation = function(pSourceContactId, pTargetContac }); var deletedRows = db.deletes(deleteStatements) - DuplicateScannerUtils.deleteHasDuplicateEntries("Organisation_entity", [pSourceContactId, pTargetContactId]); - var dupIds = DuplicateScannerUtils.getDuplicateIdsByEntityScanner("Organisation_entity", pTargetContactId); - if(dupIds.length > 0) - { - DuplicateScannerUtils.insertHasDuplicateEntry("Organisation_entity", pTargetContactId, dupIds.length); - } + DuplicateMergeUtils._modifyDuplicates("Organisation_entity", pTargetContactId, pSourceContactId); return deletedRows >= 2; } @@ -366,3 +401,30 @@ DuplicateMergeUtils._getLinkedTableInfos = function(pTargetContactId) ["ASYS_CALENDARLINK", "DBID", "", SqlUtils.getSystemAlias()] ]; } + +/* + * + * Corrects the duplicateCount for the mergetarget + * + * @param {String} pTargetEntity The entity that is called + * @param {String} pTargetId The uid in which the source gets integrated + * @param {String} pSourceId The uid to be integrated into another + */ +DuplicateMergeUtils._modifyDuplicates = function(pTargetEntity, pTargetId, pSourceId) +{ + DuplicateScannerUtils.deleteHasDuplicateEntries(pTargetEntity, [pSourceId]); + + var entityFields = DuplicateScannerUtils.getFilterFields(pTargetEntity); + + var entityRowsConfig = entities.createConfigForLoadingRows() + .entity(pTargetEntity) + .fields(entityFields) + .uid(pTargetId); + var entityRows = entities.getRows(entityRowsConfig); + + entityRows.forEach(function(entityRow) + { + var duplicateObject = DuplicateScannerUtils.getDataForDuplicateCheck(pTargetEntity, entityRow); + DuplicateScannerUtils.updateHasDuplicateEntryForExtern(duplicateObject); + }); +} \ No newline at end of file diff --git a/process/DuplicateScanner_lib/documentation.adoc b/process/DuplicateScanner_lib/documentation.adoc index d824334d2f7be4a57046b2f8efb7730bbb17115e..429dbc40608cd37b7719e278a96b7f2fccc19747 100644 --- a/process/DuplicateScanner_lib/documentation.adoc +++ b/process/DuplicateScanner_lib/documentation.adoc @@ -6,10 +6,3 @@ Provides functions to create duplicate filterExtensions (getDuplicateConditional Provides functions to manage ignored duplicates (filterIgnored, updateIgnored). -Provides functions to search for ignored duplicates. -The base function is DuplicateScannerUtils.getDuplicateIds. The other helper functions are - DuplicateScannerUtils.getDuplicateIdsByEntityScanner and DuplicateScannerUtils.getDuplicateIdsByEntityObj. - both call the base function but simplify the call for the 2 usecases: - -* get all duplicateids of a dataset by entity and uid: getDuplicateIdsByEntityScanner -* get all duplicateids of a dataset based on the entity and the variable (if the dataset has not been saved yet). diff --git a/process/DuplicateScanner_lib/process.js b/process/DuplicateScanner_lib/process.js index be805bc2aecc3323fb0e536f545da25e8d2b5762..71bc9c9766f6d35200214f56b87cefb6b892932f 100644 --- a/process/DuplicateScanner_lib/process.js +++ b/process/DuplicateScanner_lib/process.js @@ -1,3 +1,4 @@ +import("Context_lib"); import("system.project"); import("system.util"); import("system.vars"); @@ -16,6 +17,27 @@ import("system.process"); */ function DuplicateScannerUtils() {} +/** + * Returns the default name of the duplicate provider in entities + * + * @returns {String} the name of entity provider + */ +DuplicateScannerUtils.getDuplicateProviderName = function() +{ + return "Dublicates"; +} + +/** + * Returns a list of permitted filteroperator for the duplicatescanner + * All other filteroperator will be changed to "CONTAINS" + * + * @returns {Array} of filteroperatornames + */ +DuplicateScannerUtils.getPermittedFilterOperator = function() +{ + return ["CONTAINS", "CONTAINSNOT"]; +} + /** * Returns an sql condition which returns a list of duplicate ids. * The count is checked using pCount and pOperator. @@ -54,46 +76,20 @@ DuplicateScannerUtils.updateIgnored = function(pDuplicateType, pSourceDuplicateI .and("UNRELATEDDUPLICATES.UNRELATEDDUPLICATEID", pUnrelatedDuplicateIds, SqlBuilder.IN()) .deleteData(); - var TABLE_NAME = "UNRELATEDDUPLICATES"; - var COLUMN_NAMES = ["ID", "DUPLICATETYPE", "SOURCEDUPLICATEID", "UNRELATEDDUPLICATEID"]; - var COLUMN_TYPES = db.getColumnTypes(TABLE_NAME, COLUMN_NAMES); - - var statements = []; - pUnrelatedDuplicateIds.forEach(function(currId) - { - var columnValues = [util.getNewUUID(), pDuplicateType, pSourceDuplicateId, currId]; - statements.push([TABLE_NAME, COLUMN_NAMES, COLUMN_TYPES, columnValues]); - }); if(pIgnore) { - db.inserts(statements); - } -} + const TABLE_NAME = "UNRELATEDDUPLICATES"; + const COLUMN_NAMES = ["ID", "DUPLICATETYPE", "SOURCEDUPLICATEID", "UNRELATEDDUPLICATEID"]; -/** - * Removes ignored duplicates from an array of duplicate ids - * - * @param {string} pTargetEntity the target entity e.g.: Organisation_entity - * @param {string} pTargetUid the source duplicate id - * @param {string} pIdArray the array of duplicate ids - * - * @returns {string[]} the filtered duplicate ids - */ -DuplicateScannerUtils.filterIgnored = function(pTargetEntity, pTargetUid, pIdArray) -{ - if(pIdArray.length == 0) - { - return pIdArray; + var statements = []; + pUnrelatedDuplicateIds.forEach(function(currId) + { + var columnValues = [util.getNewUUID(), pDuplicateType, pSourceDuplicateId, currId]; + statements.push([TABLE_NAME, COLUMN_NAMES, null, columnValues]); + }); + + db.inserts(statements); } - var ignoreTable = newSelect(["UNRELATEDDUPLICATES.UNRELATEDDUPLICATEID"]) - .from("UNRELATEDDUPLICATES") - .where("UNRELATEDDUPLICATES.DUPLICATETYPE", pTargetEntity) - .and("UNRELATEDDUPLICATES.SOURCEDUPLICATEID", pTargetUid) - .and("UNRELATEDDUPLICATES.UNRELATEDDUPLICATEID", pIdArray, SqlBuilder.IN()) - .arrayColumn(); - return pIdArray.filter(function(curr) { - return !ignoreTable.includes(curr); - }); } /** @@ -133,34 +129,49 @@ DuplicateScannerUtils.insertHasDuplicateEntry = function(pObjectType, pObjectRow } /** - * Updates HasDuplicate by entity (used in onInser and onUpdate) + * Updates HasDuplicate by entity (used in onInsert and onUpdate) * * @param {string} pTargetEntity the target entity e.g.: Organisation_entity */ DuplicateScannerUtils.updateHasDuplicateEntry = function(pTargetEntity) { - var scanner = DuplicateScannerUtils.getScannerByEntity(pTargetEntity); - var indexsearchFilter = IndexsearchFilterUtils.fromFilter(scanner.filter); - - var fields = indexsearchFilter.getFields(); - fields.add(scanner.idField); - fields = Array.from(fields); + var dataObject = DuplicateScannerUtils.buildDataOjbectFromEntity(pTargetEntity); + var duplicateObject = DuplicateScannerUtils.getDataForDuplicateCheck(pTargetEntity, dataObject); + + DuplicateScannerUtils.updateHasDuplicateEntryForExtern(duplicateObject); +} - var entityObj = {}; - fields.forEach(function(field) +/** + * Updates HasDuplicate for extern use like entities (used in onInsert and onUpdate) + * + * @param {object} pDuplicateObject from function getDataForDuplicateCheck or an array of getDataForDuplicateCheck + * + * @return {object} key is the entityname and value is a boolean, if a duplicate is found + */ +DuplicateScannerUtils.updateHasDuplicateEntryForExtern = function(pDuplicateObject) +{ + var resultObject = []; + + pDuplicateObject.forEach(function(pMappingObj) { - entityObj[field] = vars.get("$field." + field); + var duplicateClass = new DuplicateUtils(pMappingObj); + var duplicates = duplicateClass.execute(); + var resObj = {}; + + DuplicateScannerUtils.deleteHasDuplicateEntries(duplicateClass.entity, [duplicateClass.sourceId]); + var unrelatedCount = DuplicateScannerUtils.getUnrelatedDuplicateCount(duplicateClass.entity, duplicateClass.sourceId); + var duplicatesLength = duplicates.length - unrelatedCount; + if(duplicatesLength > 0) + { + DuplicateScannerUtils.insertHasDuplicateEntry(duplicateClass.entity, duplicateClass.sourceId, duplicatesLength); + } + + resObj[duplicateClass.entity] = duplicates.length > 0; + + resultObject.push(resObj); }); - var selfId = entityObj[scanner.idField]; - - var indexPattern = indexsearchFilter.buildQuery(entityObj); - var ids = DuplicateScannerUtils.getDuplicateIds(pTargetEntity, indexPattern, selfId); - DuplicateScannerUtils.deleteHasDuplicateEntries(pTargetEntity, [selfId]); - if(ids.length > 0) - { - DuplicateScannerUtils.insertHasDuplicateEntry(pTargetEntity, selfId, ids.length); - } + return resultObject; } /** @@ -177,7 +188,8 @@ DuplicateScannerUtils.getScannerByEntity = function(pTargetEntity) "DUPLICATESCANNER.SCAN_PATTERN" ]) .from("DUPLICATESCANNER") - .where("DUPLICATESCANNER.ENTITY_TO_SCAN_NAME", pTargetEntity).arrayRow(); + .where("DUPLICATESCANNER.ENTITY_TO_SCAN_NAME", pTargetEntity) + .arrayRow(); var filterObj = JSON.parse(duplicateScanner[1]).filter; return { idField: duplicateScanner[0], @@ -186,80 +198,333 @@ DuplicateScannerUtils.getScannerByEntity = function(pTargetEntity) } /** - * Calls the index search and returns the found duplicate ids + * Helperfunction to build the mappingobject for duplicatescan + * + * @param {string} pEntity a entity name e.g.: Organisation_entity + * @param {object} pMappingObject key is the entity-fieldname and value is the value of the field + * + * @returns {object} the scanner object + */ +DuplicateScannerUtils.getDataForDuplicateCheck = function(pEntity, pMappingObject) +{ + return [{ + entity: pEntity, + dataObject: pMappingObject + }]; +} + +/** + * Gets all entityfieldnames from an entity + * + * @param {string} pEntity the entityname + * + * @returns {array} the entityfieldnames + */ +DuplicateScannerUtils.getFilterFields = function(pEntity) +{ + var uidFilterObject = DuplicateScannerUtils.getScannerByEntity(pEntity); + var idField = uidFilterObject.idField; + var filter = uidFilterObject.filter; + + return Array.from(new Set(DuplicateScannerUtils.getFieldsfromFilter(filter).concat([idField]))); +} + +/** + * Helperfunction for entities to get all filterfields with there value * - * @param {string} pTargetEntity search for duplicate in this entity e.g.: Organisation_entity - * @param {string} pIndexPattern the index pattern as string - * @param {string=} pSelfId optionally the own id (this will be excluded) + * @param {string} pEntity the entityname * - * @returns {string[]} the duplicate ids + * @returns {object} key is fieldname and value the fieldvalue */ -DuplicateScannerUtils.getDuplicateIds = function(pTargetEntity, pIndexPattern, pSelfId) +DuplicateScannerUtils.buildDataOjbectFromEntity = function(pEntity) { - let indexQuery = indexsearch.createIndexQuery() - .setPattern(pIndexPattern) - .setEntities([pTargetEntity]); - if(pSelfId) + var filterFields = DuplicateScannerUtils.getFilterFields(pEntity); + var dataObject = {}; + + filterFields.forEach(function(field) { - // creates -_local_id_:"<pSelfId>" - var optFilter = indexsearch.buildPattern(indexsearch.createPatternConfig().minus( - indexsearch.createPhraseTerm(pSelfId) - .setIndexField(indexsearch.FIELD_ID) - )); - indexQuery = indexQuery.addFilter(optFilter); - } + dataObject[field] = vars.get("$field." + field); + }); + + return dataObject; +} + +/** + * Gets the count of unrelatedduplicateids + * + * @returns {string} count of unrelatedduplicateids + */ +DuplicateScannerUtils.getUnrelatedDuplicateCount = function(pEntity, pSourceId) +{ + return newSelect("count(*)") + .from("UNRELATEDDUPLICATES") + .where("UNRELATEDDUPLICATES.DUPLICATETYPE", pEntity) + .and("UNRELATEDDUPLICATES.SOURCEDUPLICATEID", pSourceId) + .cell(); +} + + - var indexResult = indexsearch.searchIndex(indexQuery); - indexResult = indexResult[indexsearch.HITS]; - if(indexResult === null || indexResult.length === 0) + +/** + * Class for duplicatescan + * + * @param {object} pMappingObject from getDataForDuplicateCheck + */ +function DuplicateUtils(pMappingObject) +{ + this.entity = pMappingObject.entity; + this.context = ContextUtils.getContextName(ContextUtils.getContextId(this.entity)); + var uidFilterObject = DuplicateScannerUtils.getScannerByEntity(this.entity); + this.idField = uidFilterObject.idField; + this.filterFields = [this.idField]; + this.filter = uidFilterObject.filter; + this.dataObject = pMappingObject.dataObject; + + //Don't know if the code is right or in use, because the data to scan, should come from extern + //Could be a help in entityfunctions + if(!this.dataObject) { - return []; + this.getFieldsfromFilter(this.filter); + this.filterFields = new Set(this.filterFields); + + this.dataObject = {}; + this.filterFields.forEach(function(field) + { + this.dataObject[field] = vars.get("$field." + field); + }, this); } + //--- + + this.sourceId = this.dataObject[this.idField]; + this.newFilter = {}; + this.isNotEmpty = false; + this.provider = DuplicateScannerUtils.getDuplicateProviderName(); + + var recordContainer = project.getRecordContainerModel(this.entity, this.provider); + + if(recordContainer == null) + { + throw new Error("Unknown provider '" + this.provider + "' in entity '" + this.entity + "'"); + } + + this.recordContainerType = recordContainer.type; +} + +/** + * Gets the unrelatedduplicateids + * + * @returns {array} unrelatedduplicateids + */ +DuplicateUtils.prototype.getUnrelatedDuplicateIds = function() +{ + return newSelect("UNRELATEDDUPLICATES.UNRELATEDDUPLICATEID") + .from("UNRELATEDDUPLICATES") + .where("UNRELATEDDUPLICATES.DUPLICATETYPE", this.entity) + .and("UNRELATEDDUPLICATES.SOURCEDUPLICATEID", this.sourceId) + .arrayColumn(); +} + +/** + * Gets the duplicates from a given entity + * + * @returns {array} multiarray with the found duplicates + */ +DuplicateUtils.prototype.getDuplicates = function() +{ + var resultObject = []; + var unrelatedDuplicateIds = this.getUnrelatedDuplicateIds(); + var getRowsConfig = entities.createConfigForLoadingRows() + .entity(this.entity) + .provider(this.provider) + .filter(JSON.stringify(this.filter)) + .fields(["#UID", "#CONTENTTITLE", "#CONTENTDESCRIPTION"]); + + var res = entities.getRows(getRowsConfig); - var duplicateIds = []; - indexResult.forEach(function(curr) + res.forEach(function(obj) { - duplicateIds.push(curr[indexsearch.FIELD_ID]); - }); - return duplicateIds; + if(obj["#UID"] != this.sourceId) + { + var duplicate = unrelatedDuplicateIds.includes(obj["#UID"]); + resultObject.push([obj["#UID"], "TEXT:" + obj["#CONTENTTITLE"], obj["#CONTENTTITLE"], obj["#CONTENTDESCRIPTION"], this.context, this.sourceId, this.entity, (+!duplicate).toString()]); + } + }, this); + + return resultObject; } /** - * Does the same as getDuplicateIds but takes in a scanner (by entity) instead of an indexPattern + * Removes the empty filters from the filterobject. + * Manipulates directly the object, so no return needed. + * Empty filterfields have to removed, otherwise the outcoming duplicates aren't right * - * @param {string} pTargetEntity the entity name used to get the Scanner - * @param {string} pTargetUid all variables will be loaded by this id + * @param {object} pFilterObjects a jdito-filterobject + */ +DuplicateUtils.prototype.removeEmptyFilter = function(pFilterObjects) +{ + for (let i = 0; i < pFilterObjects.length; i++) + { + let obj = pFilterObjects[i]; + + if(obj.type == "row" && ["", null, undefined].includes(this.dataObject[obj.name])) + { + pFilterObjects.splice(i, 1); + i--; + } + } +} + +/** + * Modifies a filterobject, like exlude some values (or other modifications). + * Manipulates directly the object, so no return needed. * - * @returns {string[]} the duplicate ids + * @param {object} pFilterObject a jdito-filterobject */ -DuplicateScannerUtils.getDuplicateIdsByEntityScanner = function(pTargetEntity, pTargetUid) +DuplicateUtils.prototype.modifyFilterForProvider = function(pFilterObject) { - var scanner = DuplicateScannerUtils.getScannerByEntity(pTargetEntity); - var indexsearchFilter = IndexsearchFilterUtils.fromFilter(scanner.filter); - - var targetLoadConfig = entities.createConfigForLoadingRows() - .entity(pTargetEntity) - .uid(pTargetUid) // Array.from because getFields returns a Set - .fields(Array.from(indexsearchFilter.getFields())); - var targetRow = entities.getRow(targetLoadConfig); + try + { + pFilterObject.key = JSON.parse(pFilterObject.key); + } // If the pValue isn't an Object or Array + catch (e if e instanceof SyntaxError) {} + + if(pFilterObject.key.exclude) + { + var regExpArray = pFilterObject.key.exclude.map(function(value) { + return "\\W+" + value + "\\W+|\\W+" + value + "$|^" + value + "\\W+|^" + value + "$"; + }); + + var regularExpression = new RegExp(regExpArray.join('|'), 'gim'); + this.dataObject[pFilterObject.name] = this.dataObject[pFilterObject.name].replace(regularExpression, '').trim(); + } + + this._modifyFilterForProviderType(pFilterObject); - var indexPattern = indexsearchFilter.buildQuery(targetRow); - return DuplicateScannerUtils.getDuplicateIds(pTargetEntity, indexPattern, pTargetUid); + pFilterObject.value = pFilterObject.key = this.dataObject[pFilterObject.name]; } /** - * Does the same as getDuplicateIdsByEntityScanner - * but the variables are directly passed in as an argument + * Modifies a filterobject for a specifited providertype, like for the index the fuzzy-search. + * Manipulates directly the object, so no return needed. + * Also checks if the providertype can be used for the search, otherwise throws an exception. * - * @param {string} pTargetEntity the entity name used to get the Scanner - * @param {object} pEntityObj the variables (should include all variables needed to build the indexPattern) + * @param {object} pFilterObjects a jdito-filterobject + */ +DuplicateUtils.prototype._modifyFilterForProviderType = function(pFilterObjects) +{ + var permittedOperator = DuplicateScannerUtils.getPermittedFilterOperator(); + + switch(this.recordContainerType) { + case project.RECORDCONTAINERTYPE_INDEX: + if(!permittedOperator.includes(pFilterObjects.operator)) + { + pFilterObjects.operator = "CONTAINS"; + } + + if(pFilterObjects.key.fuzzy) + { + this.dataObject[pFilterObjects.name] += "~" + pFilterObjects.key.fuzzy; + pFilterObjects.operator = "EQUAL"; + } + break; + case project.RECORDCONTAINERTYPE_DATALESS: + throw new Error("Can't use dataless-RecordContainer for dublicates"); + break; + case project.RECORDCONTAINERTYPE_DB: + if(!permittedOperator.includes(pFilterObjects.operator)) + { + pFilterObjects.operator = "CONTAINS"; + } + case project.RECORDCONTAINERTYPE_JDITO: + if(pFilterObjects.key.fuzzy) + { + pFilterObjects.fuzzy = pFilterObjects.key.fuzzy; + } + break; + default: + throw new Error("Unknown recordContainerType: " + this.recordContainerType); + break; + } +} + +/** + * Helperfunction for the duplicate-class to build/modify the filter * - * @returns {string[]} the duplicate ids + * @param {object} pFilter the filter in json representation */ -DuplicateScannerUtils.getDuplicateIdsByEntityObj = function(pTargetEntity, pEntityObj) +DuplicateUtils.prototype.fromFilter = function(pFilter) { - var scanner = DuplicateScannerUtils.getScannerByEntity(pTargetEntity); - var indexsearchFilter = IndexsearchFilterUtils.fromFilter(scanner.filter); - var indexPattern = indexsearchFilter.buildQuery(pEntityObj); - return DuplicateScannerUtils.getDuplicateIds(pTargetEntity, indexPattern, pEntityObj[scanner.idField]); + if(pFilter.type == "group") + { + this.removeEmptyFilter(pFilter.childs); + pFilter.childs.forEach(function(pCurr) + { + this.fromFilter(pCurr); + }, this); + this.removeEmptyFilter(pFilter.childs); + this.isNotEmpty = this.isNotEmpty || pFilter.childs.filter(function(object) + { + return object.type == "row"; + }).length > 0; + } + else if(pFilter.type == "row") + { + this.modifyFilterForProvider(pFilter); + } + else + { + throw new Error("Unknown filter node type: " + pFilter.type); + } +} + +/** + * Mainfunction to call for duplicatesearch, after create the class. + * + * @returns {array} the duplicates + */ +DuplicateUtils.prototype.execute = function() { + this.fromFilter(this.filter); + + return (this.isNotEmpty ? this.getDuplicates() : []); } + +/** + * Checks if duplicates exists, after create the class. + * + * @returns {boolean} if duplicates exists + */ +DuplicateUtils.prototype.checkForDuplicates = function() { + var duplicateLength = this.execute().length; + var unrelatedCount = DuplicateScannerUtils.getUnrelatedDuplicateCount(this.entity, this.sourceId); + + return duplicateLength - unrelatedCount > 0; +} + +/** + * Gets all entityfieldnames from a filter + * + * @param {object} pFilter the filter in json representation + * + * @returns {array} the entityfieldnames + */ +DuplicateScannerUtils.getFieldsfromFilter = function(pFilter) +{ + if(pFilter.type == "group") + { + var newArray = []; + pFilter.childs.forEach(function(pCurr) + { + newArray = newArray.concat(DuplicateScannerUtils.getFieldsfromFilter(pCurr)); + }); + return newArray; + } + else if(pFilter.type == "row") + { + return [pFilter.name]; + } + else + { + throw new Error("Unknown filter node type: " + pFilter.type); + } +} \ No newline at end of file diff --git a/process/Entity_lib/process.js b/process/Entity_lib/process.js index 79d573a823f600868921b8cfd0ea9894109bfd00..a6167c801a0b80c4a9cc90d2856b66994e0dce3b 100644 --- a/process/Entity_lib/process.js +++ b/process/Entity_lib/process.js @@ -30,6 +30,16 @@ EntityUtils.parseUidColumn = function(pFullUidName) }; }; +/** + * Get the id of the current entity + * + * @return {String} Id of the current entity + */ +EntityUtils.getCurrentEntitytId = function() +{ + return vars.get("$sys.currententityname"); +} + /** * provides static methods for handling of entity parameters diff --git a/process/Leadimport_lib/process.js b/process/Leadimport_lib/process.js index ed8fc8ba5a56c1d393bb439c2fadd119a6452c24..394c687a24ed9946a8eff4043ffe917ed2b52dc5 100644 --- a/process/Leadimport_lib/process.js +++ b/process/Leadimport_lib/process.js @@ -917,21 +917,13 @@ LeadImportUtils.scanLeadDups = function(pAllContactData) if (orgObj != undefined && Object.keys(orgObj).length > 0)//checks if there is an ORGANISATIONDUPLICATE { - let scanResultsOrg = DuplicateScannerUtils.getDuplicateIdsByEntityObj("Organisation_entity", orgObj); - if (scanResultsOrg.length > 0) - { - DuplicateScannerUtils.insertHasDuplicateEntry("Organisation_entity", orgObj["CONTACTID"], scanResultsOrg); - dupOrg = true; - } + let duplicateObject = DuplicateScannerUtils.getDataForDuplicateCheck("Organisation_entity", orgObj); + dupOrg = DuplicateScannerUtils.updateHasDuplicateEntryForExtern(duplicateObject)[0]["Organisation_entity"]; } if (persObj != undefined && Object.keys(persObj).length > 0)//checks if there is an PERSONDUPLICATE { - let scanResultsPers = DuplicateScannerUtils.getDuplicateIdsByEntityObj("Person_entity", persObj); - if (scanResultsPers.length > 0) - { - DuplicateScannerUtils.insertHasDuplicateEntry("Person_entity", persObj["CONTACTID"], scanResultsPers); - dupPers = true; - } + let duplicateObject = DuplicateScannerUtils.getDataForDuplicateCheck("Person_entity", persObj); + dupPers = DuplicateScannerUtils.updateHasDuplicateEntryForExtern(duplicateObject)[0]["Person_entity"]; } if (dupOrg && dupPers) diff --git a/process/rebuildDuplicates_serverProcess/process.js b/process/rebuildDuplicates_serverProcess/process.js index 14369cff4552605e18c828601491e101ceced696..5304397d2931098e024ef877103fd8c1b3eb329b 100644 --- a/process/rebuildDuplicates_serverProcess/process.js +++ b/process/rebuildDuplicates_serverProcess/process.js @@ -1,74 +1,39 @@ -import("Sql_lib"); -import("system.db"); +import("Employee_lib"); import("system.entities"); import("system.project"); -import("system.util"); -import("system.logging"); import("system.notification"); -import("system.translate"); import("system.vars"); -import("IndexSearch_lib"); import("DuplicateScanner_lib"); var pFilterName = vars.get("$local.filterName"); var pTargetEntity = vars.get("$local.targetEntity"); -var pTargetIdField = vars.get("$local.targetIdField"); -var pFilter = JSON.parse(vars.get("$local.filter")); +var pCaption = vars.get("$local.caption"); +var pCescription = vars.get("$local.description"); -newWhere("HASDUPLICATE.OBJECT_TYPE", pTargetEntity).deleteData(); -var indexsearchFilter = IndexsearchFilterUtils.fromFilter(pFilter); - -var TABLE_NAME = "HASDUPLICATE"; -var COLUMNS = [ - "HASDUPLICATEID", - "OBJECT_TYPE", "OBJECT_ROWID", - "DUPLICATECOUNT" -]; -var COLUMN_TYPES = db.getColumnTypes(TABLE_NAME, COLUMNS); +var entityFields = DuplicateScannerUtils.getFilterFields(pTargetEntity); var batchSize = parseInt(project.getPreferenceValue("custom.duplicates.dataBlockSize", "5000")); var batchPos = 0; -while(true) +do { - var inserts = []; - - var entityFields = indexsearchFilter.getFields(); - entityFields.add(pTargetIdField); var entityRowsConfig = entities.createConfigForLoadingRows() .entity(pTargetEntity) - .fields(Array.from(entityFields)) + .fields(entityFields) .startrow(batchPos).count(batchSize); var entityRows = entities.getRows(entityRowsConfig); entityRows.forEach(function(entityRow) { - var currEntityRowId = entityRow[pTargetIdField]; - var indexPattern = indexsearchFilter.buildQuery(entityRow); - var duplicates = DuplicateScannerUtils.getDuplicateIds(pTargetEntity, indexPattern, currEntityRowId); - - if(duplicates.length > 0) - { - var values = [ - util.getNewUUID(), - pTargetEntity, currEntityRowId, - duplicates.length.toFixed(0) - ]; - inserts.push([TABLE_NAME, COLUMNS, COLUMN_TYPES, values]); - } + var duplicateObject = DuplicateScannerUtils.getDataForDuplicateCheck(pTargetEntity, entityRow); + DuplicateScannerUtils.updateHasDuplicateEntryForExtern(duplicateObject); }); - - db.inserts(inserts); - if(entityRows.length < batchSize) - { - break; - } + batchPos += batchSize; } +while (entityRows.length >= batchSize); notification.addNotificationWith(notification.createConfig() -.addUserWithId(vars.get("$sys.user")) +.addUserWithId(EmployeeUtils.getCurrentUserId()) .notificationType("_____SYSTEM_NOTIFICATION_MESSAGE") -.caption(translate.text("Duplicaterow rebuild")) -.description(translate.withArguments("The duplicate row corrosponding to %0 has been rebuild", [pFilterName]))); - -logging.log(pFilterName + " has been rebuild"); +.caption(pCaption) +.description(pCescription)); \ No newline at end of file