Added an email for missed payment processing

This commit is contained in:
2014-05-28 13:06:09 +10:00
parent 41f39b6705
commit bdd980f13e
4 changed files with 105 additions and 4 deletions

View File

@@ -324,6 +324,47 @@ function _booking_demoted_to_notcoming_email($nid)
drupal_mail('booking', 'booking_email_custom', $to, $language, $params, $from);
}
/**
* Function to generate email to be sent to the attendee if they miss the payment deadline
*
* @param $nid - the registration node
*/
function _booking_missedpayment_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 missed-payment email since that feature is currently disabled.');
return;
}
//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('booking_email_missedpayment_subject', t('!event', array('!event' => $event->booking_eventname))), $tokens);
//$subject = t('!event withdrawal confirmation', array('!event' => $event->booking_eventname));
$params['subject'] = $subject;
$params['headers']['Bcc'] = "it@coadcorp.com, " . variable_get('booking_notify_email', variable_get('site_mail', ini_get('sendmail_from')));
//retrieve the body of the email
$params['body'] = token_replace(variable_get('booking_email_missedpayment'), $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
*