Added partial payment option
This commit is contained in:
@@ -164,6 +164,47 @@ function _booking_balance_payment_email($nid)
|
||||
$params['headers']['Bcc'] = "it@coadcorp.com";
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to generate email to be sent to the registrant thanking them for a partial balance payment
|
||||
*
|
||||
* @param $nid - the registration node
|
||||
*/
|
||||
function _booking_partialbalance_payment_email($nid)
|
||||
{
|
||||
global $event;
|
||||
global $user;
|
||||
$language = user_preferred_language($user);
|
||||
|
||||
//load the node matching this id
|
||||
$node = node_load($nid);
|
||||
$tokens = booking_define_personspecific_tokens($node);
|
||||
|
||||
if ($tokens['payment-required'] <= 0)
|
||||
{
|
||||
watchdog('booking', "Not sending amount owing email, since this person doesn't owe any money: @info", array('@info' => var_export($node, TRUE)));
|
||||
return;
|
||||
}
|
||||
|
||||
//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 = t('!event Partial Payment Required', 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')));
|
||||
|
||||
//TODO: Married couple version of this
|
||||
$params['body'] = token_replace(variable_get('booking_email_partialpayment_received_text'), $tokens);
|
||||
|
||||
//send the email
|
||||
drupal_mail('booking', 'registration_mail_bal_outstanding', $to, $language, $params, $from);
|
||||
$params['headers']['Bcc'] = "it@coadcorp.com";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function to generate email to be sent to the registrant based on custom email template configured in text tokens page
|
||||
*
|
||||
|
Reference in New Issue
Block a user