From 33913af68a925ca04020732b3d0a194701f63ab6 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Wed, 22 Oct 2014 11:03:56 -0400 Subject: [PATCH] CRM-15472 - Freeze activity target field if too many contacts --- CRM/Activity/Form/Activity.php | 8 ++++++++ templates/CRM/Activity/Form/Activity.tpl | 8 +++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CRM/Activity/Form/Activity.php b/CRM/Activity/Form/Activity.php index 4f82a425a8..4f6fad8acc 100644 --- a/CRM/Activity/Form/Activity.php +++ b/CRM/Activity/Form/Activity.php @@ -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)); } diff --git a/templates/CRM/Activity/Form/Activity.tpl b/templates/CRM/Activity/Form/Activity.tpl index 8d6a6a2441..62a3a2ee0d 100644 --- a/templates/CRM/Activity/Form/Activity.tpl +++ b/templates/CRM/Activity/Form/Activity.tpl @@ -96,9 +96,11 @@ {$form.assignee_contact_id.html} {if $action neq 4} - -
-
+ {if !$form.target_contact_id.frozen} + + + + {/if} {if $activityAssigneeNotification}
{ts}A copy of this activity will be emailed to each Assignee.{/ts} -- 2.25.1