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

Merge branch '2021_1075401_CommFilter' into '2021.0'

[Projekt: xRM-ContactManagement][TicketNr.: 1075401][Filter: Kommunikationsdaten (Personen & Firmen)]

See merge request xrm/basic!716
parents ee1f303c 30bb4df6
No related branches found
No related tags found
No related merge requests found
Showing
with 162 additions and 4 deletions
......@@ -1724,12 +1724,12 @@
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>STANDARD_EMAIL_COMMUNICATION.value</name>
<isFilterable v="true" />
<isFilterable v="false" />
<isLookupFilter v="false" />
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>STANDARD_PHONE_COMMUNICATION.value</name>
<isFilterable v="true" />
<isFilterable v="false" />
<isLookupFilter v="false" />
</dbRecordFieldMapping>
<consumerMapping>
......@@ -1880,6 +1880,27 @@
<filterConditionProcess>%aditoprj%/entity/Organisation_entity/recordcontainers/db/filterextensions/responsibleassignment/filterConditionProcess.js</filterConditionProcess>
<filtertype>EXTENDED</filtertype>
</filterExtension>
<filterExtension>
<name>Communication_Mail_filter</name>
<title>Communication: Mail</title>
<contentType>TEXT</contentType>
<filterConditionProcess>%aditoprj%/entity/Organisation_entity/recordcontainers/db/filterextensions/communication_mail_filter/filterConditionProcess.js</filterConditionProcess>
<filtertype>BASIC</filtertype>
</filterExtension>
<filterExtension>
<name>Communication_Phone_filter</name>
<title>Communication: Phone</title>
<contentType>TEXT</contentType>
<filterConditionProcess>%aditoprj%/entity/Organisation_entity/recordcontainers/db/filterextensions/communication_phone_filter/filterConditionProcess.js</filterConditionProcess>
<filtertype>BASIC</filtertype>
</filterExtension>
<filterExtension>
<name>Commincation_Link_filter</name>
<title>Communication: Link</title>
<contentType>TEXT</contentType>
<filterConditionProcess>%aditoprj%/entity/Organisation_entity/recordcontainers/db/filterextensions/commincation_link_filter/filterConditionProcess.js</filterConditionProcess>
<filtertype>BASIC</filtertype>
</filterExtension>
</filterExtensions>
</dbRecordContainer>
<indexRecordContainer>
......
import("system.result");
import("system.vars");
import("Contact_lib");
var resultSqlCond = ContactUtils.getCommFilter(vars.get("$local.operator"), (vars.get("$local.rawvalue") ? vars.get("$local.rawvalue") : ""),
vars.get("$local.operator2").trim(), vars.get("$local.comparison"), "LINK");
result.string(resultSqlCond);
\ No newline at end of file
import("system.result");
import("system.vars");
import("Contact_lib");
var resultSqlCond = ContactUtils.getCommFilter(vars.get("$local.operator"), (vars.get("$local.rawvalue") ? vars.get("$local.rawvalue") : ""),
vars.get("$local.operator2").trim(), vars.get("$local.comparison"), "EMAIL");
result.string(resultSqlCond);
\ No newline at end of file
import("system.result");
import("system.vars");
import("Contact_lib");
var resultSqlCond = ContactUtils.getCommFilter(vars.get("$local.operator"), (vars.get("$local.rawvalue") ? vars.get("$local.rawvalue") : ""),
vars.get("$local.operator2").trim(), vars.get("$local.comparison"), "TELEPHONE");
result.string(resultSqlCond);
\ No newline at end of file
......@@ -1671,12 +1671,12 @@
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>STANDARD_EMAIL_COMMUNICATION.value</name>
<isFilterable v="true" />
<isFilterable v="false" />
<isLookupFilter v="false" />
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>STANDARD_PHONE_COMMUNICATION.value</name>
<isFilterable v="true" />
<isFilterable v="false" />
<isLookupFilter v="false" />
</dbRecordFieldMapping>
<consumerMapping>
......@@ -1825,6 +1825,28 @@
<filterConditionProcess>%aditoprj%/entity/Person_entity/recordcontainers/db/filterextensions/supervisorassignment/filterConditionProcess.js</filterConditionProcess>
<filtertype>BASIC</filtertype>
</filterExtension>
<filterExtension>
<name>Communication_Mail_filter</name>
<title>Communication: Mail</title>
<contentType>TEXT</contentType>
<filterConditionProcess>%aditoprj%/entity/Person_entity/recordcontainers/db/filterextensions/communication_mail_filter/filterConditionProcess.js</filterConditionProcess>
<filtertype>BASIC</filtertype>
</filterExtension>
<filterExtension>
<name>Communication_Phone_filter</name>
<title>Communication: Phone</title>
<contentType>TEXT</contentType>
<filterConditionProcess>%aditoprj%/entity/Person_entity/recordcontainers/db/filterextensions/communication_phone_filter/filterConditionProcess.js</filterConditionProcess>
<filtertype>BASIC</filtertype>
</filterExtension>
<filterExtension>
<name>Communication_Link_filter</name>
<title>Communication: Link</title>
<contentType>TEXT</contentType>
<filterConditionProcess>%aditoprj%/entity/Person_entity/recordcontainers/db/filterextensions/communication_link_filter/filterConditionProcess.js</filterConditionProcess>
<isLookupFilter v="false" />
<filtertype>BASIC</filtertype>
</filterExtension>
</filterExtensions>
</dbRecordContainer>
<indexRecordContainer>
......
import("system.result");
import("system.vars");
import("Contact_lib");
var resultSqlCond = ContactUtils.getCommFilter(vars.get("$local.operator"), (vars.get("$local.rawvalue") ? vars.get("$local.rawvalue") : ""),
vars.get("$local.operator2").trim(), vars.get("$local.comparison"), "LINK");
result.string(resultSqlCond);
\ No newline at end of file
import("system.result");
import("system.vars");
import("Contact_lib");
var resultSqlCond = ContactUtils.getCommFilter(vars.get("$local.operator"), (vars.get("$local.rawvalue") ? vars.get("$local.rawvalue") : ""),
vars.get("$local.operator2").trim(), vars.get("$local.comparison"), "EMAIL");
result.string(resultSqlCond);
\ No newline at end of file
import("system.result");
import("system.vars");
import("Contact_lib");
var resultSqlCond = ContactUtils.getCommFilter(vars.get("$local.operator"), (vars.get("$local.rawvalue") ? vars.get("$local.rawvalue") : ""),
vars.get("$local.operator2").trim(), vars.get("$local.comparison"), "TELEPHONE");
result.string(resultSqlCond);
\ No newline at end of file
......@@ -78,6 +78,10 @@
<key>Restore Team</key>
<value>Team wiederherstellen</value>
</entry>
<entry>
<key>Communication: Mail</key>
<value>Kommunikation: E-Mail</value>
</entry>
<entry>
<key>The given Keyword Category Name is already used but needs to be unique</key>
<value>Der angegebene Schlüsselwort Kategoriename existiert bereits, muss aber eindeutig sein</value>
......@@ -102,6 +106,14 @@
<key>Edit Team</key>
<value>Team bearbeiten</value>
</entry>
<entry>
<key>Communication: Phone</key>
<value>Kommunikation: Telefon</value>
</entry>
<entry>
<key>Communication: Link</key>
<value>Kommunikation: Webseite</value>
</entry>
<entry>
<key>The start date has to be before the end date.</key>
<value>Das Startdatum muss vor dem Enddatum sein.</value>
......
......@@ -582,6 +582,61 @@ ContactUtils.getCommRestrictionCount = function(pMedium, pStartDate)
return firstLevel.toString() +") + ("+secondLevel.toString();
}
/**
* returns sql for filtering links, mail addresses or telephone numbers
*
* @param {String} pOperator filter operator
* @param {String} pRawvalue value that is filtered for
* @param {String} pFilterOperatorName name of the filter operator
* @param {String} pComparison comparison operator
* @param {String} pType type of communication
*
* @return {String} the resulting select
*/
ContactUtils.getCommFilter = function(pOperator, pRawvalue, pFilterOperatorName, pComparison, pType)
{
let resultSqlCond;
let addSqlcond = " in ";
//SqlBuilder not implemented as the statement needs to be finished in the switch case
let commpart = "(select COMMUNICATION.CONTACT_ID from COMMUNICATION "
+ " join AB_KEYWORD_ENTRY on AB_KEYWORD_ENTRY.KEYID = COMMUNICATION.MEDIUM_ID "
+ " join AB_KEYWORD_ATTRIBUTERELATION on AB_KEYWORD_ENTRY.AB_KEYWORD_ENTRYID = AB_KEYWORD_ATTRIBUTERELATION.AB_KEYWORD_ENTRY_ID"
+ " where AB_KEYWORD_ATTRIBUTERELATION.CHAR_VALUE = '" + pType + "'";
if (pOperator == 2)
{
addSqlcond = " not in ";
}
resultSqlCond = "CONTACTID " + addSqlcond + commpart + " and COMMUNICATION.ADDR " + pFilterOperatorName;
switch (pComparison)
{
case "EQUAL":
case "NOT_EQUAL":
resultSqlCond = resultSqlCond + " '" + pRawvalue + "')";
break;
case "CONTAINS":
case "CONTAINS_NOT":
resultSqlCond = resultSqlCond + " '%" + pRawvalue + "%')";
break;
case "STARTSWITH":
resultSqlCond = resultSqlCond + " '" + pRawvalue + "%')";
break;
case "ENDSWITH":
resultSqlCond = resultSqlCond + " '%" + pRawvalue + "')";
break;
case "ISNULL":
resultSqlCond = "CONTACTID not in " + commpart + ")";
break;
case "ISNOTNULL":
resultSqlCond = resultSqlCond + ")";
break;
}
return resultSqlCond;
}
/**
* object for handling of a single contact
* provides static- and instance-functions
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment