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

dev/user-interface#38 Contact Edit: Only display signatures if contact has a CMS account #21103

Merged
merged 1 commit into from
Aug 13, 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
21 changes: 13 additions & 8 deletions CRM/Contact/Form/Edit/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,19 @@ public static function buildQuickForm(&$form, $blockCount = NULL, $blockEdit = F
$form->addElement('radio', "email[$blockId][is_primary]", '', '', '1', $js);

if (CRM_Utils_System::getClassName($form) == 'CRM_Contact_Form_Contact') {

$form->add('textarea', "email[$blockId][signature_text]", ts('Signature (Text)'),
['rows' => 2, 'cols' => 40]
);

$form->add('wysiwyg', "email[$blockId][signature_html]", ts('Signature (HTML)'),
['rows' => 2, 'cols' => 40]
);
// Only display the signature fields if this contact has a CMS account
// because they can only send email if they have access to the CRM
if (!empty($form->_contactId)) {
$ufID = CRM_Core_BAO_UFMatch::getUFId($form->_contactId);
if ($ufID) {
$form->add('textarea', "email[$blockId][signature_text]", ts('Signature (Text)'),
['rows' => 2, 'cols' => 40]
);
$form->add('wysiwyg', "email[$blockId][signature_html]", ts('Signature (HTML)'),
['rows' => 2, 'cols' => 40]
);
}
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions templates/CRM/Contact/Form/Edit/Email.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@

<tr id="Email_Block_{$blockId}">
<td>{$form.email.$blockId.email.html|crmAddClass:email}&nbsp;{$form.email.$blockId.location_type_id.html}
<div class="clear"></div>
{if $className eq 'CRM_Contact_Form_Contact'}
{if $className eq 'CRM_Contact_Form_Contact' and !empty($form.email.$blockId.signature_html.html)}
<div class="clear"></div>
mlutfy marked this conversation as resolved.
Show resolved Hide resolved
<div class="email-signature crm-collapsible collapsed">
<div class="collapsible-title">
{ts}Signature{/ts}
Expand Down