Fix sql query
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
// $Id: booking.confirm.inc,v 0.1 2011/07/12
|
||||
|
||||
/**
|
||||
* Confirmation page for event registration
|
||||
@@ -10,42 +9,39 @@ function booking_confirm_page() {
|
||||
$waiting_list = False;
|
||||
$already_paid = false;
|
||||
$paypal_form = "";
|
||||
$uuid = arg(1);
|
||||
|
||||
//verify that arg(1) is a uuid
|
||||
if (! preg_match('/^[0-9A-Fa-f\-]+$/', arg(1))) {
|
||||
if (! preg_match('/^[0-9A-Fa-f\-]+$/', $uuid)) {
|
||||
//parameter from url is not what we were expecting
|
||||
drupal_set_message("Error: Invalid session ID supplied to the registration confirmation page. Please use the contact us form to let us know.", 'error', FALSE);
|
||||
drupal_goto('<front>');
|
||||
return "";
|
||||
}
|
||||
|
||||
//TODO: if the person says they're married, query to see if they're listed partner has already registered and paid
|
||||
//@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
|
||||
|
||||
//fetch details about the person
|
||||
$query = db_select('booking_person', 'p');
|
||||
$query->condition('p.booking_tempid', arg(1), '=')
|
||||
$query->condition('p.booking_tempid', $uuid, '=')
|
||||
->fields('p', array('nid'));
|
||||
$person = $query->execute()
|
||||
->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 . '_' . $node->booking_eventid . '_' . $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);
|
||||
}
|
||||
else {
|
||||
drupal_set_message("Unable to find matching session ID " . $uuid, 'error', FALSE);
|
||||
drupal_goto('<front>');
|
||||
return "";
|
||||
}
|
||||
|
||||
//check if this registration will be on the waiting list
|
||||
if (_booking_check_bookings_full() == True || $node->booking_status == 2)
|
||||
$waiting_list = TRUE;
|
||||
|
||||
//populate tokens
|
||||
$tokens = booking_define_personspecific_tokens($node);
|
||||
|
||||
@@ -54,29 +50,27 @@ function booking_confirm_page() {
|
||||
$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)));
|
||||
|
||||
//check if this registration will be on the waiting list
|
||||
if (_booking_check_bookings_full() == True || $node->booking_status == 2) {
|
||||
$waiting_list = TRUE;
|
||||
}
|
||||
|
||||
//$tokens['paypal-total-form'] = drupal_get_form('_booking_paypal_form', arg(1), $person, $invoiceid, $tokens['paypal-total-amount']);
|
||||
|
||||
if ($waiting_list == FALSE)
|
||||
{
|
||||
if ($waiting_list == FALSE) {
|
||||
//watchdog('booking', 'Waiting list is false. Un-tokenised text is "@info"', array ('@info' => variable_get('booking_regn_confirm_page')));
|
||||
$output = token_replace(variable_get('booking_regn_confirm_page'), $tokens);
|
||||
//$paypal_form = drupal_get_form('_booking_paypal_form_builder', $person, $invoiceid, $amount_owing, "Pay Full Amount");
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
$output = token_replace(variable_get('booking_regn_confirm_waiting_page'), $tokens);
|
||||
}
|
||||
|
||||
//optional additional text for married people
|
||||
if ($node->booking_married == 'Y')
|
||||
{
|
||||
if ($node->booking_married == 'Y') {
|
||||
$output .= token_replace(variable_get('booking_regn_confirm_married_text'), $tokens);
|
||||
}
|
||||
|
||||
//put all the bits together
|
||||
//create the render array
|
||||
$return_array[] = array('paragraph' => array('#type' => 'markup', '#markup' => $output));
|
||||
//$return_array[] = array('form' => $paypal_form);
|
||||
|
||||
//return the form
|
||||
return $return_array;
|
||||
|
@@ -561,7 +561,7 @@ function booking_waitinglist_page() {
|
||||
FROM (
|
||||
SELECT p.nid, p.booking_firstname, p.booking_lastname, p.booking_state, p.booking_country, p.booking_readinggroup, pay.booking_payment_date, p.booking_status
|
||||
FROM {booking_person} p, {booking_payment} pay
|
||||
WHERE booking_eventid = :eid and p.nid = pay.booking_person_nid and ( booking_status = 2 or booking_status = 4)
|
||||
WHERE p.booking_eventid = :eid and p.nid = pay.booking_person_nid and ( booking_status = 2 or booking_status = 4)
|
||||
) AS booking
|
||||
ORDER BY booking_status, booking_payment_date',
|
||||
array(':eid' => $event->eid));
|
||||
@@ -820,4 +820,4 @@ function booking_csv_report() {
|
||||
|
||||
//@unlink($filename);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user