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
$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);
}
}
<td>
{$form.assignee_contact_id.html}
{if $action neq 4}
- {if !$form.target_contact_id.frozen}
+ {if empty($disable_swap_button)}
<a href="#" class="crm-hover-button" id="swap_target_assignee" title="{ts}Swap Target and Assignee Contacts{/ts}" style="position:relative; bottom: 1em;">
<i class="crm-i fa-random" aria-hidden="true"></i>
</a>