540 lines
26 KiB
PHP
540 lines
26 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Function to allow admin user to define contents of workflow emails that can be sent by Bookings module
|
|
*
|
|
* @param
|
|
* @return form render array
|
|
*/
|
|
function booking_emails_workflow_admin() {
|
|
global $event;
|
|
$form = array();
|
|
//some initial workflow email definitions
|
|
$default_email_text = "Dear [booking:fname],\n" .
|
|
"Congratulations, you are officially booked into [booking:eventname]. " .
|
|
"Your registration reference number is [booking:booking-id].\n" .
|
|
"Please don't hesitate to contact us if you have any queries by replying to this email. " .
|
|
"We look forward to seeing you (God Willing) at [booking:eventname]!\n" .
|
|
"Love in Jesus,\n[booking:eventname] Registrations Team\n" .
|
|
"________________________________________________________\n" .
|
|
"The following information shows the details you entered when you registered. " .
|
|
"If any of this information is incorrect, please reply to this email with the corrections as soon as possible.\n" .
|
|
"________________________________________________________";
|
|
$booking_email_regn_complete_text = "Dear [booking:fname],\n" .
|
|
"Thank-you for completing your payment for [booking:eventname].\n" .
|
|
"Please don't hesitate to contact us if you have any queries by replying to this email. " .
|
|
"We look forward to seeing you (God Willing) at [booking:eventname]!\n" .
|
|
"Love in Jesus,\n[booking:eventname] Registrations Team\n" .
|
|
"________________________________________________________\n" .
|
|
"The following information shows the details you entered when you registered. " .
|
|
"If any of this information is incorrect, please reply to this email with the corrections as soon as possible.\n" .
|
|
"________________________________________________________";
|
|
$booking_email_waitinglist_text = "Dear [booking:fname],\n" .
|
|
"Thank-you for registering to attend [booking:eventname]. Unfortunately the venue for this event is full, and you have been placed on the waiting list to attend.\n" .
|
|
"We will contact you if a position becomes available for you. Please don't hesitate to contact us if you have any queries by replying to this email.\n" .
|
|
"Love in Jesus,\n[booking:eventname] Registrations Team\n" .
|
|
"________________________________________________________\n" .
|
|
"The following information shows the details you entered when you registered. " .
|
|
"If any of this information is incorrect, please reply to this email with the corrections as soon as possible.\n" .
|
|
"________________________________________________________";
|
|
$booking_email_paymentoutstanding_text = "Dear [booking:fname],\n" .
|
|
"Thank-you for registering to attend [booking:eventname]. Our records indicate that you currently have $[booking:payment-required] outstanding to finalise your registration.\n" .
|
|
"Please visit [booking:balance-payment-link] in order to make your final payment.\n" .
|
|
"Love in Jesus,\n[booking:eventname] Registrations Team\n" .
|
|
"________________________________________________________\n";
|
|
$booking_email_waitinglistpromotion = "Dear [booking:fname],\n" .
|
|
"We have some great news for you. A place at [booking:eventname] for you has just become available. " .
|
|
"If you wish to secure your place at [booking:eventname], please visit [booking:balance-payment-link] to make your final payment. " .
|
|
"Our records indicate that you currently have $[booking:paypal-total-amount] outstanding (including Paypal transaction fees).\n" .
|
|
"Once we have received your payment, you will be sent an automatic confirmation email thanking you for paying your outstanding fees. " .
|
|
"If you are paying via Paypal's eCheque feature, please be aware that payments take 3-5 working days to clear, " .
|
|
"and you will not receive the confirmation email until that has occurred.\n" .
|
|
"Please don't hesitate to contact us if you have any queries by replying to this email. We look forward to seeing you, God Willing, at [booking:eventname]\n" .
|
|
"Love in Jesus,\n[booking:eventname] Registrations Team.";
|
|
$booking_email_waitinglistpromotion_fullypaid = "Dear [booking:fname],\n" .
|
|
"We have some great news for you. A place at [booking:eventname] for you has just become available. " .
|
|
"Our records indicate that you have already fully paid, so there is nothing further needed to secure your spot.\n" .
|
|
"Please don't hesitate to contact us if you have any queries by replying to this email. We look forward to seeing you, God Willing, at [booking:eventname]\n" .
|
|
"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) {
|
|
$form_type = 'text_format';
|
|
$form_format = 'full_html';
|
|
}
|
|
else {
|
|
$form_type = 'textarea';
|
|
$form_format = NULL;
|
|
}
|
|
|
|
//include the token definitions
|
|
$form['tokens'] = array(
|
|
'#theme' => 'token_tree',
|
|
'#token_types' => array('booking'),
|
|
);
|
|
|
|
/*Text for emails*/
|
|
$form['emails'] = array(
|
|
'#type' => 'fieldset',
|
|
'#title' => 'Built-In Workflow Email Definitions',
|
|
'#collapsible' => TRUE,
|
|
'#collapsed' => FALSE,
|
|
);
|
|
|
|
//if HTML mail is enabled, allow user to specify footer
|
|
if(variable_get('booking_enable_html_mail', 0) == 1) {
|
|
$form['emails']['booking_html_mail_footer'] = array(
|
|
'#title' => t('Footer text for HTML email'),
|
|
'#description' => t('Enter HTML to go in the footer of the email template (above the social media icons).<br /><strong>NOTE:</strong> No token subsitutions will be made here.'),
|
|
'#default_value' => isset(variable_get('booking_html_mail_footer')['value']) ? variable_get('booking_html_mail_footer')['value'] : variable_get('booking_html_mail_footer', '<p> </p>'),
|
|
'#type' => 'text_format',
|
|
'#format' => 'full_html',
|
|
);
|
|
}
|
|
$form['emails']['booking_email_notification_text'] = array(
|
|
'#title' => t('Notification Email'),
|
|
'#description' => t('Email to send to the notification email address (defined in general configuration) when a person has registered'),
|
|
'#default_value' => isset(variable_get('booking_email_notification_text')['value']) ? variable_get('booking_email_notification_text')['value'] : variable_get('booking_email_notification_text', '[booking:regn-summary]'),
|
|
'#type' => $form_type,
|
|
'#format' => $form_format,
|
|
);
|
|
$form['emails']['booking_email_bookedin_text'] = array(
|
|
'#title' => t('Registration Successful Email'),
|
|
'#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' => isset(variable_get('booking_email_bookedin_text')['value']) ? variable_get('booking_email_bookedin_text')['value'] : variable_get('booking_email_bookedin_text', $default_email_text),
|
|
'#type' => $form_type,
|
|
'#format' => $form_format,
|
|
);
|
|
$form['emails']['booking_email_regn_complete_text'] = array(
|
|
'#title' => t('Payment Complete Email'),
|
|
'#description' => t('Email text to indicate a person has booked in, fully paid and is not on the waiting list. ' .
|
|
'This will be sent either at initial registration if the full amount is paid, or when the balance is paid.'),
|
|
'#default_value' => isset(variable_get('booking_email_regn_complete_text')['value']) ? variable_get('booking_email_regn_complete_text')['value'] : variable_get('booking_email_regn_complete_text', $booking_email_regn_complete_text),
|
|
'#type' => $form_type,
|
|
'#format' => $form_format,
|
|
);
|
|
$form['emails']['booking_email_waitinglist_text'] = array(
|
|
'#title' => t('Registration on Waiting List Email'),
|
|
'#description' => t('Email text to indicate a person has registered but is on the waiting list. ' .
|
|
'This will be sent instead of the Registration Successful or Registration Complete emails if the person is on the waiting list.'),
|
|
'#default_value' => isset(variable_get('booking_email_waitinglist_text')['value']) ? variable_get('booking_email_waitinglist_text')['value'] : variable_get('booking_email_waitinglist_text', $booking_email_waitinglist_text),
|
|
'#type' => $form_type,
|
|
'#format' => $form_format,
|
|
);
|
|
$form['emails']['booking_email_partialpayment_received_text'] = array(
|
|
'#title' => t('Email text to send a person thanking them for their partial payment'),
|
|
'#description' => t(''),
|
|
'#default_value' => isset(variable_get('booking_email_partialpayment_received_text')['value']) ? variable_get('booking_email_partialpayment_received_text')['value'] : variable_get('booking_email_partialpayment_received_text', ''),
|
|
'#type' => $form_type,
|
|
'#format' => $form_format,
|
|
);
|
|
$form['emails']['booking_email_paymentoutstanding_subject'] = array (
|
|
'#type' => 'textfield',
|
|
'#title' => t('Balance Outstanding Email Subject'),
|
|
'#description' => t('Subject line for email advising attendee they missed the payment deadline'),
|
|
'#size' => 150,
|
|
'#maxlength' => 300,
|
|
'#default_value' => variable_get('booking_email_paymentoutstanding_subject','[booking:eventname] payment required'),
|
|
);
|
|
$form['emails']['booking_email_paymentoutstanding_text'] = array(
|
|
'#description' => t('Email text to send a person reminding them of how much they owe'),
|
|
'#title' => t('Balance Outstanding Email Text'),
|
|
'#default_value' => isset(variable_get('booking_email_paymentoutstanding_text')['value']) ? variable_get('booking_email_paymentoutstanding_text')['value'] : variable_get('booking_email_paymentoutstanding_text', $booking_email_paymentoutstanding_text),
|
|
'#type' => $form_type,
|
|
'#format' => $form_format,
|
|
);
|
|
|
|
$form['emails']['booking_email_paymentoutstanding_married_text'] = array(
|
|
'#title' => t('Email text to send a married couple reminding them of how much they both owe (only applies when combined pricing enabled)'),
|
|
'#description' => t(''),
|
|
'#default_value' => isset(variable_get('booking_email_paymentoutstanding_married_text')['value']) ? variable_get('booking_email_paymentoutstanding_married_text')['value'] : variable_get('booking_email_paymentoutstanding_married_text', $booking_email_paymentoutstanding_married_text),
|
|
'#type' => $form_type,
|
|
'#format' => $form_format,
|
|
);
|
|
$form['emails']['booking_email_waitinglistpromotion'] = array(
|
|
'#title' => t('Email text to send a person on the waiting list when a spot opens up for them but they have an outstanding balance.'),
|
|
'#description' => t(''),
|
|
'#default_value' => isset(variable_get('booking_email_waitinglistpromotion')['value']) ? variable_get('booking_email_waitinglistpromotion')['value'] : variable_get('booking_email_waitinglistpromotion', $booking_email_waitinglistpromotion),
|
|
'#type' => $form_type,
|
|
'#format' => $form_format,
|
|
);
|
|
$form['emails']['booking_email_waitinglistpromotion_fullypaid'] = array(
|
|
'#title' => t('Email text to send a person on the waiting list when a spot opens up for them and they have already fully paid.'),
|
|
'#description' => t(''),
|
|
'#default_value' => isset(variable_get('booking_email_waitinglistpromotion_fullypaid')['value']) ?
|
|
variable_get('booking_email_waitinglistpromotion_fullypaid')['value'] :
|
|
variable_get('booking_email_waitinglistpromotion_fullypaid', $booking_email_waitinglistpromotion_fullypaid),
|
|
'#type' => $form_type,
|
|
'#format' => $form_format,
|
|
);
|
|
$form['emails']['booking_email_notcoming_demotion_subject'] = array (
|
|
'#type' => 'textfield',
|
|
'#title' => t('Withdrawal Processed Email'),
|
|
'#description' => t('Subject line for email advising attendee their withdrawal has been processed'),
|
|
'#size' => 150,
|
|
'#maxlength' => 300,
|
|
'#default_value' => variable_get('booking_email_notcoming_demotion_subject','[booking:eventname] withdrawal processed'),
|
|
);
|
|
$form['emails']['booking_email_notcoming_demotion'] = array(
|
|
'#title' => t('Email text to send a person who withdraws their registration'),
|
|
'#description' => t(''),
|
|
'#default_value' => isset(variable_get('booking_email_notcoming_demotion')['value']) ? variable_get('booking_email_notcoming_demotion')['value'] : variable_get('booking_email_notcoming_demotion', $booking_email_notcoming_demotion),
|
|
'#type' => $form_type,
|
|
'#format' => $form_format,
|
|
);
|
|
$form['emails']['booking_email_missedpayment_subject'] = array (
|
|
'#type' => 'textfield',
|
|
'#title' => t('Missed Payment Email Subject'),
|
|
'#description' => t('Subject line for email advising attendee they missed the payment deadline'),
|
|
'#size' => 150,
|
|
'#maxlength' => 300,
|
|
'#default_value' => variable_get('booking_email_missedpayment_subject','[booking:eventname] payment deadline missed'),
|
|
);
|
|
$form['emails']['booking_email_missedpayment'] = array(
|
|
'#title' => t('Missed Payment Email Text'),
|
|
'#description' => t('Email text to send a person who missed the payment deadline'),
|
|
'#default_value' => isset(variable_get('booking_email_missedpayment')['value']) ? variable_get('booking_email_missedpayment')['value'] : variable_get('booking_email_missedpayment', ''),
|
|
'#type' => $form_type,
|
|
'#format' => $form_format,
|
|
);
|
|
$form['emails']['booking_email_travel_initial_email_subject'] = array (
|
|
'#type' => 'textfield',
|
|
'#title' => t('Initial Travel Form Required Subject'),
|
|
'#description' => t('Subject line for first email requesting attendee to complete the travel form'),
|
|
'#size' => 150,
|
|
'#maxlength' => 300,
|
|
'#default_value' => variable_get('booking_email_travel_initial_email_subject','[booking:eventname] Travel Details Required'),
|
|
);
|
|
$form['emails']['booking_email_travel_initial_email_text'] = array(
|
|
'#title' => t('Initial Travel Form Required Text'),
|
|
'#description' => t('Text for first email requesting attendee to complete the travel form. This email will be sent from the !email email address', array('!email' => variable_get('booking_logistics_email'))),
|
|
'#default_value' => isset(variable_get('booking_email_travel_initial_email_text')['value']) ? variable_get('booking_email_travel_initial_email_text')['value'] : variable_get('booking_email_travel_initial_email_text', ''),
|
|
'#type' => $form_type,
|
|
'#format' => $form_format,
|
|
);
|
|
$form['emails']['booking_email_travel_reminder_email_subject'] = array (
|
|
'#type' => 'textfield',
|
|
'#title' => t('Reminder Travel Form Required Subject'),
|
|
'#description' => t('Subject line for reminder email requesting attendee to complete the travel form'),
|
|
'#size' => 150,
|
|
'#maxlength' => 300,
|
|
'#default_value' => variable_get('booking_email_travel_reminder_email_subject','[booking:eventname] Travel Details Required'),
|
|
);
|
|
$form['emails']['booking_email_travel_reminder_email_text'] = array(
|
|
'#title' => t('Reminder Travel Form Required Text'),
|
|
'#description' => t('Text for reminder email requesting attendee to complete the travel form. This email will be sent from the !email email address', array('!email' => variable_get('booking_logistics_email'))),
|
|
'#default_value' => isset(variable_get('booking_email_travel_reminder_email_text')['value']) ? variable_get('booking_email_travel_reminder_email_text')['value'] : variable_get('booking_email_travel_reminder_email_text', ''),
|
|
'#type' => $form_type,
|
|
'#format' => $form_format,
|
|
);
|
|
$form['emails']['booking_email_travel_complete_subject'] = array (
|
|
'#type' => 'textfield',
|
|
'#title' => t('Travel Form Complete Subject'),
|
|
'#description' => t('Subject line for email indicating a person has completed the travel form'),
|
|
'#size' => 150,
|
|
'#maxlength' => 300,
|
|
'#default_value' => variable_get('booking_email_travel_complete_subject','[booking:eventname] Travel Details Received'),
|
|
);
|
|
$form['emails']['booking_email_travel_complete_text'] = array(
|
|
'#title' => t('Travel Form Complete Text'),
|
|
'#description' => t('Email text to indicate a person has completed the travel form. This email will be sent from the !email email address', array('!email' => variable_get('booking_logistics_email'))),
|
|
'#default_value' => isset(variable_get('booking_email_travel_complete_text')['value']) ? variable_get('booking_email_travel_complete_text')['value'] : variable_get('booking_email_travel_complete_text', ''),
|
|
'#type' => $form_type,
|
|
'#format' => $form_format,
|
|
);
|
|
|
|
//let the builtin hook do all the hard work
|
|
return system_settings_form($form, FALSE);
|
|
}
|
|
|
|
/**
|
|
* Hook form() to use ajax to allow admin user to define custom emails that can be sent by Bookings module
|
|
*
|
|
* @param
|
|
* @return form render array
|
|
*/
|
|
function booking_emails_custom_ajax_form($node, &$form_state) {
|
|
global $event;
|
|
$form = array();
|
|
$email_options_array = array();
|
|
$data = $node;
|
|
$submit_button_disabled = TRUE;
|
|
|
|
//$email_options_array = _booking_custom_email_types();
|
|
$email_options_array['NULL'] = "---";
|
|
//add in the custom email types
|
|
for ($i = 1; $i <= variable_get('booking_custom_email_count','5'); $i++) {
|
|
$email_options_array['custom' . $i] = variable_get('booking_email_subject_custom' . $i, $event->booking_eventname . ' custom ' . $i);
|
|
}
|
|
//add in the custom email types from logistics
|
|
for ($i = 1; $i <= 5; $i++) {
|
|
$email_options_array['customlogistics' . $i] = variable_get('booking_email_subject_customlogistics' . $i,
|
|
$event->booking_eventname . ' logistics custom ' . $i) . " **Logistics**";
|
|
}
|
|
|
|
// Populate some default values if a selection has already been made
|
|
//watchdog('booking_debug', 'booking_emails_custom_ajax_form state: <pre>@info</pre>', array('@info' => print_r( $form_state, true)));
|
|
|
|
if (!isset($form_state['input']['email-type'])) {
|
|
$subject_value = "";
|
|
$body_value = "";
|
|
}
|
|
else {
|
|
//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'];
|
|
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') {
|
|
$submit_button_disabled = FALSE;
|
|
}
|
|
}
|
|
|
|
// Define the textareas in the form differently if HTML emails are enabled
|
|
if(variable_get('booking_enable_html_mail', 0) == 1) {
|
|
$form_type = 'text_format';
|
|
$form_format = 'full_html';
|
|
}
|
|
else {
|
|
$form_type = 'textarea';
|
|
$form_format = NULL;
|
|
}
|
|
|
|
$form['#prefix'] = '<div id="booking_emails_custom_fieldset_wrapper">';
|
|
$form['#suffix'] = '</div>';
|
|
|
|
//include the token definitions
|
|
$form['tokens'] = array(
|
|
'#theme' => 'token_tree',
|
|
'#token_types' => array('booking'),
|
|
);
|
|
|
|
$form['email-type'] = array(
|
|
'#type' => 'select',
|
|
'#title' => t('Email Type'),
|
|
'#required' => TRUE,
|
|
'#default_value' => 'NULL',
|
|
'#options' => $email_options_array,
|
|
'#ajax' => array(
|
|
'event' => 'change',
|
|
'callback' => 'booking_emails_custom_ajax_form_callback',
|
|
'wrapper' => 'booking_emails_custom_fieldset_wrapper',
|
|
),
|
|
);
|
|
|
|
$form['email-definition'] = array(
|
|
'#type' => 'fieldset',
|
|
'#title' => 'Email Definition',
|
|
//'#prefix' => '<div id="booking_emails_custom_fieldset_wrapper">',
|
|
//'#suffix' => '</div>'
|
|
);
|
|
|
|
$form['email-definition']['booking_email_subjectline_custom'] = array (
|
|
'#type' => 'textfield',
|
|
'#title' => t('Subject line for Custom Email'),
|
|
'#size' => 150,
|
|
'#maxlength' => 300,
|
|
'#value' => $subject_value,
|
|
//'#value' => isset($form_state['values']['booking_email_subjectline_custom']) ? $form_state['values']['booking_email_subjectline_custom'] : '',
|
|
);
|
|
$form['email-definition']['booking_email_body_custom'] = array(
|
|
'#title' => t('Email text for custom email'),
|
|
'#description' => t(''),
|
|
'#value' => $body_value,
|
|
//'#value' => isset($form_state['values']['booking_email_body_custom']) ? $form_state['values']['booking_email_body_custom'] : '',
|
|
'#type' => $form_type,
|
|
'#format' => $form_format,
|
|
'#rows' => 20,
|
|
);
|
|
|
|
$form['submit'] = array(
|
|
'#type' => 'submit',
|
|
'#value' => t('Save'),
|
|
'#disabled' => $submit_button_disabled,
|
|
);
|
|
|
|
return array (
|
|
'form' => $form,
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Callback function to display the custom email definition for form booking_emails_custom_ajax_form
|
|
*/
|
|
function booking_emails_custom_ajax_form_callback($form, &$form_state) {
|
|
global $event;
|
|
$text = "";
|
|
$data = $form_state['input'];
|
|
|
|
//check the selected email type
|
|
$emailtype = $form_state['input']['email-type'];
|
|
|
|
//configure the input text field and textarea based on select field
|
|
if (strpos($emailtype, 'custom') !== false) {
|
|
$subject = variable_get('booking_email_subject_' . $emailtype, '');
|
|
$form['form']['email-definition']['booking_email_subjectline_custom']['#value'] = $subject;
|
|
|
|
$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)));
|
|
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'] = '';
|
|
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;
|
|
}
|
|
|
|
//watchdog('booking_debug', 'booking_emails_custom_ajax_form_callback: <pre>@info</pre>', array('@info' => print_r( $form, true)));
|
|
|
|
// Rebuild the form
|
|
$form_state['rebuild'] = TRUE;
|
|
return $form['form'];
|
|
}
|
|
|
|
/**
|
|
* Process the submission for the custom email definition form
|
|
*/
|
|
function booking_emails_custom_ajax_form_submit($form, &$form_state) {
|
|
global $event;
|
|
$values = $form_state['input'];
|
|
|
|
$emailtype = $values['email-type'];
|
|
variable_set('booking_email_subject_' . $emailtype, $values['booking_email_subjectline_custom']);
|
|
variable_set('booking_email_' . $emailtype, $values['booking_email_body_custom']);
|
|
$form_state['rebuild'] = TRUE;
|
|
}
|
|
|
|
/**
|
|
* Function to allow admin user to define custom emails that can be sent by Bookings module
|
|
*
|
|
* @param
|
|
* @return form render array
|
|
*/
|
|
function booking_emails_custom_admin() {
|
|
global $event;
|
|
$form = array();
|
|
|
|
if(variable_get('booking_enable_html_mail', 0) == 1) {
|
|
$form_type = 'text_format';
|
|
$form_format = 'full_html';
|
|
}
|
|
else {
|
|
$form_type = 'textarea';
|
|
$form_format = NULL;
|
|
}
|
|
|
|
//include the token definitions
|
|
$form['tokens'] = array(
|
|
'#theme' => 'token_tree',
|
|
'#token_types' => array('booking'),
|
|
);
|
|
|
|
/*Text for emails*/
|
|
$form['custom-emails'] = array(
|
|
'#type' => 'fieldset',
|
|
'#title' => 'Custom Email Text Definitions',
|
|
'#collapsible' => TRUE,
|
|
'#collapsed' => FALSE,
|
|
);
|
|
|
|
//add a bunch of custom emails
|
|
for ($i = 1; $i <= variable_get('booking_custom_email_count','5'); $i++) {
|
|
$subject_fieldname = 'booking_email_subject_custom' . $i;
|
|
$body_fieldname = 'booking_email_custom' . $i;
|
|
$form['custom-emails'][$subject_fieldname] = array (
|
|
'#type' => 'textfield',
|
|
'#title' => t('Subject line for Custom Email ' . $i),
|
|
'#size' => 150,
|
|
'#maxlength' => 300,
|
|
'#default_value' => variable_get($subject_fieldname,'[booking:eventname]'),
|
|
);
|
|
$form['custom-emails'][$body_fieldname] = array(
|
|
'#title' => t('Email text for custom email ' . $i),
|
|
'#description' => t(''),
|
|
'#default_value' => isset(variable_get($body_fieldname)['value']) ? variable_get($body_fieldname)['value'] : variable_get($body_fieldname, ''),
|
|
'#type' => $form_type,
|
|
'#format' => $form_format,
|
|
);
|
|
}
|
|
//let the builtin hook do all the hard work
|
|
return system_settings_form($form, FALSE);
|
|
}
|
|
|
|
/**
|
|
* Function to allow admin user to define custom logistics emails that can be sent by Bookings module, from the logistics email address
|
|
*
|
|
* @param
|
|
* @return form render array
|
|
*/
|
|
function booking_emails_customlogistics_admin() {
|
|
global $event;
|
|
$form = array();
|
|
|
|
if(variable_get('booking_enable_html_mail', 0) == 1) {
|
|
$form_type = 'text_format';
|
|
$form_format = 'full_html';
|
|
}
|
|
else {
|
|
$form_type = 'textarea';
|
|
$form_format = NULL;
|
|
}
|
|
|
|
//include the token definitions
|
|
$form['tokens'] = array(
|
|
'#theme' => 'token_tree',
|
|
'#token_types' => array('booking'),
|
|
);
|
|
|
|
/*Text for logistics emails*/
|
|
$form['custom-logistics-emails'] = array(
|
|
'#type' => 'fieldset',
|
|
'#title' => 'Custom Logistics Email Text Definitions',
|
|
'#collapsible' => TRUE,
|
|
'#collapsed' => FALSE,
|
|
);
|
|
|
|
//add a bunch of custom emails
|
|
//@todo add an admin variable for this
|
|
for ($i = 1; $i <= 5; $i++) {
|
|
$subject_fieldname = 'booking_email_subject_customlogistics' . $i;
|
|
$body_fieldname = 'booking_email_customlogistics' . $i;
|
|
$form['custom-logistics-emails'][$subject_fieldname] = array (
|
|
'#type' => 'textfield',
|
|
'#title' => t('Subject line for Logistics Custom Email ' . $i),
|
|
'#size' => 150,
|
|
'#maxlength' => 300,
|
|
'#default_value' => variable_get($subject_fieldname,'[booking:eventname] Logistics'),
|
|
);
|
|
$form['custom-logistics-emails'][$body_fieldname] = array(
|
|
'#title' => t('Email text for Logistics Custom Email ' . $i),
|
|
'#description' => t(''),
|
|
'#default_value' => isset(variable_get($body_fieldname)['value']) ? variable_get($body_fieldname)['value'] : variable_get($body_fieldname, ''),
|
|
'#type' => $form_type,
|
|
'#format' => $form_format,
|
|
);
|
|
}
|
|
//let the builtin hook do all the hard work
|
|
return system_settings_form($form, FALSE);
|
|
}
|