Skip to content
Snippets Groups Projects
Commit 79dd9ddf authored by Johannes Goderbauer's avatar Johannes Goderbauer
Browse files

Merge branch '1044295-Fix-Add-InactiveUser-To-CampaignTeam' into 'master'

#1044295 - Fixed adding inactive contacts to an campaign.

See merge request xrm/basic!134
parents 08f3c265 9f78362b
No related branches found
No related tags found
No related merge requests found
......@@ -88,6 +88,10 @@
<name>ExcludedContactIds_param</name>
<valueProcess>%aditoprj%/entity/Member_entity/entityfields/contacts/children/excludedcontactids_param/valueProcess.js</valueProcess>
</entityParameter>
<entityParameter>
<name>OnlyActive_param</name>
<valueProcess>%aditoprj%/entity/Member_entity/entityfields/contacts/children/onlyactive_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
</entityConsumer>
<entityConsumer>
......
......@@ -3,8 +3,10 @@ import("system.vars");
import("system.db");
import("Sql_lib");
result.object(newSelect("CONTACT_ID")
.from("OBJECTMEMBER")
.where("OBJECTMEMBER.OBJECT_ROWID", "$field.OBJECT_ROWID")
.and("OBJECTMEMBER.OBJECT_TYPE", "$field.OBJECT_TYPE")
.arrayColumn());
\ No newline at end of file
var excludeContacts = newSelect("OBJECTMEMBER.CONTACT_ID")
.from("OBJECTMEMBER")
.where("OBJECTMEMBER.OBJECT_ROWID", "$field.OBJECT_ROWID")
.and("OBJECTMEMBER.OBJECT_TYPE", "$field.OBJECT_TYPE")
.arrayColumn();
result.object(excludeContacts);
import("system.vars");
import("system.result");
result.string(true);
\ No newline at end of file
......@@ -788,6 +788,11 @@
<valueProcess>%aditoprj%/entity/Person_entity/entityfields/avatartext_param/valueProcess.js</valueProcess>
<description>PARAMETER</description>
</entityParameter>
<entityParameter>
<name>OnlyActive_param</name>
<valueProcess>%aditoprj%/entity/Person_entity/entityfields/avatartext_param/valueProcess.js</valueProcess>
<description>PARAMETER</description>
</entityParameter>
<entityConsumer>
<name>CommRestrictions</name>
<dependency>
......
import("system.vars");
import("system.result");
result.string(false);
\ No newline at end of file
import("Context_lib");
import("AttributeRegistry_basic");
import("KeywordRegistry_basic");
import("Employee_lib");
import("AttributeFilter_lib");
import("Attribute_lib");
......@@ -9,14 +10,20 @@ import("system.result");
import("Sql_lib");
var cond = newWhereIfSet("CONTACT.ORGANISATION_ID", "$param.OrgId_param")
.andIfSet("CONTACT.CONTACTID", "$param.ContactId_param");
.andIfSet("CONTACT.CONTACTID", "$param.ContactId_param");
if(vars.getString("$param.OnlyActive_param") == "true")
cond.and("CONTACT.STATUS", $KeywordRegistry.contactStatus$inactive(), SqlBuilder.NOT_EQUAL());
if (vars.exists("$param.ExcludedContactIds_param") && vars.get("$param.ExcludedContactIds_param"))
{
var excludedContacts = JSON.parse(vars.getString("$param.ExcludedContactIds_param"));
cond.andIfSet("CONTACT.CONTACTID", excludedContacts, SqlBuilder.NOT_IN());
}
var onlyShowContactIds = JSON.parse(vars.get("$param.OnlyShowContactIds_param"));
if(onlyShowContactIds != null && onlyShowContactIds.length > 0)
{
let additionalCondition = newWhere();
......
......@@ -34,6 +34,7 @@ $KeywordRegistry.activityDirection$internal = function(){return "x";};
$KeywordRegistry.contactStatus = function(){return "ContactStatus";};
$KeywordRegistry.contactStatus$active = function(){return "CONTACTSTATACTIVE";};
$KeywordRegistry.contactStatus$inactive = function(){return "CONTACTSTATINACTIVE";};
$KeywordRegistry.currency = function(){return "Currency";};
$KeywordRegistry.currency$eur = function(){return "EUR";};
......
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