Commit 33913af6 authored by colemanw's avatar colemanw

CRM-15472 - Freeze activity target field if too many contacts

parent 29238896
......@@ -567,6 +567,14 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
$defaults['target_contact_id'] = $this->_contactIds;
}
// CRM-15472 - 50 is around the practial limit of how many items a select2 entityRef can handle
if (!empty($defaults['target_contact_id'])) {
$count = count(is_array($defaults['target_contact_id']) ? $defaults['target_contact_id'] : explode(',', $defaults['target_contact_id']));
if ($count > 50) {
$this->freeze(array('target_contact_id'));
}
}
if ($this->_action & (CRM_Core_Action::DELETE | CRM_Core_Action::RENEW)) {
$this->assign('delName', CRM_Utils_Array::value('subject', $defaults));
}
......
......@@ -96,9 +96,11 @@
<td>
{$form.assignee_contact_id.html}
{if $action neq 4}
<a href="#" class="crm-hover-button" id="swap_target_assignee" title="{ts}Swap Target and Assignee Contacts{/ts}" style="position:relative; bottom: 1em;">
<span><div class="icon swap-icon"></div></span>
</a>
{if !$form.target_contact_id.frozen}
<a href="#" class="crm-hover-button" id="swap_target_assignee" title="{ts}Swap Target and Assignee Contacts{/ts}" style="position:relative; bottom: 1em;">
<span class="icon ui-icon-shuffle"></span>
</a>
{/if}
{if $activityAssigneeNotification}
<br />
<span class="description"><span class="icon email-icon"></span>{ts}A copy of this activity will be emailed to each Assignee.{/ts}</span>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment