Skip to content
Snippets Groups Projects
Commit 0abe84f5 authored by Benjamin Ulrich's avatar Benjamin Ulrich :speech_balloon:
Browse files

[Projekt: xRM-Sales][TicketNr.: 1086829][Phase Filterextension gruppierung...

[Projekt: xRM-Sales][TicketNr.: 1086829][Phase Filterextension gruppierung nach Phase in richtiger Reihenfolge implementieren]
parent efc79923
No related branches found
No related tags found
No related merge requests found
......@@ -43,7 +43,6 @@
<name>PHASE</name>
<title>Phase</title>
<consumer>SalesprojectPhaseStepper</consumer>
<groupable v="true" />
<mandatory v="true" />
<state>EDITABLE</state>
<displayValueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/phase/displayValueProcess.js</displayValueProcess>
......@@ -1157,6 +1156,21 @@
<filterConditionProcess>%aditoprj%/entity/Salesproject_entity/recordcontainers/db/filterextensions/responsible_filter/filterConditionProcess.js</filterConditionProcess>
<filtertype>BASIC</filtertype>
</filterExtension>
<filterExtension>
<name>Phase_filter</name>
<title>Phase</title>
<contentType>TEXT</contentType>
<useConsumer v="true" />
<consumer>SalesprojectPhaseStepper</consumer>
<filterConditionProcess>%aditoprj%/entity/Salesproject_entity/recordcontainers/db/filterextensions/phase_filter/filterConditionProcess.js</filterConditionProcess>
<groupedRecordField>SALESPROJECT.PHASE</groupedRecordField>
<titleRecordField>$$$TITLERECORDFIELD_PLACEHOLDER$$$</titleRecordField>
<isFilterable v="false" />
<isGroupable v="true" />
<groupQueryProcess>%aditoprj%/entity/Salesproject_entity/recordcontainers/db/filterextensions/phase_filter/groupQueryProcess.js</groupQueryProcess>
<documentation>%aditoprj%/entity/Salesproject_entity/recordcontainers/db/filterextensions/phase_filter/documentation.adoc</documentation>
<filtertype>BASIC</filtertype>
</filterExtension>
</filterExtensions>
</dbRecordContainer>
<indexRecordContainer>
......
== Phase_filter
Not used for filtering, the phase filtering is possible thanks to the PHASE field.
This Extension only exists to make it possible to group by phase while still having them in the correct order.
\ No newline at end of file
import("Salesproject_lib");
import("system.result");
result.string(SalesprojectPhaseFilterUtils.makeFilterCondition());
\ No newline at end of file
import("Salesproject_lib");
import("system.result");
result.string(SalesprojectPhaseFilterUtils.makeGroupQueryProcess());
\ No newline at end of file
......@@ -410,4 +410,57 @@ SalesprojectConversionRate.prototype._getTitleOfKey = function (pKey, pIsGroupin
return KeywordUtils.getViewValue($KeywordRegistry.salesprojectPhase(),pKey);
return pKey;
}
\ No newline at end of file
}
/**
* Methods used by the Salesproject Phase_filter.
* Do not create an instance of this!
*
* @class
*/
function SalesprojectPhaseFilterUtils() {}
/**
* Builds a Sql-condition for a salesproject filter extension. This allows to filter via the salesproject phase whilst havin them in the correct Order
*
* @return {String} condition
*/
SalesprojectPhaseFilterUtils.makeFilterCondition = function()
{
return newWhereIfSet( "SALESPROJECT.PHASE", vars.get("$local.rawvalue"));
}
/**
* Builds a Sql-condition for a salesproject filter extension. This allows to filter via the salesproject phase whilst havin them in the correct Order
*
* @return {String} condition
*/
SalesprojectPhaseFilterUtils.makeGroupQueryProcess = function()
{
var condition = vars.get("$local.condition");
var stmt = new SqlBuilder()
.from("SALESPROJECT")
.leftJoin("AB_KEYWORD_ENTRY", newWhere("AB_KEYWORD_ENTRY.KEYID = SALESPROJECT.PHASE")
.and("AB_KEYWORD_ENTRY.CONTAINER", "SalesprojectPhase"));
if(condition != " ")
{
stmt.where(condition);
}
stmt.groupBy("SALESPROJECT.PHASE, AB_KEYWORD_ENTRY.SORTING")
.orderBy("AB_KEYWORD_ENTRY.SORTING");
if (vars.get("$local.count")) // TRUE if the count of the records is needed
{
stmt.select("1");
}
else
{
var columnlist = vars.get("$local.columnlist");
columnlist = StringUtils.replaceAll(columnlist, "$$$TITLERECORDFIELD_PLACEHOLDER$$$", KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.salesprojectPhase(), "SALESPROJECT.PHASE").toString());
stmt.select([columnlist]);
}
return stmt.toString();
}
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