Skip to content
Snippets Groups Projects
Commit 3c7f6c1e authored by Benjamin Ulrich's avatar Benjamin Ulrich :speech_balloon: Committed by Sebastian Pongratz
Browse files

[Projekt: xRM-Sales][TicketNr.: 1086832][Person: Verantwortlicher von...

[Projekt: xRM-Sales][TicketNr.: 1086832][Person: Verantwortlicher von Vertriebsprojekt beim Kontakt in der 360° mitanzeigen und FIlter auf Ja/nein umstellen]
parent 93395c5a
No related branches found
No related tags found
No related merge requests found
......@@ -1165,6 +1165,10 @@
<useConsumer v="true" />
<consumer>Contacts</consumer>
<filterConditionProcess>%aditoprj%/entity/Salesproject_entity/recordcontainers/db/filterextensions/responsible_filter/filterConditionProcess.js</filterConditionProcess>
<groupedRecordField>OBJECTMEMBER.CONTACT_ID</groupedRecordField>
<titleRecordField>$$$TITLERECORDFIELD_PLACEHOLDER$$$</titleRecordField>
<isGroupable v="true" />
<groupQueryProcess>%aditoprj%/entity/Salesproject_entity/recordcontainers/db/filterextensions/responsible_filter/groupQueryProcess.js</groupQueryProcess>
<filtertype>BASIC</filtertype>
</filterExtension>
<filterExtension>
......
import("Salesproject_lib");
import("system.result");
result.string(Salesproject.responsibleGroupQueryProcess());
\ No newline at end of file
......@@ -74,13 +74,20 @@ PersUtils.getResolvingDisplaySubSql = function(pRelationIdField, pResponsible)
/**
* creates a sql-part for resolving a person into one string of text (for example the name of a person)
* useful for example in an displayValue-expression to resolave a references which is already joined within the record-container
*
* @param {String} [pOptions] additional options for rendering; use values of ContactTitleRenderer.OPTIONS and pass them by bitwise OR concatination; e.g.: OPTION_1 | OPTION_2 | OPTION_5
*
* @return {String} a sql-part that can be placed within an SQL
*/
PersUtils.getDisplaySqlExpression = function()
PersUtils.getDisplaySqlExpression = function(pOptions)
{
var contact = Contact.createWithColumnPreset();
var renderer = new ContactTitleRenderer(contact, null);
var options = null;
if(pOptions)
{
options = pOptions;
}
var renderer = new ContactTitleRenderer(contact, options);
var expression = renderer.asSql();
return expression;
}
\ No newline at end of file
import("Contact_lib");
import("Person_lib");
import("system.datetime");
import("system.logging");
import("Sql_lib");
......@@ -154,6 +156,48 @@ Salesproject.updateSalesprojectPhase = function(pSalesprojectId, pPhase)
.updateData(true, "SALESPROJECT", ["PHASE"], null, [pPhase]);
}
/**
* Returns the groupQueryProcess for Responsible_filter
*/
Salesproject.responsibleGroupQueryProcess = function()
{
var condition = vars.get("$local.condition");
var stmt = new SqlBuilder()
.from("SALESPROJECT")
.leftJoin("OBJECTMEMBER", newWhere("OBJECTMEMBER.OBJECT_ROWID = SALESPROJECT.SALESPROJECTID")
.and("OBJECTMEMBER.RESPONSIBLE", "1"))
.leftJoin("CONTACT", "OBJECTMEMBER.CONTACT_ID = CONTACT.CONTACTID")
.leftJoin("ORGANISATION", "CONTACT.ORGANISATION_ID = ORGANISATION.ORGANISATIONID")
.leftJoin("PERSON", "PERSON.PERSONID = CONTACT.PERSON_ID");
if(Utils.isNotNullOrEmptyString(condition.trim()))
{
stmt.where(condition);
}
stmt.groupBy(["OBJECTMEMBER.CONTACT_ID", PersUtils.getDisplaySqlExpression(ContactTitleRenderer.OPTIONS.IncludeOrganisation)])
.orderBy(SqlBuilder.caseWhen("OBJECTMEMBER.CONTACT_ID is not null")
.then("OBJECTMEMBER.CONTACT_ID")
.elseString(translate.text("unassigned")));
if (vars.get("$local.count")) // TRUE if the count of the records is needed
{
stmt.select("1");
}
else
{
var caseWhen = SqlBuilder.caseWhen("OBJECTMEMBER.CONTACT_ID is not null")
.then(PersUtils.getDisplaySqlExpression(ContactTitleRenderer.OPTIONS.IncludeOrganisation))
.elseString(translate.text("unassigned"));
var columnlist = vars.get("$local.columnlist");
columnlist = StringUtils.replaceAll(columnlist, "$$$TITLERECORDFIELD_PLACEHOLDER$$$", caseWhen.toString());
stmt.select([columnlist]);
}
return stmt.toString();
}
/**
* Methods used by the SalesprojectConversionRate.
* Do not create an instance of this!
......
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