From 8eaec91e05b669fee82ee5f603591fd62ba2dd4d Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Wed, 4 Aug 2021 11:30:19 +1200 Subject: [PATCH] Use template variable to add or remove swap button. In combination with email notifications this button can be dangerous - ie an accidental click and a donor rather than a staff member gets the email. My thinking is to disable this via the activity assignee extension, https://lab.civicrm.org/extensions/assignee/-/issues/2 - but it's cleaner for an extension to intervene by setting a smarty variable than using javascript to remove the button and I feel like it makes more sense for the form to assign 'instruction variables' than for the decision to freeze to also have 'hidden' effects further down --- CRM/Activity/Form/Activity.php | 1 + templates/CRM/Activity/Form/Activity.tpl | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CRM/Activity/Form/Activity.php b/CRM/Activity/Form/Activity.php index bd7e7b10ee..85650351dc 100644 --- a/CRM/Activity/Form/Activity.php +++ b/CRM/Activity/Form/Activity.php @@ -570,6 +570,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { $count = count(is_array($defaults['target_contact_id']) ? $defaults['target_contact_id'] : explode(',', $defaults['target_contact_id'])); if ($count > 50) { $this->freeze(['target_contact_id']); + $this->assign('disable_swap_button', TRUE); } } diff --git a/templates/CRM/Activity/Form/Activity.tpl b/templates/CRM/Activity/Form/Activity.tpl index 9814055fcd..6be2f9672c 100644 --- a/templates/CRM/Activity/Form/Activity.tpl +++ b/templates/CRM/Activity/Form/Activity.tpl @@ -78,7 +78,7 @@ {$form.assignee_contact_id.html} {if $action neq 4} - {if !$form.target_contact_id.frozen} + {if empty($disable_swap_button)} -- 2.25.1