public $_toContactEmails = array();
/**
- * @param $form
+ * @param CRM_Core_Form $form
*/
static function preProcessFromAddress(&$form) {
$form->_single = FALSE;
}
$form->_fromEmails = CRM_Utils_Array::crmArrayMerge($emails, $domainEmails);
+
+ // Add signature
+ $defaultEmail = civicrm_api3('email', 'getsingle', array('id' => key($form->_fromEmails)));
+ $defaults = array();
+ if (!empty($defaultEmail['signature_html'])) {
+ $defaults['html_message'] = '<br/><br/>--' . $defaultEmail['signature_html'];
+ }
+ if (!empty($defaultEmail['signature_text'])) {
+ $defaults['text_message'] = "\n\n--\n" . $defaultEmail['signature_text'];
+ }
+ $form->setDefaults($defaults);
}
/**
}, 'json');
}
}
- if (!$().find('div.crm-error').text()) {
- $(window).load(function () {
- setSignature();
- });
- }
- $("#fromEmailAddress").change( function( ) {
- setSignature( );
- });
+ $("#fromEmailAddress", form).change(setSignature);
});
</script>