Skip to content

Commit

Permalink
Merge pull request #21103 from mlutfy/ui38
Browse files Browse the repository at this point in the history
dev/user-interface#38 Contact Edit: Only display signatures if contact has a CMS account
  • Loading branch information
demeritcowboy authored Aug 13, 2021
2 parents 24bb75f + acfdaee commit 7a2e612
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
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>
<div class="email-signature crm-collapsible collapsed">
<div class="collapsible-title">
{ts}Signature{/ts}
Expand Down

0 comments on commit 7a2e612

Please sign in to comment.