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