fix email admin form for plain text emails

This commit is contained in:
Nathan Coad
2018-09-18 10:24:12 +10:00
parent d6cb41ad64
commit be4854d933

View File

@@ -284,7 +284,12 @@ function booking_emails_custom_ajax_form($node, &$form_state) {
//watchdog('booking_debug', 'booking_emails_custom_ajax_form user has selected email type ' . $form_state['input']['email-type']);
$emailtype = $form_state['input']['email-type'];
$subject_value = $form_state['input']['booking_email_subjectline_custom'];
$body_value = $form_state['input']['booking_email_body_custom']['value'];
if(variable_get('booking_enable_html_mail', 0) == 1) {
$body_value = $form_state['input']['booking_email_body_custom']['value'];
}
else {
$body_value = $form_state['input']['booking_email_body_custom'];
}
// only enable the submit button if the email type is not the initial empty one
if ($form_state['input']['email-type'] !== 'NULL') {
@@ -379,14 +384,23 @@ function booking_emails_custom_ajax_form_callback($form, &$form_state) {
$text = variable_get('booking_email_' . $emailtype, '');
$text = isset($text['format']) ? $text['value'] : $text;
//watchdog('booking_debug', 'custom text: <pre>@info</pre>', array('@info' => print_r( $text, true)));
// TODO : Figure out what this should be if HTML emails are NOT enabled
$form['form']['email-definition']['booking_email_body_custom']['value']['#value'] = $text;
if(variable_get('booking_enable_html_mail', 0) == 1) {
$form['form']['email-definition']['booking_email_body_custom']['value']['#value'] = $text;
}
else {
$form['form']['email-definition']['booking_email_body_custom']['#value'] = $text;
}
// TODO : Does changing submit button state here do anything?
$form['form']['submit']['#disabled'] = FALSE;
}
else {
$form['form']['email-definition']['booking_email_subjectline_custom']['#value'] = '';
$form['form']['email-definition']['booking_email_body_custom']['value']['#value'] = '';
if(variable_get('booking_enable_html_mail', 0) == 1) {
$form['form']['email-definition']['booking_email_body_custom']['value']['#value'] = '';
}
else {
$form['form']['email-definition']['booking_email_body_custom']['#value'] = '';
}
// TODO : Does changing submit button state here do anything?
$form['form']['submit']['#disabled'] = TRUE;
}