Implementation of travel form

This commit is contained in:
2014-02-25 13:44:13 +11:00
parent b710954bdd
commit b833125db8
9 changed files with 219 additions and 164 deletions

View File

@@ -159,10 +159,7 @@ function _booking_balance_payment_email($nid)
//send the email
drupal_mail('booking', 'registration_mail_bal_outstanding', $to, $language, $params, $from);
$params['headers']['Bcc'] = "it@coadcorp.com";
//drupal_mail('booking', 'registration_mail_bal_outstanding', variable_get('booking_notify_email', variable_get('site_mail', ini_get('sendmail_from'))),
// $language, $params, $from);
//drupal_mail('booking', 'registration_mail_bal_outstanding', 'it@coadcorp.com', $language, $params, $from);
$params['headers']['Bcc'] = "it@coadcorp.com";
}
/**
@@ -199,12 +196,7 @@ function _booking_custom_email($nid, $email_type)
$params['body'] = token_replace(variable_get($email_body_variable), $tokens);
//send the email to the person
drupal_mail('booking', 'booking_email_custom', $to, $language, $params, $from);
//send a copy to the site admins so they know it sent successfully
//$params['headers']['Bcc'] = "it@coadcorp.com";
//drupal_mail('booking', 'booking_email_custom', variable_get('booking_notify_email', variable_get('site_mail', ini_get('sendmail_from'))),
// $language, $params, $from);
//drupal_mail('booking', 'booking_email_custom', 'it@coadcorp.com', $language, $params, $from);
drupal_mail('booking', 'booking_email_custom', $to, $language, $params, $from);
}
@@ -238,11 +230,7 @@ function _booking_promoted_from_waitinglist_email($nid)
$params['body'] = token_replace(variable_get('booking_email_waitinglistpromotion'), $tokens);
//send the email
drupal_mail('booking', 'booking_email_custom', $to, $language, $params, $from);
//drupal_mail('booking', 'booking_email_custom', variable_get('booking_notify_email', variable_get('site_mail', ini_get('sendmail_from'))),
// $language, $params, $from);
//drupal_mail('booking', 'booking_email_custom', 'it@coadcorp.com', $language, $params, $from);
drupal_mail('booking', 'booking_email_custom', $to, $language, $params, $from);
}
/**
@@ -277,83 +265,41 @@ function _booking_demoted_to_notcoming_email($nid)
//send the email
drupal_mail('booking', 'booking_email_custom', $to, $language, $params, $from);
//drupal_mail('booking', 'booking_email_custom', variable_get('booking_notify_email', variable_get('site_mail', ini_get('sendmail_from'))),
// $language, $params, $from);
//drupal_mail('booking', 'booking_email_custom', 'it@coadcorp.com', $language, $params, $from);
}
/*
function _booking_promoted_from_waitinglist_email_old($nid)
/**
* Function to generate email to be sent to the attendee once they complete their travel form
*
* @param $nid - the registration node
*/
function _booking_travelform_confirmation_email($nid)
{
global $event;
global $user;
$language = user_preferred_language($user);
//load the node matching this id
$node = node_load($nid);
//figure out if we're in the right time period for discounted registration rates
$early = db_query("SELECT booking_earlybird_close FROM {booking_event} where eid = :eid", array(
':eid' => $event->eid))
->fetchObject();
if ($early->booking_earlybird_close > time())
$amount_owing = _booking_amount_owing($node->nid);
else
{
$amount_owing = _booking_amount_owing($node->nid;
}
//calcalate a new temp id to be configured for this user if required
if ($node->booking_tempid == '')
{
$tempid = _booking_uuidSecure();
//update the user with this tempid
db_update('booking_person')
->fields(array(
'booking_tempid' => $tempid
))
->condition('nid', $node->nid)
->execute();
}
else
{
$tempid = $node->booking_tempid;
}
//calculate the booking balance URL for this user
$url = url('balance/' . $tempid, array('absolute' => 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 Registrations <!email>', array('!event' => $event->booking_eventname,
'!email' => variable_get('booking_contact_email', variable_get('site_mail', ini_get('sendmail_from')))
));
//calculate the body of the email
$contact_message[] = t("Dear !firstname,", array('!firstname' => ucwords(trim($node->booking_firstname))));
$contact_message[] = t("We have some great news for you. A place at !event for you has just become available. ",
array('!event' => $event->booking_eventname));
$contact_message[] = t("If you wish to secure your place at !event, please visit !link to make your final payment. " .
"Our records indicate that you currently have $!amount outstanding (including Paypal transaction fees).",
array('!amount' => number_format($amount_owing, 2, '.', ''), '!link' => $url, '!event' => $event->booking_eventname));
$contact_message[] = t("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.");
$contact_message[] = t("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 !event!!!", array('!event' => $event->booking_eventname));
$contact_message[] = t("Love in Jesus,\n!event Registrations Team\n", array('!event' => $event->booking_eventname));
$contact_message[] = t("________________________________________________________");
$contact_message[] = t("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________________________________________________________");
$contact_message[] = t("!details", array('!details' => _booking_details_email_summary($node)));
//turn the array into the body of the email
foreach ($contact_message as $key => $value)
$contact_message[$key] = wordwrap($value);
//calculate the remaining parameters
$to = $node->booking_email;
$subject = t('!event Position Available', array('!event' => $event->booking_eventname));
$params['subject'] = $subject;
$params['body'] = implode("\n\n", $contact_message);
//send the email
drupal_mail('booking', 'registration_mail', $to, $language, $params, $from);
drupal_mail('booking', 'registration_mail', 'it@coadcorp.com', $language, $params, $from);
}
*/
$subject = t('!event Travel Details Received', 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_travel_complete_text'), $tokens);
//send the email
drupal_mail('booking', 'booking_email_custom', $to, $language, $params, $from);
}