Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use template variable to add or remove swap button. #21003

Merged
merged 1 commit into from
Aug 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
  • Loading branch information
eileenmcnaughton committed Aug 3, 2021
commit 8eaec91e05b669fee82ee5f603591fd62ba2dd4d
1 change: 1 addition & 0 deletions CRM/Activity/Form/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@ public function setDefaultValues() {
$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);
}
}

Expand Down
2 changes: 1 addition & 1 deletion templates/CRM/Activity/Form/Activity.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
<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>
Expand Down