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

Merge branch '2021.0_1032621_salesprojfilterext' into '2021.0'

2021.0 1032621 salesprojfilterext

See merge request xrm/basic!740
parents 8dfbd1d8 4507572a
No related branches found
No related tags found
No related merge requests found
......@@ -24,5 +24,5 @@
<include relativeToChangelogFile="true" file="basic/2021.0.2/changelog.xml"/>
<!--enable this only when you definetly want to overwrite the existing data with demo records:-->
<!--<include relativeToChangelogFile="true" file="basic/_demoData/changelog.xml" context="example"/>-->
<include relativeToChangelogFile="true" file="basic/_demoData/changelog.xml" context="example"/>
</databaseChangeLog>
\ No newline at end of file
......@@ -1096,6 +1096,22 @@
<filterConditionProcess>%aditoprj%/entity/Salesproject_entity/recordcontainers/db/filterextensions/favorite_filter/filterConditionProcess.js</filterConditionProcess>
<filtertype>BASIC</filtertype>
</filterExtension>
<filterExtension>
<name>Touchpoint_filterExtension</name>
<title>Touchpoint</title>
<contentType>TEXT</contentType>
<filterValuesProcess>%aditoprj%/entity/Salesproject_entity/recordcontainers/db/filterextensions/touchpoint_filterextension/filterValuesProcess.js</filterValuesProcess>
<filterConditionProcess>%aditoprj%/entity/Salesproject_entity/recordcontainers/db/filterextensions/touchpoint_filterextension/filterConditionProcess.js</filterConditionProcess>
<filtertype>BASIC</filtertype>
</filterExtension>
<filterExtension>
<name>Competitor_filterExtension</name>
<title>Competitor</title>
<contentType>TEXT</contentType>
<filterValuesProcess>%aditoprj%/entity/Salesproject_entity/recordcontainers/db/filterextensions/competitor_filterextension/filterValuesProcess.js</filterValuesProcess>
<filterConditionProcess>%aditoprj%/entity/Salesproject_entity/recordcontainers/db/filterextensions/competitor_filterextension/filterConditionProcess.js</filterConditionProcess>
<filtertype>BASIC</filtertype>
</filterExtension>
</filterExtensions>
</dbRecordContainer>
<indexRecordContainer>
......
import("system.result");
import("system.vars");
import("Sql_lib");
import("system.SQLTYPES");
var localvalue = vars.get("$local.rawvalue");
var subselect = newSelect("COMPETITION.OBJECT_ROWID")
.from("COMPETITION")
.where("COMPETITION.OBJECT_TYPE", "Salesproject")
.and("COMPETITION.CONTACT_ID", localvalue || "");
var competitors = newSelect("count(COMPETITION.OBJECT_ROWID)")
.from("COMPETITION")
.where("COMPETITION.OBJECT_TYPE", "Salesproject")
.and("COMPETITION.OBJECT_ROWID = SALESPROJECT.SALESPROJECTID");
var sql;
switch(parseInt(vars.get("$local.operator")))
{
case 1: // equal
sql = newWhere("SALESPROJECT.SALESPROJECTID", subselect, SqlBuilder.IN()).toString();
break;
case 2: // not equal
sql = newWhere("SALESPROJECT.SALESPROJECTID", subselect, SqlBuilder.NOT_IN()).toString();
break;
case 12: // empty
sql = newWhere(competitors, 0, SqlBuilder.EQUAL(), SQLTYPES.NUMERIC).toString();
break;
case 11: // not empty
sql = newWhere(competitors, 0, SqlBuilder.GREATER(), SQLTYPES.NUMERIC).toString();
break;
}
result.string(sql);
import("system.result");
import("Sql_lib");
import("Organisation_lib");
result.object(newSelect([
"CONTACT.CONTACTID",
"ORGANISATION.NAME"
])
.from("ORGANISATION")
.join("CONTACT", newWhere("ORGANISATION.ORGANISATIONID = CONTACT.ORGANISATION_ID"))
.table());
import("system.result");
import("system.vars");
import("Sql_lib");
import("system.SQLTYPES");
var localvalue = vars.get("$local.rawvalue");
var subselect = newSelect("SALESPROJECT.SALESPROJECTID")
.from("SALESPROJECT")
.join("SALESPROJECT_TOUCHPOINT", newWhere(
"SALESPROJECT.SALESPROJECTID = SALESPROJECT_TOUCHPOINT.SALESPROJECT_ID"
))
.where("SALESPROJECT_TOUCHPOINT.TOUCHPOINT", localvalue || ""); // wont be used if op = is null or is not null
var touchpoints = newSelect("count(SALESPROJECT_TOUCHPOINT.SALESPROJECT_ID)")
.from("SALESPROJECT_TOUCHPOINT")
.where("SALESPROJECT.SALESPROJECTID = SALESPROJECT_TOUCHPOINT.SALESPROJECT_ID");
var sql;
switch(parseInt(vars.get("$local.operator")))
{
case 1: // equal
sql = newWhere("SALESPROJECT.SALESPROJECTID", subselect, SqlBuilder.IN()).toString();
break;
case 2: // not equal
sql = newWhere("SALESPROJECT.SALESPROJECTID", subselect, SqlBuilder.NOT_IN()).toString();
break;
case 12: // empty
sql = newWhere(touchpoints, 0, SqlBuilder.EQUAL(), SQLTYPES.NUMERIC).toString();
break;
case 11: // not empty
sql = newWhere(touchpoints, 0, SqlBuilder.GREATER(), SQLTYPES.NUMERIC).toString();
break;
}
result.string(sql);
import("system.result");
import("Keyword_lib");
import("KeywordRegistry_basic");
result.object(KeywordUtils.getEntryNamesAndIdsByContainer($KeywordRegistry.salesprojectSource()));
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