From be4854d933babebea0a4ebc1f0f16016eca33333 Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Tue, 18 Sep 2018 10:24:12 +1000 Subject: [PATCH] fix email admin form for plain text emails --- booking.emails_admin.inc | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/booking.emails_admin.inc b/booking.emails_admin.inc index 6153c70..7f263ef 100644 --- a/booking.emails_admin.inc +++ b/booking.emails_admin.inc @@ -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:
@info
', 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; }