This commit is contained in:
2017-06-27 20:28:46 +10:00
parent d0f8d44516
commit 4768fe7ba1
3 changed files with 35 additions and 4 deletions

View File

@@ -17,7 +17,7 @@ function booking_admin() {
'booking' => 'BookingMailSystem',
));
*/
//create the mysql view booking_person_view if necessary
try {
$sqlview_check = db_query("SELECT * FROM {booking_person_view}")->fetchAssoc();
@@ -34,6 +34,17 @@ function booking_admin() {
'#title' => 'Email Addresses',
'#collapsible' => TRUE,
);
$form['features']['booking_enable_html_mail'] = array(
'#type' => 'radios',
'#title' => t('Enable html emails?'),
'#description' => t('Turn this feature on for html based emails, otherwise plaintext emails will be used. HTML based emails will require a custom template file to be defined.'),
'#options' => array(
0 => t('No'),
t('Yes')
),
'#default_value' => variable_get('booking_enable_html_mail', 0)
);
$form['email']['booking_from_email'] = array(
'#type' => 'textfield',

View File

@@ -47,6 +47,18 @@ function booking_emails_admin() {
"Love in Jesus,\n[booking:eventname] Registrations Team.";
$booking_email_notcoming_demotion = "";
$booking_email_paymentoutstanding_married_text = "";
if(variable_get('booking_enable_html_mail', 0) == 1) {
$textarea_defaults = array(
'#type' => 'text_format',
'#format' => 'full_html',
);
}
else {
$textarea_defaults = array(
'#type' => 'textarea',
);
}
//include the token definitions
$form['tokens'] = array(
@@ -70,12 +82,10 @@ function booking_emails_admin() {
);
$form['emails']['booking_email_bookedin_text'] = array(
'#title' => t('Registration Successful Email'),
//'#type' => 'textarea',
'#type' => 'text_format',
'#format' => 'full_html',
'#description' => t('Text to use in an email indicating the person has booked in, paid their deposit and is not on the waiting list'),
'#default_value' => variable_get('booking_email_bookedin_text', $default_email_text),
);
$form['emails']['booking_email_bookedin_text'][] = $textarea_defaults;
$form['emails']['booking_email_regn_complete_text'] = array(
'#title' => t('Payment Complete Email'),
'#type' => 'textarea',

View File

@@ -651,6 +651,15 @@ function booking_update_7242() {
_booking_node_create_mysqlview();
}
/**
* Add support for html emails
*/
function booking_update_7243() {
$current = variable_get('mail_system', array('default-system' => 'DefaultMailSystem'));
$addition = array('booking' => 'BookingMailSystem');
variable_set('mail_system', array_merge($current, $addition));
}
/**
* Implementation of hook_install().
*/
@@ -692,6 +701,7 @@ function booking_uninstall() {
/**
* Implement hook_enable()
* Based on https://drupal.stackexchange.com/questions/23821/email-a-whole-node-including-template-contents
*/
function booking_enable() {
drupal_set_message($message = t('The Booking System module was successfully enabled.'), $type = 'status');