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

@@ -20,7 +20,15 @@ function booking_balance_page() {
//TODO: if the person says they're married, query to see if they're listed partner has already registered and paid
//if they have, then let the new registration person know their partner has already paid, and send them the confirmation email
//work out the node id from the session id
$query = db_select('booking_person', 'p');
$query->condition('p.booking_tempid', arg(1), '=')
->fields('p', array('nid'));
$person = $query->execute()
->fetchObject();
/*
//fetch details about the person
$query = db_select('booking_person', 'p');
$query->join('booking_price', 'pr', 'p.booking_payment_id = pr.pid');
@@ -29,18 +37,24 @@ function booking_balance_page() {
->fields('pr', array('booking_price', 'booking_price_descrip'));
$person = $query->execute()
->fetchObject();
*/
if ($person) {
//maximum length for invoice id is 127 characters
$invoiceid = $person->nid . '_bal' . REQUEST_TIME . '_' . $person->booking_lastname . '-' . $person->booking_firstname;
if ($person)
{
//load all the fields
$node = node_load($person->nid);
//calculate the invoice ID
$invoiceid = $person->nid . '_bal' . REQUEST_TIME . '_' . $node->booking_lastname . '-' . $node->booking_firstname;
//maximum length for invoice id in paypal is 127 characters so truncate if necessary
$invoiceid = substr($invoiceid, 0, 126);
} else {
drupal_set_message("Unable to find matching session ID " . arg(1), 'error', FALSE);
return "";
}
$tokens = booking_define_personspecific_tokens($person);
$tokens['paypal-total-form'] = _booking_paypal_form($person, $invoiceid, $tokens['paypal-total-amount'], "Pay Balance");
//populate tokens and paypal form
$tokens = booking_define_personspecific_tokens($node);
$tokens['paypal-total-form'] = _booking_paypal_form($node, $invoiceid, $tokens['paypal-total-amount'], "Pay Balance");
//Calculate the amount outstanding
//watchdog('booking', 'Booking Balance form calculating amount owing');
@@ -55,7 +69,7 @@ function booking_balance_page() {
{
$output = token_replace(variable_get('booking_regn_balance_page'), $tokens);
//optional additional text for married people
if ($person->booking_married == 'Y')
if ($node->booking_married == 'Y')
$output .= token_replace(variable_get('booking_regn_balance_married_text'), $tokens);
}