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

@@ -23,26 +23,18 @@ function booking_confirm_page() {
//fetch details about the person
$query = db_select('booking_person', 'p');
$query->join('booking_price', 'pr', 'p.booking_payment_id = pr.pid');
$query->condition('p.booking_tempid', arg(1), '=')
->fields('p')
->fields('pr', array('booking_price', 'booking_price_descrip'));
->fields('p', array('nid'));
$person = $query->execute()
->fetchObject();
/*
$person = db_query("SELECT person.nid, person.booking_event_id, person.booking_lastname, person.booking_firstname, price.booking_buttonid, price.booking_price, price.booking_price_descrip, booking_partner_id, " .
" person.booking_married, person.booking_partner_name, person.booking_status " .
"FROM {booking_person} person, {booking_price} price " .
"WHERE booking_tempid = :tempid " .
"AND person.booking_payment_id = price.pid",
array(':tempid' => arg(1)))
->fetchObject();
*/
if ($person) {
if ($person)
{
//load all the fields
$node = node_load($person->nid);
//maximum length for invoice id is 127 characters
$invoiceid = $person->nid . '_' . $person->booking_event_id . '_' . $person->booking_lastname . '-' . $person->booking_firstname;
$invoiceid = $person->nid . '_' . $node->booking_event_id . '_' . $node->booking_lastname . '-' . $node->booking_firstname;
$invoiceid = substr($invoiceid, 0, 126);
} else {
drupal_set_message("Unable to find matching session ID " . arg(1), 'error', FALSE);
@@ -50,27 +42,15 @@ function booking_confirm_page() {
}
//check if this registration will be on the waiting list
if (_booking_check_bookings_full() == True || $person->booking_status == 2)
if (_booking_check_bookings_full() == True || $node->booking_status == 2)
$waiting_list = TRUE;
//Calculate the amount outstanding
//$amount_owing = _booking_amount_owing($person->nid);
//populate tokens
/*
$tokens = array();
$tokens['eventname'] = $event->booking_eventname;
$tokens['fname'] = ucwords(trim($person->booking_firstname));
$tokens['booking-id'] = $person->nid;
$tokens['payment-transaction-desc'] = $person->nid . ' ' . $person->booking_lastname;
$tokens['payment-required'] = $person->booking_price;
$tokens['waitinglist-position'] = "";
*/
$tokens = booking_define_personspecific_tokens($person);
$tokens = booking_define_personspecific_tokens($node);
//TODO: add in the paypal forms as tokens
$tokens['paypal-deposit-form'] = _booking_paypal_form($person, $invoiceid, $tokens['paypal-deposit-amount'], "Pay Deposit");
$tokens['paypal-total-form'] = _booking_paypal_form($person, $invoiceid, $tokens['paypal-total-amount'], "Pay Full Amount");
$tokens['paypal-deposit-form'] = _booking_paypal_form($node, $invoiceid, $tokens['paypal-deposit-amount'], "Pay Deposit");
$tokens['paypal-total-form'] = _booking_paypal_form($node, $invoiceid, $tokens['paypal-total-amount'], "Pay Full Amount");
//watchdog('booking', 'Paypal form "@info"', array ('@info' => var_export($tokens['paypal-total-form'], TRUE)));
@@ -99,7 +79,7 @@ function booking_confirm_page() {
}
//optional additional text for married people
if ($person->booking_married == 'Y')
if ($node->booking_married == 'Y')
{
$output .= token_replace(variable_get('booking_regn_confirm_married_text'), $tokens);
}