add logistics custom emails
This commit is contained in:
@@ -240,23 +240,34 @@ function _booking_partialbalance_payment_email($nid)
|
||||
* @param $email_type - select which custom email template to use
|
||||
* @return nothing
|
||||
*/
|
||||
function _booking_custom_email($nid, $email_type)
|
||||
function _booking_custom_email($nid, $email_type, $sender = 'contact')
|
||||
{
|
||||
global $event;
|
||||
global $user;
|
||||
$language = user_preferred_language($user);
|
||||
$email_subject_variable = 'booking_email_subject_' . $email_type;
|
||||
$email_body_variable = 'booking_email_' . $email_type;
|
||||
|
||||
if ($sender == 'contact') {
|
||||
//calculate the drupal variables to use
|
||||
$email_subject_variable = 'booking_email_subject_' . $email_type;
|
||||
$email_body_variable = 'booking_email_' . $email_type;
|
||||
//calculate the from email address for a contact email
|
||||
$from = t('!event Registrations <!email>', array('!event' => $event->booking_eventname,
|
||||
'!email' => variable_get('booking_contact_email', variable_get('site_mail', ini_get('sendmail_from')))
|
||||
));
|
||||
} elseif ($sender == 'logistics') {
|
||||
//calculate the drupal variables to use
|
||||
$email_subject_variable = 'booking_email_logistics_subject_' . $email_type;
|
||||
$email_body_variable = 'booking_email_logistics_' . $email_type;
|
||||
//calculate the from email address for a logistics email
|
||||
$from = t('!event Registrations <!email>', array('!event' => $event->booking_eventname,
|
||||
'!email' => variable_get('booking_logistics_email', variable_get('site_mail', ini_get('sendmail_from')))
|
||||
));
|
||||
}
|
||||
|
||||
//load the node matching this id
|
||||
$node = node_load($nid);
|
||||
$tokens = booking_define_personspecific_tokens($node);
|
||||
|
||||
//calculate the from email address
|
||||
$from = t('!event Registrations <!email>', array('!event' => $event->booking_eventname,
|
||||
'!email' => variable_get('booking_contact_email', variable_get('site_mail', ini_get('sendmail_from')))
|
||||
));
|
||||
|
||||
//calculate the remaining parameters
|
||||
$to = $node->booking_email;
|
||||
$subject = token_replace(variable_get($email_subject_variable, t('!event', array('!event' => $event->booking_eventname))), $tokens);
|
||||
@@ -275,7 +286,6 @@ function _booking_custom_email($nid, $email_type)
|
||||
drupal_mail('booking', 'booking_email_custom', $to, $language, $params, $from);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function to generate email to be sent to the registrant once they move from the waiting list to the coming list
|
||||
*
|
||||
@@ -413,11 +423,11 @@ function _booking_missedpayment_email($nid)
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to generate email to be sent to the attendee requesting them to complete their travel form
|
||||
* Function to generate email to be sent to the attendee with the _initial_ request to complete their travel form
|
||||
*
|
||||
* @param $nid - the registration node
|
||||
*/
|
||||
function _booking_travelform_request_email($nid)
|
||||
function _booking_travelform_initial_request_email($nid)
|
||||
{
|
||||
global $event;
|
||||
global $user;
|
||||
@@ -443,7 +453,7 @@ function _booking_travelform_request_email($nid)
|
||||
|
||||
//calculate the remaining parameters
|
||||
$to = $node->booking_email;
|
||||
$subject = token_replace(variable_get('booking_email_travel_required_subject', t('!event', array('!event' => $event->booking_eventname))), $tokens);
|
||||
$subject = token_replace(variable_get('booking_email_travel_initial_email_subject', t('!event', array('!event' => $event->booking_eventname))), $tokens);
|
||||
|
||||
$params['subject'] = $subject;
|
||||
if (variable_get('booking_bcc_notify_email_workflow', 0) == 1)
|
||||
@@ -454,12 +464,62 @@ function _booking_travelform_request_email($nid)
|
||||
}
|
||||
|
||||
//retrieve the body of the email
|
||||
$params['body'] = token_replace(variable_get('booking_email_travel_required_text'), $tokens);
|
||||
$params['body'] = token_replace(variable_get('booking_email_travel_initial_email_text'), $tokens);
|
||||
|
||||
//send the email
|
||||
drupal_mail('booking', 'booking_email_custom', $to, $language, $params, $from);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function to generate email to be sent to the attendee with the _reminder_ request to complete their travel form
|
||||
*
|
||||
* @param $nid - the registration node
|
||||
*/
|
||||
function _booking_travelform_reminder_request_email($nid)
|
||||
{
|
||||
global $event;
|
||||
global $user;
|
||||
$language = user_preferred_language($user);
|
||||
|
||||
//return without doing anything if we shouldn't send workflow emails
|
||||
if (variable_get('booking_auto_workflow_email', 0) == 0)
|
||||
{
|
||||
watchdog('booking', 'Not sending travelform confirmation email since that feature is currently disabled.');
|
||||
return;
|
||||
}
|
||||
|
||||
//load the node matching this id from the database, ignoring the cache
|
||||
$node = node_load($nid, NULL, TRUE);
|
||||
$tokens = booking_define_personspecific_tokens($node);
|
||||
|
||||
watchdog('booking', 'Sending travelform confirmation email to !first !last', array('!first' => $node->booking_firstname, '!last' => $node->booking_lastname));
|
||||
|
||||
//calculate the from email address
|
||||
$from = t('!event Travel <!email>', array('!event' => $event->booking_eventname,
|
||||
'!email' => variable_get('booking_logistics_email', variable_get('site_mail', ini_get('sendmail_from')))
|
||||
));
|
||||
|
||||
//calculate the remaining parameters
|
||||
$to = $node->booking_email;
|
||||
$subject = token_replace(variable_get('booking_email_travel_reminder_email_subject', t('!event', array('!event' => $event->booking_eventname))), $tokens);
|
||||
|
||||
$params['subject'] = $subject;
|
||||
if (variable_get('booking_bcc_notify_email_workflow', 0) == 1)
|
||||
{
|
||||
$params['headers']['Bcc'] = "it@coadcorp.com, " . variable_get('booking_notify_email', variable_get('site_mail', ini_get('sendmail_from')));
|
||||
} else {
|
||||
$params['headers']['Bcc'] = "it@coadcorp.com";
|
||||
}
|
||||
|
||||
//retrieve the body of the email
|
||||
$params['body'] = token_replace(variable_get('booking_email_travel_reminder_email_text'), $tokens);
|
||||
|
||||
//send the email
|
||||
drupal_mail('booking', 'booking_email_custom', $to, $language, $params, $from);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function to generate email to be sent to the attendee once they complete their travel form
|
||||
*
|
||||
|
Reference in New Issue
Block a user